ruby - Display an icon before text in a QTreeView -
I am using QTB with QT 4.8.6 and am trying to create a tree view where each item There is a custom icon between tree control and name. The end result should be:
I get the allotted space for the icon where I should go, but I do not see any icon, what do I have to do to show them?
Here my code (Slightly simplified to remove no-data-side-case cases):
class MyModel & lt; Qt :: AbstractItemModel # ... def data (index, role) role of the case when qt :: displayroll case index.column when 0; Qt :: Virion.nu (index.internalPointer.displayName) when the 1; Qt :: Variant.new (index.internalPointer.displayType) when Qt :: DecorationRole if index.column == 0 Then # test to show a constant icon for all items Qt :: Pixmap.new (': / resources / Images / Objects-Scene-General Page '') End And End And Mitivyve.model = Mimodel.New If you want to inspect the Qt Designer
.ui File (if the tree view should have a property set I do not have).
Let me verify that the image can not be found with the specified path.
Comments
Post a Comment