PDA

View Full Version : popup menu appears on scroll bar when right clicked on scroll bar



koklim
4th April 2006, 12:44
hello everyone,

would like to enquire if anyone has encountered this before. Where a popup menu will appear on the scrollbar when the scroll bar is right clicked.

Is there a way to disable this menu? Thanks in advance.

munna
4th April 2006, 12:58
try setContextMenuPolicy(Qt::NoContextMenu)

koklim
4th April 2006, 13:55
will give it a try...must we detect any events beforehand? like contextmenu event or key event?

Lemming
4th April 2006, 14:03
The fact that you widget has a scrollbar makes me think that it is sublassed from QAbsractScrollArea. With all probability you're overloading the contextMenuEvent() in your class. This causes context menu being shown over the scrollbars.

You should overload viewportEvent ( QEvent * e ) in your class and handle the event with QEvent::ContextMenu type there instead of overloading contextMenuEvent().

With all probability this will help.

koklim
5th April 2006, 02:36
Thanks for the imput guys i really appreciate your help I tried both approaches but unfortunately the scrollbar popup menu still appears.

Is this an inbuilt QT feature? could someone in trolltech confirm this? Thanks once again.

(PS i am using Qt 4.1.1)

jpn
5th April 2006, 08:08
scrollArea->horizontalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
scrollArea->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);

koklim
14th April 2006, 05:39
solved the problem...thanks a lot guys...you have beena big help.