summaryrefslogtreecommitdiffstats
path: root/smtreemodel.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-12-27 15:52:30 +0100
committerArno <am@disconnect.de>2010-12-27 15:52:30 +0100
commit51f830068cb6b4847468aced1aa654932c39bf80 (patch)
tree0eff6453050a77999577310746e24f6182493cf3 /smtreemodel.h
parent7bb7295a9033c0a6729b301e7c9b76393539e29a (diff)
downloadSheMov-51f830068cb6b4847468aced1aa654932c39bf80.tar.gz
SheMov-51f830068cb6b4847468aced1aa654932c39bf80.tar.bz2
SheMov-51f830068cb6b4847468aced1aa654932c39bf80.zip
Made all icons in qresource available for UI
Every registered icon can be chosen as Qt::DecorationRole for all models at once. Suitable icons must be added to SmGlobals::mIcons. Key is a descriptive text, value is the icon path. To make things easier SmTreeModel got two new member functions: -QIcon decorationIcon() returning the current Icon -void setDecorationIcon() to set the current Icon The current Icon is initialized in the constructor from QSettings - ui/iconfolder To update the TreeViews connected to the FileSystemModel a little hack is needed: Just set the QFileIconProvider again. This causes the Model to update connected views.
Diffstat (limited to 'smtreemodel.h')
-rw-r--r--smtreemodel.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/smtreemodel.h b/smtreemodel.h
index 73abe64..f23e767 100644
--- a/smtreemodel.h
+++ b/smtreemodel.h
@@ -11,6 +11,7 @@
#include <QAbstractItemModel>
#include <QStringList>
#include <QHash>
+#include <QIcon>
class SmTreeItem;
@@ -48,6 +49,10 @@ class SmTreeModel : public QAbstractItemModel {
virtual bool removeRows(int row, int count, const QModelIndex &parent);
bool addRow(const QList<QVariant> &data, const QModelIndex &parent);
+ //misc
+ void setDecorationIcon(const QIcon &icon) { mDecorationIcon = icon; }
+ const QIcon decorationIcon() const { return mDecorationIcon; }
+
protected:
SmTreeItem *itemAt(const QModelIndex &index) const;
@@ -55,6 +60,7 @@ class SmTreeModel : public QAbstractItemModel {
QStringList mHeaders;
SmTreeItem *mRootItem;
QHash<QString, int> mHeaderData;
+ QIcon mDecorationIcon;
};
#endif