vendredi 26 juin 2015

Changing QTreeview checkbox to icon without using stylesheets

I wanted to have a QTreeView with icons ( which act as a checkbox ) followed by some text from a subclass of QAbstractItemModel. I cannot modify or change the structure of this QAbstractItemModel.

When I use this QAbstractItemModel with QTreeview, it shows checkbox followed by some text and performs the intended function required. I just wanted to change this check box to on and off icons.

I found this :- Customizing the checkboxes of the items of a QTreeView

But, I cannot use stylesheets in my case as the icon I want to use some system icons which are loaded using icon loader which returns a KIcon instance ( subclass of QIcon ).

What would be the right way of doing this?

I saw this tutorial and tried creating an editor for checkbox. But, how should I register editor as QVariant does not have Qt::CheckStateRole type?

I tried using Qt::Int, but it doesn't works




Aucun commentaire:

Enregistrer un commentaire