Commit 8d861b83 authored by Niklas Freund's avatar Niklas Freund
Browse files

Fixed leftPad buttons not scaling correctly

parent 012be435
......@@ -697,9 +697,7 @@ void KCalculator::updateGeometry()
// right pad
const auto rightPadList = rightPad->children();
for (QObject *obj : rightPadList) {
auto const button = qobject_cast<KCalcButton *>(obj);
// let Shift expand freely
if (button && button != pbShift) {
if (auto const button = qobject_cast<KCalcButton *>(obj)) {
button->setMinimumWidth(em.width() * 3 + margin * 2);
button->installEventFilter(this);
}
......
......@@ -191,15 +191,8 @@ void KCalcButton::calcSizeHint()
// want narrow margin than normal
margin = qMax(margin / 2, 3);
// approximation because metrics doesn't account for richtext
size_ = fontMetrics().size(0, mode_[ModeNormal].label);
if (mode_.contains(ModeShift)) {
size_ = size_.expandedTo(fontMetrics().size(0, mode_[ModeShift].label));
}
if (mode_.contains(ModeHyperbolic)) {
size_ = size_.expandedTo(fontMetrics().size(0, mode_[ModeHyperbolic].label));
}
// simply use font size of a single letter
size_ = fontMetrics().size(0, QStringLiteral("M"));
size_ += QSize(margin * 2, margin * 2);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment