Commit 7c31ab63 authored by Alexander Kernozhitsky's avatar Alexander Kernozhitsky Committed by Nate Graham
Browse files

Consider small icon size from system

Before that, the values were hardcoded (i.e. 16 for non-tablet mode
and 22 for tablet mode). Now, the value for non-tablet mode is taken
from the system, and the value for tablet mode is one step bigger.

BUG: 455513
FIXED-IN: 5.25.5
parent 0d5a9d0f
Pipeline #213542 passed with stage
in 3 minutes and 52 seconds
......@@ -41,6 +41,7 @@
#include <QMainWindow>
#include <QMdiArea>
#include <QMenu>
#include <QMetaEnum>
#include <QPainter>
#include <QPushButton>
#include <QRadioButton>
......@@ -529,13 +530,25 @@ int Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const QWi
return Metrics::MenuItem_HighlightGap;
// small icon size
case PM_SmallIconSize:
if (isTabletMode()) {
return 22;
} else {
return 16;
case PM_SmallIconSize: {
auto iconSize = ParentStyleClass::pixelMetric(metric, option, widget);
if (!isTabletMode()) {
return iconSize;
}
// in tablet mode, we try to figure out the next size and use it
// see bug 455513
auto metaEnum = QMetaEnum::fromType<KIconLoader::StdSizes>();
for (int i = 0; i + 1 < metaEnum.keyCount(); ++i) {
if (iconSize == metaEnum.value(i)) {
return metaEnum.value(i + 1);
}
}
// size is either too large or unknown, just increase it by 50%
return iconSize * 3 / 2;
}
// frame width
case PM_DefaultFrameWidth:
if (qobject_cast<const QMenu *>(widget))
......
Supports Markdown
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