View Full Version : How to set initial QDockWidget's size?
rajesh
16th November 2006, 07:02
How to set initial QDockWidget's size?
I don’t want to use
m_pWorkspaceDockWidget->setMaximumWidth(150 );
If I use setMaximumWidth( ) then at run time user not able to resize. I want to give facilities to resize at run time by using mouse, but initially application show QDockWidget width 150 only.
Thanks & Regards
wysota
16th November 2006, 09:58
Try returning a proper sizeHint().
rajesh
16th November 2006, 10:10
I don't know how to implement sizeHint() in QDocWidget?
I have written the following code:
m_pWorkspaceDockWidget = new QDockWidget( "Workspace Explorer", this );
m_pWorkspaceDockWidget->setWhatsThis(tr("<b>Workspace Explorer</b> <br>It displays all the items in the workspace\
that you opened.</br> "));
m_pWorkspaceDockWidget->setFeatures( QDockWidget::AllDockWidgetFeatures );
addDockWidget( Qt::LeftDockWidgetArea, m_pWorkspaceDockWidget );
m_pWorkspaceDockWidget->setBackgroundRole( QPalette::Button );
m_pWorkspaceDockWidget->setMinimumHeight( 400 );
//m_pWorkspaceDockWidget->setMaximumWidth(150 );
m_pWorkspaceDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
m_pWorkspaceDockWidget->adjustSize();
wysota
16th November 2006, 10:33
Subclass and reimplement the sizeHint() method.
villy
16th November 2006, 15:49
Did you try with QDockWindow::setFixedExtentWidth ( int w )?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.