summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmdisubwindow.cpp
diff options
context:
space:
mode:
authorAlexander Volkov <a.volkov@rusbitech.ru>2014-12-27 18:10:34 +0300
committerAlexander Volkov <a.volkov@rusbitech.ru>2016-04-13 14:50:27 +0000
commita5c6bad4f02d78dff2afca84fd0c9fc12c3eaf49 (patch)
tree1c7215ecfa39581c2f7d0a849c96d312b84889e8 /src/widgets/widgets/qmdisubwindow.cpp
parentc7364974839e8899a07ef6afba61268028b31faf (diff)
Take the size and the icon size for MDI buttons from a style
This way they can be DPI-dependent. Change-Id: I117c337aaa3e2bf6fb85cb3b04bbbccd9db41070 Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'src/widgets/widgets/qmdisubwindow.cpp')
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index bc364b1a26..afe87c6af9 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -412,6 +412,10 @@ bool ControlLabel::event(QEvent *event)
{
if (event->type() == QEvent::WindowIconChange)
updateWindowIcon();
+ else if (event->type() == QEvent::StyleChange) {
+ updateWindowIcon();
+ setFixedSize(label.size());
+ }
#ifndef QT_NO_TOOLTIP
else if (event->type() == QEvent::ToolTip) {
QStyleOptionTitleBar options;
@@ -480,7 +484,8 @@ void ControlLabel::updateWindowIcon()
QIcon menuIcon = windowIcon();
if (menuIcon.isNull())
menuIcon = style()->standardIcon(QStyle::SP_TitleBarMenuButton, 0, parentWidget());
- label = menuIcon.pixmap(16, 16);
+ const int iconSize = style()->pixelMetric(QStyle::PM_TitleBarButtonIconSize, 0, parentWidget());
+ label = menuIcon.pixmap(iconSize);
update();
}
@@ -556,7 +561,8 @@ QSize ControllerWidget::sizeHint() const
ensurePolished();
QStyleOptionComplex opt;
initStyleOption(&opt);
- QSize size(48, 16);
+ const int buttonSize = style()->pixelMetric(QStyle::PM_TitleBarButtonSize, &opt, mdiArea);
+ QSize size(3 * buttonSize, buttonSize);
return style()->sizeFromContents(QStyle::CT_MdiControls, &opt, size, mdiArea);
}