diff options
author | Denis Mingulov <[email protected]> | 2010-06-18 11:02:48 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <[email protected]> | 2010-06-18 11:50:41 +0200 |
commit | b2fabac69e1468161f3221ca14ad40636a8bc2c4 (patch) | |
tree | f3b6ff8507c00c55439a3fac413a2ceca8e10a38 /src/plugins/imageviewer/imageviewer.cpp | |
parent | aa7d2c54d3f2b7b9d610f6f654247fef27fb28d6 (diff) |
ImageViewer: Pick up the icons from the system theme using QIcon::fromTheme
Merge-request: 2165
Reviewed-by: Thorbjørn Lindeijer <[email protected]>
Diffstat (limited to 'src/plugins/imageviewer/imageviewer.cpp')
-rw-r--r-- | src/plugins/imageviewer/imageviewer.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plugins/imageviewer/imageviewer.cpp b/src/plugins/imageviewer/imageviewer.cpp index c44b941295d..ad6754c12cb 100644 --- a/src/plugins/imageviewer/imageviewer.cpp +++ b/src/plugins/imageviewer/imageviewer.cpp @@ -36,6 +36,7 @@ #include <coreplugin/icore.h> #include <coreplugin/uniqueidmanager.h> +#include <utils/qtcassert.h> #include <QtCore/QMap> #include <QtCore/QFileInfo> @@ -69,6 +70,17 @@ ImageViewer::ImageViewer(QWidget *parent) d_ptr->toolbar = new QWidget(); d_ptr->ui_toolbar.setupUi(d_ptr->toolbar); + // icons update - try to use system theme + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonZoomIn, "zoom-in"); + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonZoomOut, "zoom-out"); + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonOriginalSize, "zoom-original"); + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonFitToScreen, "zoom-fit-best"); + // a display - something is on the background + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonBackground, "video-display"); + // "emblem to specify the directory where the user stores photographs" + // (photograph has outline - piece of paper) + updateButtonIconByTheme(d_ptr->ui_toolbar.toolButtonOutline, "emblem-photos"); + // connections connect(d_ptr->file, SIGNAL(changed()), this, SIGNAL(changed())); @@ -190,5 +202,18 @@ void ImageViewer::scaleFactorUpdate(qreal factor) d_ptr->ui_toolbar.labelInfo->setText(info); } +bool ImageViewer::updateButtonIconByTheme(QAbstractButton *button, const QString &name) +{ + QTC_ASSERT(button, return false); + QTC_ASSERT(!name.isEmpty(), return false); + + if (QIcon::hasThemeIcon(name)) { + button->setIcon(QIcon::fromTheme(name)); + return true; + } + + return false; +} + } // namespace Internal } // namespace ImageViewer |