Commit b2fabac6 authored by Denis Mingulov's avatar Denis Mingulov Committed by Thorbjørn Lindeijer
Browse files

ImageViewer: Pick up the icons from the system theme using QIcon::fromTheme

Merge-request: 2165
Reviewed-by: default avatarThorbjørn Lindeijer <>
parent aa7d2c54
......@@ -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();
// 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)
bool ImageViewer::updateButtonIconByTheme(QAbstractButton *button, const QString &name)
QTC_ASSERT(button, return false);
QTC_ASSERT(!name.isEmpty(), return false);
if (QIcon::hasThemeIcon(name)) {
return true;
return false;
} // namespace Internal
} // namespace ImageViewer
......@@ -37,6 +37,8 @@
#include <QtCore/QScopedPointer>
#include <QtCore/QStringList>
namespace ImageViewer {
namespace Internal {
class ImageViewerFile;
......@@ -75,6 +77,15 @@ public:
public slots:
void scaleFactorUpdate(qreal factor);
\brief Try to change button's icon to the one from the current theme
\param button Button where an icon should be changed
\param name Icon name in the in the current icon theme
\return true if icon is updated, false otherwise
bool updateButtonIconByTheme(QAbstractButton *button, const QString &name);
QScopedPointer<struct ImageViewerPrivate> d_ptr;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment