Results 1 to 5 of 5

Thread: How to set initial QDockWidget's size?

  1. #1
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Question How to set initial QDockWidget's size?

    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

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

    Default Re: How to set initial QDockWidget's size?

    Try returning a proper sizeHint().

  3. #3
    Join Date
    May 2006
    Location
    Bangalore,India
    Posts
    235
    Thanks
    7
    Thanked 25 Times in 24 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: How to set initial QDockWidget's size?

    I don't know how to implement sizeHint() in QDocWidget?
    I have written the following code:

    Qt Code:
    1. m_pWorkspaceDockWidget = new QDockWidget( "Workspace Explorer", this );
    2. m_pWorkspaceDockWidget->setWhatsThis(tr("<b>Workspace Explorer</b> <br>It displays all the items in the workspace\
    3. that you opened.</br> "));
    4.  
    5. m_pWorkspaceDockWidget->setFeatures( QDockWidget::AllDockWidgetFeatures );
    6.  
    7. addDockWidget( Qt::LeftDockWidgetArea, m_pWorkspaceDockWidget );
    8. m_pWorkspaceDockWidget->setBackgroundRole( QPalette::Button );
    9. m_pWorkspaceDockWidget->setMinimumHeight( 400 );
    10. //m_pWorkspaceDockWidget->setMaximumWidth(150 );
    11. m_pWorkspaceDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
    12. m_pWorkspaceDockWidget->adjustSize();
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 16th November 2006 at 11:33. Reason: changed [html] to [code]

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

    Default Re: How to set initial QDockWidget's size?

    Subclass and reimplement the sizeHint() method.

  5. #5
    Join Date
    Jul 2006
    Location
    Cagliari - Sardinia - Italy
    Posts
    26
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: How to set initial QDockWidget's size?

    Did you try with QDockWindow::setFixedExtentWidth ( int w )?

Similar Threads

  1. Qt 4.2: QListWidget changes size of its items
    By KingFish in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2006, 12:06
  2. Replies: 1
    Last Post: 24th October 2006, 17:40
  3. QTreeView font size not being set
    By forrestfsu in forum Qt Tools
    Replies: 2
    Last Post: 12th October 2006, 14:53
  4. tool bar icon size looking small???
    By darpan in forum Qt Tools
    Replies: 7
    Last Post: 31st March 2006, 17:38
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 23:14

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.