[Qt-interest] some questions about qtreewidget , context menu and items....

Bogdan Slusarczyk bodzio131 at op.pl
Sun Jul 4 19:01:04 CEST 2010


> first , i want to add a context menu to the qtreewidget , but i just want that when i right click one item
> (and not the top items) ,the menu will appear ,  just as the kget do . how can i do this?

you could use itemClicked() signal and QApplication::mouseButtons() to determine right button, or inherit QTreeWidget and override mousePressEvent() and use itemAt() to recognize which item was clicked

> i also want to make a item up and down ,for example , make a item ,whose position is 3 , the first
> one ,how make it come ture ?

probably you have to remove item and insert it again at different position (I'm not sure if remove is necessary if you insert the same item at different position)




More information about the Qt-interest-old mailing list