Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
KCalc
Commits
d5ae89b8
Commit
d5ae89b8
authored
Oct 13, 2021
by
Niklas Freund
Browse files
Made restore from maximized workaround more reliable
parent
4c4d136f
Changes
1
Hide whitespace changes
Inline
Side-by-side
kcalc.cpp
View file @
d5ae89b8
...
...
@@ -2665,15 +2665,19 @@ void KCalculator::resizeEvent(QResizeEvent* event)
{
// Call the overridden resize event
KXmlGuiWindow
::
resizeEvent
(
event
);
updateGeometry
();
// If the content size is now larger than the window size, resize window to fit
// (Workaround for bug where changing from simple to science mode in maximized state
// and then restoring results in the window being too small for content)
QSize
contentSize
=
firstVerticalLayout
->
contentsRect
().
size
();
QSize
contentSize
=
KCalculator
::
contentsRect
().
size
();
QMargins
contentMargins
=
KCalculator
::
contentsMargins
();
QSize
windowSize
=
KCalculator
::
frameSize
();
if
(
contentSize
.
width
()
+
contentMargins
.
left
()
+
contentMargins
.
right
()
>
windowSize
.
width
()
||
contentSize
.
height
()
+
contentMargins
.
top
()
+
contentMargins
.
bottom
()
>
windowSize
.
height
())
{
KCalculator
::
resize
(
0
,
0
);
// force window as small as possible for current layout
QSize
actualSize
(
contentSize
.
width
()
+
contentMargins
.
left
()
+
contentMargins
.
right
(),
contentSize
.
height
()
+
contentMargins
.
top
()
+
contentMargins
.
bottom
());
QSize
minSize
=
KCalculator
::
minimumSize
();
if
(
actualSize
.
width
()
<
minSize
.
width
()
||
actualSize
.
height
()
<
minSize
.
height
())
{
KCalculator
::
resize
(
minSize
);
// force window as small as possible for current layout
}
// Adjust button fonts
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment