Results 1 to 7 of 7

Thread: popup menu appears on scroll bar when right clicked on scroll bar

  1. #1
    Join Date
    Jan 2006
    Posts
    10

    Default 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.
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: popup menu appears on scroll bar when right clicked on scroll bar

    try setContextMenuPolicy(Qt::NoContextMenu)

  3. #3
    Join Date
    Jan 2006
    Posts
    10

    Default 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?

  4. #4
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    23
    Thanks
    3
    Thanked 4 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default 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.

  5. #5
    Join Date
    Jan 2006
    Posts
    10

    Default 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)

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: popup menu appears on scroll bar when right clicked on scroll bar

    Qt Code:
    1. scrollArea->horizontalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
    2. scrollArea->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  7. #7
    Join Date
    Jan 2006
    Posts
    10

    Default 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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.