Results 1 to 3 of 3

Thread: Docking widgets setFixedSize and setBaseSize Problem

  1. #1
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Docking widgets setFixedSize and setBaseSize Problem

    I have a few docking widgets that I would like to set the width and height of them on startup. However, if I use setBaseSize it does not work at all. I am able to use setFixedSize to get it to startup with the correct size, but then the user cannot resize the docking windows. As a partial workaround I didn't use either, instead I set the setMinimumSize to the size I wanted on startup. Yet, this still leaves the problem of not allowing the user to make the docking window any smaller then the size I specify in setMinimumSize. Is there anyway I can accomplished what I want (to start the window at a specific size, but then allow the user to modify the size however they wish)?

    Thanks in advance.

  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: Docking widgets setFixedSize and setBaseSize Problem

    You should specify the sizeHint for each of the widgets (subclass and reimplement sizeHint()). If anything is to help, this should.

  3. #3
    Join Date
    Oct 2006
    Posts
    83
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Docking widgets setFixedSize and setBaseSize Problem

    Thanks for the tip...it worked perfectly. Incase anybody has a similar problem, here is the solution:

    In the header file:
    Qt Code:
    1. private:
    2. virtual QSize sizeHint () const;
    To copy to clipboard, switch view to plain text mode 
    In the cpp file:
    Qt Code:
    1. QSize ClassName::sizeHint() const
    2. {
    3. QSize theSize(284, 300);
    4. return theSize;
    5. }
    To copy to clipboard, switch view to plain text mode 

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.