diff options
author | Jan Darmochwal | 2010-10-09 14:31:58 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-09 14:31:58 +0200 |
commit | 5c4fae7ba2429dbc03d3c741b9cb7b98e4de47ae (patch) | |
tree | 9e8f5bdfe19bd89fbd2bd742a3eee9707113157a | |
parent | Empty icon for VSessions, default to vmware icon (diff) | |
download | vmchooser-5c4fae7ba2429dbc03d3c741b9cb7b98e4de47ae.tar.gz vmchooser-5c4fae7ba2429dbc03d3c741b9cb7b98e4de47ae.tar.xz vmchooser-5c4fae7ba2429dbc03d3c741b9cb7b98e4de47ae.zip |
SVG Icon support
This patch adds support for SVG icons.
Add an image with an alias ending in .svg to images.qrc to use SVG images.
SVG icons will be preferred over other icons.
-rw-r--r-- | src/sessiontreemodel.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp index 6ebe11c..12eebf5 100644 --- a/src/sessiontreemodel.cpp +++ b/src/sessiontreemodel.cpp @@ -1,7 +1,10 @@ +#include "sessiontreemodel.h" + +#include <QFileInfo> #include <QIcon> +#include <QResource> #include <QString> -#include <QFileInfo> -#include "sessiontreemodel.h" + #include "sessiontreeitem.h" SessionTreeModel::SessionTreeModel(QObject *parent) @@ -56,7 +59,13 @@ QVariant SessionTreeModel::data(const QModelIndex &index, int role) const { return QIcon(icon); } else { // try to load icon from QResource - return QIcon(":" + icon.toLower()); + if (QResource(":" + icon.toLower() + ".svg").isValid()) { + return QIcon(":" + icon.toLower() + ".svg"); + } else if (QResource(":" + icon.toLower()).isValid()) { + return QIcon(":" + icon.toLower()); + } else { + return QIcon(":none"); + } } } } |