From 51f830068cb6b4847468aced1aa654932c39bf80 Mon Sep 17 00:00:00 2001 From: Arno Date: Mon, 27 Dec 2010 15:52:30 +0100 Subject: 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. --- shemoviconprovider.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shemoviconprovider.cpp') diff --git a/shemoviconprovider.cpp b/shemoviconprovider.cpp index 569956c..c46fa13 100644 --- a/shemoviconprovider.cpp +++ b/shemoviconprovider.cpp @@ -11,6 +11,7 @@ #include "shemoviconprovider.h" #include "helper.h" +#include "smglobals.h" SheMovIconProvider::SheMovIconProvider() {}; @@ -18,9 +19,8 @@ QIcon SheMovIconProvider::icon(const QFileInfo &info) const { if(info.isDir()){ QSettings s; QString fi(s.value("ui/foldericon").toString()); - if(fi == "Dildo"){ - return QIcon(":/dildo.png"); - } + const QHash icons = SmGlobals::instance()->icons(); + return QIcon(icons.value(fi)); } QString type = Helper::mimeType(info.absoluteFilePath()); if(type.toLower().startsWith("video")){ -- cgit v1.2.3-70-g09d2