Results 1 to 11 of 11

Thread: Can we hide & show a QDockWidget with a button or indicator on top of that widget

  1. #1
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Can we hide & show a QDockWidget with a button or indicator on top of that widget

    Hi Friends...

    Im using a QDockWidget in Main Window, my requirement is to hide the dockwidget, is it possible, im trying set the flags for QDockWidget, but there is no specific flag for hiding (means not to totally hide, it should have a button or indicator, by clicking that it has to hide and have to show that dockwidget). Please help me in these lines.

    Thanks in advance,

    Vani.Y

  2. #2
    Join Date
    Nov 2007
    Posts
    42
    Thanks
    11
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    QDockWidget *dockwidger;
    dockwidget->hide();

  3. #3
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    HI..

    Thanks for ur reply, but u understand the problem in wrong way.. may be im not clear... sorry for that.

    i will explain again...

    I want have a Autohide option to QDockWidget (ike In Microsoft Visual Studio Environment if we open solution explorer, to hide option vl be there in tittle bar), like wise in our QDockwidget is there any possibility for auto hide.

    Vani.Y

  4. #4
    Join Date
    Jul 2006
    Location
    Atlanta, GA
    Posts
    86
    Thanks
    26
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    You'd have to manually do that afaik. Create a slot to hide or show the widget and call the slot when the the signal is emitted.
    fnmblot
    --------------------------------------
    Gee Ricky, I'm sorry your mom blew up.

  5. The following user says thank you to fnmblot for this useful post:

    Vani (2nd May 2008)

  6. #5
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    I am doing the same now and it looks like I will have to implement this feature myself. I have found an example here that looks promising:

    http://labs.trolltech.com/forums/topic/406
    John

  7. #6
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    Yeah I was looking for this too. Wondering if someone did make this implementation as close accurate as the .NET Dock widget, will Qt accept it.
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

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

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    With the new animation framework (and the state subframework it uses) it should be pretty simple to implement a nice IDEAI mode.
    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.


  9. #8
    Join Date
    Apr 2008
    Location
    Pittsburgh,PA,USA
    Posts
    48
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    I have checked out this example:

    http://kde-apps.org/content/show.php?content=44015

    and it seems like it may be a better starting point for what I want. It's almost 3 years old but it still works with Qt 4.5.
    John

  10. #9
    Join Date
    Mar 2008
    Location
    Houston, Texas, USA
    Posts
    277
    Thanks
    9
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    Little hard to read lacking barely any documentation of how it works and what not. The little fade in over the button is ugly
    Qt-4.7.3 | Gentoo ~amd64 | KDE-4.7
    Aki IRC Client for KDE4 | Qt Documentation

  11. #10
    Join Date
    Jan 2010
    Posts
    11
    Thanks
    1
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    I've been searching for an answer to this for the last few hours and I think I've come up with a good solution.

    QDockWidget has a method that called setTitleBarWidget(QWidget *). I created a subclass of QTabBar and set this as the TitleBarWidget for my dock.

    In the subclassed QTabBar, I passed in the widget to be displayed so that I could change the size (in my case width to 0) to show/hide the dock widget. I added a tab with the title I wanted for the button to toggle the display of the dock widget. Then, I overrode the MousePressEvent method so that when the Tab Item was clicked, it would change the width of the dock accordingly to show/hide my dock widget.

    Although this thread is a few years old, I hope this still helps someone.

  12. #11
    Join Date
    Apr 2015
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget

    Try This: setAttribute(Qt::WA_WState_ExplicitShowHide);

Similar Threads

  1. How to hide Close Button "X" on Widget ?
    By merry in forum Qt Programming
    Replies: 7
    Last Post: 3rd May 2010, 18:04

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.