Skip to content
GitLab
Menu
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
6ff969e3
Commit
6ff969e3
authored
Sep 04, 2021
by
Niklas Freund
Browse files
Fixed window being too small after restoring from maximized state
parent
5ec2cc53
Changes
3
Hide whitespace changes
Inline
Side-by-side
kcalc.cpp
View file @
6ff969e3
...
...
@@ -2550,6 +2550,25 @@ void KCalculator::slotPaste()
core
.
setOnlyUpdateOperation
(
false
);
}
//------------------------------------------------------------------------------
// Name: resizeEvent
// Desc: resize window and make sure it's large enough for its content
//------------------------------------------------------------------------------
void
KCalculator
::
resizeEvent
(
QResizeEvent
*
event
)
{
// Call the overridden resize event
KXmlGuiWindow
::
resizeEvent
(
event
);
// If the content size is now larger than the window size, resize window to fit
QSize
contentSize
=
firstVerticalLayout
->
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
}
}
////////////////////////////////////////////////////////////////
// Include the meta-object code for classes in this file
//
...
...
kcalc.h
View file @
6ff969e3
...
...
@@ -126,6 +126,8 @@ private:
void
setAngle
();
void
setBase
();
void
resizeEvent
(
QResizeEvent
*
event
)
override
;
void
updateDisplay
(
UpdateFlags
flags
);
void
updateHistoryWithFunction
(
CalcEngine
::
Operation
);
KCalcStatusBar
*
statusBar
();
...
...
kcalc.ui
View file @
6ff969e3
...
...
@@ -24,7 +24,7 @@
<enum>
QLayout::SetMinimumSize
</enum>
</property>
<item>
<layout
class=
"QVBoxLayout"
>
<layout
class=
"QVBoxLayout"
name=
"firstVerticalLayout"
>
<item>
<widget
class=
"KCalcDisplay"
name=
"calc_display"
>
<property
name=
"sizePolicy"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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