PDA

View Full Version : Show delegate in treeview all the time regardless of EditTrigger mode



yazwas
24th September 2009, 00:26
Hello Everyone,

I've written a custom delegate and added it to a standard QTreeView, this delegate represents a push-button, and when its clicked it calls a slot to perform some operations

its working ok, if item editing is enabled, after I double click on the item

My question is how to make the button visible all the time (EVEN if I disable the editing of items), or I select another row, i would like the button to be visible on all the rows all the time, is that possible?

Thanks very much for your help

yazwas
24th September 2009, 01:25
Hello again,

I'm able to show the button on all times, I've implemented the 2 virtual functions


void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;


but the button is not enabled till I double click on it, i.e. till its in the edition mode, how can I over come this, so it will be enabled anytime i click on it?

Thanks very much

yazwas
24th September 2009, 01:49
Hello everyone

its Solved

I just had to provide

tableView.openPersistentEditor(index);

to the items where I want to button to show!

:)