Results 1 to 3 of 3

Thread: Problem with customized QTabWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with customized QTabWidget

    Quote Originally Posted by SeanM View Post
    But the problem I’m having is that the right-click on the ‘+’ tab emits currentChanged(int) BEFORE mousePressEvent() is called, causing creation of a new tab in slotTabBarClicked().
    The cause this is most likely that the tab widget is not the actual receiver of the mouse event, its QTabBar child is. So th tab bar reacts to the event first and you see it when it propagates upwards.

    My suggestion would be to access the tab bar and its tab buttons.
    For all tab buttons that you want a context menu, set the same context actions using addAction() and set the button's contextMenuPolicy to ActionsContextMenu.

    You should then only have to react to the actions' triggered() signals.

    Another option you could investigate is to use QTabBar's corner widgets.

    Cheers,
    __

  2. #2
    Join Date
    Jan 2014
    Posts
    36
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with customized QTabWidget

    Ok, I hadn't dug down into the QTabBar class, I'm not sure why I didn't think to do that. I'll poke around in it and see what works best.

Similar Threads

  1. Problem using QTabWidget
    By UchihaMk in forum Qt Programming
    Replies: 8
    Last Post: 7th September 2012, 20:58
  2. Problem with QTabWidget
    By alizadeh91 in forum Qt Programming
    Replies: 3
    Last Post: 6th August 2012, 11:12
  3. QTabWidget problem
    By hnfmr in forum Qt Programming
    Replies: 4
    Last Post: 25th February 2011, 15:10
  4. Problem displaying image on a customized button
    By bhavikdhoot in forum Qt Programming
    Replies: 1
    Last Post: 16th December 2010, 10:48
  5. QTabWidget problem
    By Strongoloid in forum Newbie
    Replies: 2
    Last Post: 10th September 2009, 20:38

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
  •  
Qt is a trademark of The Qt Company.