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
Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget
QDockWidget *dockwidger;
dockwidget->hide();
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
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.
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
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.
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.
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.
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
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. :)
Re: Can we hide & show a QDockWidget with a button or indicator on top of that widget
Try This: setAttribute(Qt::WA_WState_ExplicitShowHide);