[Qt-interest] Highlighting button in TableView

Noah noah at pcc.com
Mon Feb 22 15:58:45 CET 2010


Helge Fredriksen wrote:
> 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

The easiest way is to openPersistentEditor for the appropriate index 
every time a row is added. Be warned, having a lot of persistent editors 
  open can be a big performance hit. Over-riding paint in a custom 
delegate is far more efficient, but has its own set of caveats - mostly 
inconsistent mouse interaction, which I haven't found a way to 
completely overcome.

  - Noah



More information about the Qt-interest-old mailing list