1 Attachment(s)
popup menu appears on scroll bar when right clicked on scroll bar
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.
Re: popup menu appears on scroll bar when right clicked on scroll bar
try setContextMenuPolicy(Qt::NoContextMenu)
Re: popup menu appears on scroll bar when right clicked on scroll bar
will give it a try...must we detect any events beforehand? like contextmenu event or key event?
Re: popup menu appears on scroll bar when right clicked on scroll bar
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.
Re: popup menu appears on scroll bar when right clicked on scroll bar
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)
Re: popup menu appears on scroll bar when right clicked on scroll bar
Code:
scrollArea->horizontalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
scrollArea->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
Re: popup menu appears on scroll bar when right clicked on scroll bar
solved the problem...thanks a lot guys...you have beena big help.