Results 1 to 3 of 3

Thread: Catching events for tabBar of tabbed QDockWidget

  1. #1
    Join Date
    Jun 2008
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Catching events for tabBar of tabbed QDockWidget

    I'm using tabbed dock widgets which remain docked to the mainwindow. I want to override the dock widget behavior as follows:

    1) clicking the close button on the dock widget title bar shrinks rather than closes the dock window.
    2) clicking on the tab when the dock widget is shrunk causes it to expand to normal size.

    I've implemented #1 by reimplementing closeEvent() in a subclass of QDockWidget. I then set the minimum and maximum size to 0 and update the geometry. It works fine.

    By restoring the min/max size and updating the geometry again I get the widget to restore its original size, manually.

    However, I don't know how to catch the mouseButtonPress event on the tab bar for the dock widgets. The event isn't propagated to the QDockWidget itself, and there is no API for getting a handle to the tab bar. I've tried installing an event filter on the dockWidget->parentWidget(), but that seems to be the QMainWindow, not the tab bar.

    Any ideas on how to catch a click on the tabBar tabs?

    Using Qt 4.5.1

    Thx.
    -Brian

  2. #2
    Join Date
    May 2009
    Posts
    62
    Thanks
    2
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Catching events for tabBar of tabbed QDockWidget

    Maybe QDockWidget::visibilityChanged works for you?

  3. #3
    Join Date
    Jun 2008
    Posts
    17
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Catching events for tabBar of tabbed QDockWidget

    Well, almost. Having tried that before without success, I just discovered that the setMinimumSize() must be >0 for these signals to be generated.

    However, this only gets generated if the user selects a different tab than the one previously selected. Otherwise, nothing happens. I also can't seem to find a way to unselect all the tabs.

    If I click a different tab, then it works as I want, but not if clicking the same tab again.

    Thanks for the advice, tho.

Similar Threads

  1. How can I know if a QDockWidget is tabbed?
    By ricardo in forum Qt Programming
    Replies: 1
    Last Post: 8th May 2009, 06:51
  2. Tabbed QDockWidget question
    By Khal Drogo in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2008, 17:57
  3. Problem with catching keyPress events ?
    By arbi in forum Qt Programming
    Replies: 12
    Last Post: 1st September 2008, 12:35
  4. QDockWidget Tabbed State
    By jtaylor108 in forum Newbie
    Replies: 2
    Last Post: 2nd August 2007, 00:16

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.