PDA

View Full Version : Can QWidgets (QPushButtons) be simultanously placed inside multiple QTreeView cells?



philw
16th January 2011, 02:35
(This isn't in reference to a QWidget placed in a single QTreeView cell for editing). In the image below (using Qt 4.6.3; see also link), the "pencils" and "ellipsis buttons" in this QTreeView are actually just QIcons. They are implemented as images provided by the QAbstractItemModel's "data()" method, returned for the Qt:: DecorationRole data role. Clicking on them performs a function through the use of the "clicked" signal from the QTreeView.

http://cadswes2.colorado.edu/~philw/2011/Qt4/WidgetsInQTreeViews/sample2.gif

5764

http://cadswes2.colorado.edu/~philw/2011/Qt4/WidgetsInQTreeViews/

I really wanted to implement them as QPushButtons, but it's not clear that that's possible. Can different QWidgets (e.g. QPushButtons) be simultaneously displayed in different QTreeView cells -- e.g. in the columns showing icons in the provided image?

See also abstracted Qt 4.6.3 code samples (http://cadswes2.colorado.edu/~philw/2011/Qt4Port/BoilerTreeView/Bake1/):
http://cadswes2.colorado.edu/~philw/2011/Qt4Port/BoilerTreeView/Bake1/

Thank you in advance,
Phil Weinstein
CADSWES, University of Colorado at Boulder, USA