diff options
author | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-07 14:26:11 (GMT) |
---|---|---|
committer | Jens Bache-Wiig <jbache@trolltech.com> | 2009-09-07 14:28:15 (GMT) |
commit | 0f4c89bc38e124a8b308f25754e84642194cc2a6 (patch) | |
tree | ae9293adca0f1378a8845372dc8ba29f525739c8 /src | |
parent | 5c15ea9cdfeb39d0f040e144756a7d4e2bd23670 (diff) | |
download | Qt-0f4c89bc38e124a8b308f25754e84642194cc2a6.zip Qt-0f4c89bc38e124a8b308f25754e84642194cc2a6.tar.gz Qt-0f4c89bc38e124a8b308f25754e84642194cc2a6.tar.bz2 |
Use icons on QDialogButtonBox in KDE
Oxygen did not use icons in dialogs. This is obviously
incorrect compared with other KDE apps. We changed common style
to enable button icons by default on X11 and explicitly
disabled them for Windows and Motif styles.
We also updated the icons for YES and NO actions to use
dialog-ok and process-stop to reflect the usaged in
KDE itself.
Reviewed-by: ogoffart
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/styles/qcommonstyle.cpp | 56 | ||||
-rw-r--r-- | src/gui/styles/qmotifstyle.cpp | 3 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 5 | ||||
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 3 |
4 files changed, 52 insertions, 15 deletions
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 7fefb19..817401e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5126,6 +5126,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = Qt::LinksAccessibleByMouse; break; case SH_DialogButtonBox_ButtonsHaveIcons: +#ifdef Q_WS_X11 + return true; +#endif ret = 0; break; case SH_SpellCheckUnderlineStyle: @@ -5222,6 +5225,19 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti if (QApplication::desktopSettingsAware() && !QIcon::themeName().isEmpty()) { switch (sp) { + case SP_DialogYesButton: + case SP_DialogOkButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok")).pixmap(16); + break; + case SP_DialogApplyButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-ok-apply")).pixmap(16); + break; + case SP_DialogDiscardButton: + pixmap = QIcon::fromTheme(QLatin1String("edit-delete")).pixmap(16); + break; + case SP_DialogCloseButton: + pixmap = QIcon::fromTheme(QLatin1String("dialog-close")).pixmap(16); + break; case SP_DirHomeIcon: pixmap = QIcon::fromTheme(QLatin1String("user-home")).pixmap(16); break; @@ -5336,13 +5352,15 @@ QPixmap QCommonStyle::standardPixmap(StandardPixmap sp, const QStyleOption *opti case SP_DialogHelpButton: pixmap = QIcon::fromTheme(QLatin1String("help-contents")).pixmap(24); break; + case SP_DialogNoButton: case SP_DialogCancelButton: - pixmap = QIcon::fromTheme(QLatin1String("process-stop")).pixmap(24); + pixmap = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))).pixmap(24); break; case SP_DialogSaveButton: pixmap = QIcon::fromTheme(QLatin1String("document-save")).pixmap(24); break; - case SP_FileLinkIcon: + case SP_FileLinkIcon: pixmap = QIcon::fromTheme(QLatin1String("emblem-symbolic-link")).pixmap(16); if (!pixmap.isNull()) { QPixmap fileIcon = QIcon::fromTheme(QLatin1String("text-x-generic")).pixmap(16); @@ -5530,6 +5548,25 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_DirOpenIcon: icon = QIcon::fromTheme(QLatin1String("folder-open")); break; + case SP_DialogSaveButton: + icon = QIcon::fromTheme(QLatin1String("document-save")); + break; + case SP_DialogApplyButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); + break; + case SP_DialogYesButton: + case SP_DialogOkButton: + icon = QIcon::fromTheme(QLatin1String("dialog-ok")); + break; + case SP_DialogDiscardButton: + icon = QIcon::fromTheme(QLatin1String("edit-delete")); + break; + case SP_DialogResetButton: + icon = QIcon::fromTheme(QLatin1String("edit-clear")); + break; + case SP_DialogHelpButton: + icon = QIcon::fromTheme(QLatin1String("help-contents")); + break; case SP_FileIcon: icon = QIcon::fromTheme(QLatin1String("text-x-generic")); break; @@ -5575,21 +5612,13 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_ArrowLeft: icon = QIcon::fromTheme(QLatin1String("go-previous")); break; - case SP_DialogHelpButton: - icon = QIcon::fromTheme(QLatin1String("help-contents")); - break; case SP_DialogCancelButton: - icon = QIcon::fromTheme(QLatin1String("process-stop")); + icon = QIcon::fromTheme(QLatin1String("dialog-cancel"), + QIcon::fromTheme(QLatin1String("process-stop"))); break; case SP_DialogCloseButton: icon = QIcon::fromTheme(QLatin1String("window-close")); break; - case SP_DialogApplyButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok-apply")); - break; - case SP_DialogOkButton: - icon = QIcon::fromTheme(QLatin1String("dialog-ok")); - break; case SP_FileDialogDetailedView: icon = QIcon::fromTheme(QLatin1String("view-list-details")); break; @@ -5629,9 +5658,6 @@ QIcon QCommonStyle::standardIconImplementation(StandardPixmap standardIcon, cons case SP_MediaVolumeMuted: icon = QIcon::fromTheme(QLatin1String("audio-volume-muted")); break; - case SP_DialogResetButton: - icon = QIcon::fromTheme(QLatin1String("edit-clear")); - break; case SP_ArrowForward: if (rtl) return standardIconImplementation(SP_ArrowLeft, option, widget); diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp index 3550408..904a8f56 100644 --- a/src/gui/styles/qmotifstyle.cpp +++ b/src/gui/styles/qmotifstyle.cpp @@ -2683,6 +2683,9 @@ QMotifStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWidget *w case SH_LineEdit_PasswordCharacter: ret = '*'; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 8250013..bdd72b7 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -5435,6 +5435,11 @@ int QPlastiqueStyle::styleHint(StyleHint hint, const QStyleOption *option, const case SH_Menu_SubMenuPopupDelay: ret = 96; // from Plastik break; +#ifdef Q_WS_X11 + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = true; + break; +#endif #ifndef Q_OS_WIN case SH_Menu_AllowActiveAndDisabled: ret = false; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 31f96c3..2a88578 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1206,6 +1206,9 @@ int QWindowsStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QWid case SH_ItemView_ArrowKeysNavigateIntoChildren: ret = true; break; + case SH_DialogButtonBox_ButtonsHaveIcons: + ret = 0; + break; default: ret = QCommonStyle::styleHint(hint, opt, widget, returnData); break; |