Results 1 to 3 of 3

Thread: Context menu on tab

  1. #1
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Context menu on tab

    Hi,
    Im working with tab widget, and I am trying to implement context menu on this widget. What I want to do is, if I right click on upper part,hmm, not sure about right english word, so here is picture of what I mean


    So there are two tabs
    -Clipboard
    -Tab0
    -....etc

    I need to know if I right-click on clipboard, tab0 or what ever tab i click on if there are more of them. I know how to find which tab is up(In this picture Tab0), I think I know how to find if I clicked on tab widget or some another widget, but Im not sure how to find on which tab hmm..stil not sure about name,you know, the part shown on the picture. Can please anyone direct me on the right track?
    Thx

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Context menu on tab

    Use QTabWidget::tabBar() to query for its tab bar. Set its context menu policy to custom and connect its customContextMenuRequested(QPoint) signal to a slot of yours. Then use QTabBar::tabAt() to map the point you get to the tab index and show a menu.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    wolfi3b (18th October 2010)

  4. #3
    Join Date
    Sep 2010
    Posts
    14
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Context menu on tab

    Thx :-) Helped a lot :-)

Similar Threads

  1. Context Menu on QTableWidget
    By ankurjain in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2009, 09:52
  2. Context menu
    By dejvis in forum Newbie
    Replies: 2
    Last Post: 20th September 2009, 22:02
  3. Qwt and context menu
    By giusepped in forum Qwt
    Replies: 1
    Last Post: 9th December 2008, 08:55
  4. Context Menu
    By RY in forum Newbie
    Replies: 1
    Last Post: 10th September 2008, 07:59
  5. QScrollBar context menu
    By ChasW in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2007, 06:45

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.