diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-11 12:54:56 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-01-24 07:04:35 +0000 |
commit | d58162127a1f0c4c7de919643cd5cccc8a84b259 (patch) | |
tree | 6ac46d27750f4882809bad0546b55a4ece2e19ca /src | |
parent | f61304fc77a622170ef3bbcbcb37c5a90c6f87ea (diff) |
QCommonStyle: Add dock title bar icons
Add larger pixmaps for the dock title bar icons; override
them by the XPM in fusion style to maintain the behavior.
Task-number: QTBUG-38776
Change-Id: I7d0e022bbf620d2aad2b6ee011b8bb9a745d7c3b
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src')
15 files changed, 49 insertions, 0 deletions
diff --git a/src/widgets/styles/images/closedock-10.png b/src/widgets/styles/images/closedock-10.png Binary files differnew file mode 100644 index 0000000000..ee2af34550 --- /dev/null +++ b/src/widgets/styles/images/closedock-10.png diff --git a/src/widgets/styles/images/closedock-16.png b/src/widgets/styles/images/closedock-16.png Binary files differnew file mode 100644 index 0000000000..570012fc9a --- /dev/null +++ b/src/widgets/styles/images/closedock-16.png diff --git a/src/widgets/styles/images/closedock-20.png b/src/widgets/styles/images/closedock-20.png Binary files differnew file mode 100644 index 0000000000..b5ea92d1de --- /dev/null +++ b/src/widgets/styles/images/closedock-20.png diff --git a/src/widgets/styles/images/closedock-32.png b/src/widgets/styles/images/closedock-32.png Binary files differnew file mode 100644 index 0000000000..95a1ad014d --- /dev/null +++ b/src/widgets/styles/images/closedock-32.png diff --git a/src/widgets/styles/images/closedock-48.png b/src/widgets/styles/images/closedock-48.png Binary files differnew file mode 100644 index 0000000000..3ca36d1394 --- /dev/null +++ b/src/widgets/styles/images/closedock-48.png diff --git a/src/widgets/styles/images/closedock-64.png b/src/widgets/styles/images/closedock-64.png Binary files differnew file mode 100644 index 0000000000..cbec2052ad --- /dev/null +++ b/src/widgets/styles/images/closedock-64.png diff --git a/src/widgets/styles/images/normalizedockup-10.png b/src/widgets/styles/images/normalizedockup-10.png Binary files differnew file mode 100644 index 0000000000..f380c65035 --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-10.png diff --git a/src/widgets/styles/images/normalizedockup-16.png b/src/widgets/styles/images/normalizedockup-16.png Binary files differnew file mode 100644 index 0000000000..1b795a9e84 --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-16.png diff --git a/src/widgets/styles/images/normalizedockup-20.png b/src/widgets/styles/images/normalizedockup-20.png Binary files differnew file mode 100644 index 0000000000..857338427f --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-20.png diff --git a/src/widgets/styles/images/normalizedockup-32.png b/src/widgets/styles/images/normalizedockup-32.png Binary files differnew file mode 100644 index 0000000000..d8993a1067 --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-32.png diff --git a/src/widgets/styles/images/normalizedockup-48.png b/src/widgets/styles/images/normalizedockup-48.png Binary files differnew file mode 100644 index 0000000000..be48c9524c --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-48.png diff --git a/src/widgets/styles/images/normalizedockup-64.png b/src/widgets/styles/images/normalizedockup-64.png Binary files differnew file mode 100644 index 0000000000..7b540f04f8 --- /dev/null +++ b/src/widgets/styles/images/normalizedockup-64.png diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 4a83cdd4a6..1190099c16 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -5709,6 +5709,22 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti return QPixmap(); } +#if QT_CONFIG(imageformat_png) +static inline QString iconResourcePrefix() { return QStringLiteral(":/qt-project.org/styles/commonstyle/images/"); } +static inline QString iconPngSuffix() { return QStringLiteral(".png"); } + +static void addIconFiles(const QString &prefix, const int sizes[], size_t count, QIcon &icon) +{ + for (size_t i = 0; i < count; ++i) { + const int size = sizes[i]; + icon.addFile(prefix + QString::number(size) + iconPngSuffix(), QSize(size, size)); + } +} + +static const int dockTitleIconSizes[] = {10, 16, 20, 32, 48, 64}; + +#endif // imageformat_png + /*! \internal */ @@ -6215,12 +6231,20 @@ QIcon QCommonStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption case SP_MediaVolumeMuted: icon.addFile(QLatin1String(":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"), QSize(16, 16)); break; + case SP_TitleBarCloseButton: + addIconFiles(iconResourcePrefix() + QStringLiteral("closedock-"), + dockTitleIconSizes, sizeof(dockTitleIconSizes)/sizeof(dockTitleIconSizes[0]), icon); + break; case SP_TitleBarMenuButton: # ifndef QT_NO_IMAGEFORMAT_XPM icon.addPixmap(titleBarMenuCachedPixmapFromXPM()); # endif icon.addFile(QLatin1String(":/qt-project.org/qmessagebox/images/qtlogo-64.png")); break; + case SP_TitleBarNormalButton: + addIconFiles(iconResourcePrefix() + QStringLiteral("normalizedockup-"), + dockTitleIconSizes, sizeof(dockTitleIconSizes)/sizeof(dockTitleIconSizes[0]), icon); + break; #endif // QT_NO_IMAGEFORMAT_PNG default: icon.addPixmap(proxy()->standardPixmap(standardIcon, option, widget)); diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 80196a39a2..a2b94d59d4 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -3769,6 +3769,19 @@ QRect QFusionStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QIcon QFusionStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { +#if QT_CONFIG(imageformat_xpm) + switch (standardIcon) { + case SP_TitleBarNormalButton: + return QIcon(QPixmap(dock_widget_restore_xpm)); + case SP_TitleBarMinButton: + return QIcon(QPixmap(workspace_minimize)); + case SP_TitleBarCloseButton: + case SP_DockWidgetCloseButton: + return QIcon(QPixmap(dock_widget_close_xpm)); + default: + break; + } +#endif // imageformat_xpm return QCommonStyle::standardIcon(standardIcon, option, widget); } diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc index 9bcd3904a1..2dc3207e6d 100644 --- a/src/widgets/styles/qstyle.qrc +++ b/src/widgets/styles/qstyle.qrc @@ -128,6 +128,18 @@ <file>images/media-volume-16.png</file> <file>images/media-volume-muted-16.png</file> <file>images/fusion_groupbox.png</file> + <file>images/closedock-10.png</file> + <file>images/closedock-16.png</file> + <file>images/closedock-20.png</file> + <file>images/closedock-32.png</file> + <file>images/closedock-48.png</file> + <file>images/closedock-64.png</file> + <file>images/normalizedockup-10.png</file> + <file>images/normalizedockup-16.png</file> + <file>images/normalizedockup-20.png</file> + <file>images/normalizedockup-32.png</file> + <file>images/normalizedockup-48.png</file> + <file>images/normalizedockup-64.png</file> </qresource> <qresource prefix="/qt-project.org/styles/macstyle"> <file alias="images/closedock-16.png">images/closedock-macstyle-16.png</file> |