![]() Registered Member ![]()
|
Hi,
I want to have a context menu (in a QTreeWidget in case that matters). I have no clue how to get this context menu (these menus you get when you click with the right mouse button). I only found QContextMenuEvent, do I have to use this? Does someone have a tutorial how to use it to get a context menu? Or at least a code sample? Is there something KDE specific? Thanks. |
![]() Administrator ![]()
|
This is only handled by Qt, nothing KDE specific.
You need to set the context menu policy to Qt::CustomContextMenu then connect the customContextMenuRequested signal to one of your slots. In this slot you create and show the context menu at the supplied position. See the QWidget documentation for more information.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]