[BUG] Roles of Plasma::Delegate always have to be set explicitly
p.schmidt at uni-kassel.de
p.schmidt at uni-kassel.de
Sun Aug 23 02:50:02 CEST 2009
Hello,
while creating a Plasmoid I was wondering why my subtitles in a
QTreeView rendered with Plasma::Delegate were not shown at all (and
SubTitleMandatory ignored). After some digging in
kdelibs/plasma/delegate.cpp I realized that the specific roles for
Plasma::Delegate are not initialized on object creation - the map
stays empty and QMap returns 0 when being used on non-existing keys. I
did not use any own roles so far, so I did not remap the roles of
Plasma::Delegate via setRoleMapping().
Within the official plasmoids that use Plasma::Delegate, the roles are
set to other roles always, so this problem never occurs. Since this
usage is quite common, I'm not sure whether you consider it a bug.
If not, it would be nice to have a note in the API reference to always
set the roles explicitly.
If yes, I attached a trivial patch to just set the three roles in the
constructor.
Cheers,
Philipp Schmidt
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
--- delegate.cpp 2009-08-23 02:13:17.000000000 +0200
+++ delegate.cpp 2009-08-23 02:22:22.000000000 +0200
@@ -149,6 +149,10 @@ Delegate::Delegate(QObject *parent)
d->svg = new FrameSvg(this);
d->svg->setImagePath("widgets/viewitem");
d->svg->setElementPrefix("hover");
+
+ setRoleMapping(SubTitleRole, SubTitleRole);
+ setRoleMapping(ColumnTypeRole, ColumnTypeRole);
+ setRoleMapping(SubTitleMandatoryRole, SubTitleMandatoryRole);
}
Delegate::~Delegate()
More information about the Plasma-devel
mailing list