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
wilder
Alexander Kernozhitsky 4 years ago committed by Nate Graham
parent 0d5a9d0f34
commit 7c31ab6357
  1. 23
      kstyle/breezestyle.cpp

@ -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))

Loading…
Cancel
Save