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
0ea1574b
Commit
0ea1574b
authored
Sep 04, 2021
by
Niklas Freund
Browse files
Improved scaling of button layouts
parent
207ba5ff
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
kcalc.cpp
View file @
0ea1574b
...
...
@@ -706,10 +706,7 @@ void KCalculator::updateGeometry()
const
auto
numericPadList
=
numericPad
->
children
();
for
(
QObject
*
obj
:
numericPadList
)
{
if
(
auto
const
button
=
qobject_cast
<
KCalcButton
*>
(
obj
))
{
// let pb0 expand freely
if
(
button
!=
pb0
)
{
button
->
setMinimumWidth
(
em
.
width
()
*
3
+
margin
*
2
);
}
button
->
setMinimumWidth
(
em
.
width
()
*
3
+
margin
*
2
);
button
->
installEventFilter
(
this
);
}
}
...
...
@@ -1893,6 +1890,11 @@ void KCalculator::slotSetSimpleMode()
// must be done after setting the calculator mode because the
// slotBitsetshow slot should save the state only in numeral mode
action_bitset_show_
->
setChecked
(
false
);
// disable leftPad from affecting the layout
QSizePolicy
policy
=
leftPad
->
sizePolicy
();
policy
.
setHorizontalStretch
(
0
);
leftPad
->
setSizePolicy
(
policy
);
}
//------------------------------------------------------------------------------
...
...
@@ -1931,6 +1933,11 @@ void KCalculator::slotSetScienceMode()
// must be done after setting the calculator mode because the
// slotBitsetshow slot should save the state only in numeral mode
action_bitset_show_
->
setChecked
(
false
);
// enable leftPad to affect the layout
QSizePolicy
policy
=
leftPad
->
sizePolicy
();
policy
.
setHorizontalStretch
(
1
);
leftPad
->
setSizePolicy
(
policy
);
}
//------------------------------------------------------------------------------
...
...
@@ -1969,6 +1976,11 @@ void KCalculator::slotSetStatisticMode()
// must be done after setting the calculator mode because the
// slotBitsetshow slot should save the state only in numeral mode
action_bitset_show_
->
setChecked
(
false
);
// enable leftPad to affect the layout
QSizePolicy
policy
=
leftPad
->
sizePolicy
();
policy
.
setHorizontalStretch
(
1
);
leftPad
->
setSizePolicy
(
policy
);
}
//------------------------------------------------------------------------------
...
...
@@ -2005,6 +2017,11 @@ void KCalculator::slotSetNumeralMode()
}
KCalcSettings
::
setCalculatorMode
(
KCalcSettings
::
EnumCalculatorMode
::
numeral
);
// enable leftPad to affect the layout
QSizePolicy
policy
=
leftPad
->
sizePolicy
();
policy
.
setHorizontalStretch
(
1
);
leftPad
->
setSizePolicy
(
policy
);
}
//------------------------------------------------------------------------------
...
...
kcalc.ui
View file @
0ea1574b
This diff is collapsed.
Click to expand it.
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