Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, July 2007
QWidgets can live in the column of a QTreeWidgetItem ?


Message 1 in thread

Can a QTreeWidgetItem host a QWidget in one of its columns?

Specifically, I'd like to place a QComboBox into one of the columns of a 
particular QTreeWidgetItem to provide a quick drop-down with a set of 
choices about that particular QTreeWidgetItem.

Mark

-- 
 [ signature omitted ] 

Message 2 in thread

On torsdag den 19. Juli 2007, Mark Thompson wrote:
> Can a QTreeWidgetItem host a QWidget in one of its columns?
>
> Specifically, I'd like to place a QComboBox into one of the columns of a
> particular QTreeWidgetItem to provide a quick drop-down with a set of
> choices about that particular QTreeWidgetItem.

I would suggest that you switch to QTreeView instead. Short term, it's hard 
and a fair amount of work to make the model for it. But long term, it's a 
life saver.

If you do this, you should read up on delegates. You can set any widget as 
the "handle widget" inside the tree view, and these are called delegates.

Trust me, you will not regret having a proper model, once you are done with 
it. QTreeWidgetItems are IMHO really quite horrible to work with in every way 
but one: They are quick to start out with.

Bo.

-- 
 [ signature omitted ]