[SOLVED] Multiple item delegates in QTreeWidget



  • Hello everyone,

    I was wondering, whether it is possible to have multiple item delegate types, like for one column a QComboBox and for the other one QSpinBox?

    Well if it's not, no big deal, I have already added a QComboBox widget to one of the columns, it just would be nicer to have an editor pop up on double click.

    Kind Regards
    Raivis


  • Moderators

    you can use QAbstractItemView::setItemDelegateForColumn()
    But for this purpose 1 delegate should be also fine. Just create your editor widget depending on the column index.



  • Thank you!

    I went for 1 delegate approach, where I'm checking the column, and create the delegate accordingly. Works like a charm. Somehow didn't occur to me, that it could be this simple.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.