[Qt-interest] Highlighting button in TableView

Guido Seifert Wargand at gmx.de
Thu Feb 18 14:34:47 CET 2010


What you want to do is not that easy. Your delegate draws the button when the delegate editor opens, i.e. your Qt::ItemDataRole is Qt::EditRole. When in Qt::DisplayRole the delegate lets the cell draw itself. To see a button you have to overload the delegate's paint function to draw the button yourself.


At least this is one way, no idea if there is a better way to achieve what you want.


Regards,
Guido



> Hello!
> 
> I have instrumented a QTableView with it's own QItemDelegate to allow some
> of the columns in the table to become a QPushButton. However, to highligh
> for the user that the cell actually is a button, the user has to select
> that
> cell first. It's not until that particular cell has focus that one
> actually
> can see the graphics of the pushbutton. Else it is hidden as an ordinary
> table cell.
> 
> Is is some way for me to avoid this effect?
> 
> Regards,
> Helge Fredriksen

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01



More information about the Qt-interest-old mailing list