Results 1 to 4 of 4

Thread: QDockWidget moves out of screen

  1. #1
    Join Date
    Aug 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default QDockWidget moves out of screen

    Hi!
    I have an application with some dockwidgets that are floating, i.e they cannot be docked.
    Every dock has a widget with some buttons and other things in it that is attached to the dock.
    Example:
    Qt Code:
    1. void CreateInfoDock(const QString &name, QWidget *parent)
    2. {
    3. infoDock = new QDockWidget(name, parent);
    4. infoDock->setFloating (true);
    5. infoDock->setAllowedAreas(false);
    6. infoDock->setMinimumHeight(150);
    7. infoDock->setMaximumHeight(170);
    8. infoDock->setMinimumWidth(250);
    9. infoDock->setMaximumWidth(300);
    10.  
    11. infoDockWidget = new InfoDockWidget(infoDock);
    12. infoDock->setWidget( infoDockWidget );
    13. }
    To copy to clipboard, switch view to plain text mode 

    Now, what happends is that if I want to move the dock and by accident press the mouse on the boarder of the dock so it resizes it can suddenly move very fast out of the screen.
    This is really annoying since I can't get it back without recompiling the program with a ->move(int x, int y) command.
    Is there some way that i can disable the resize function so this can't happen?
    //Nils

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDockWidget moves out of screen

    Yes, I've noticed this too with tool windows.
    You can make it not resizable with setFixedSize( sizeHint ), or if you have a top layout in it the use QLayout::setSizeConstraint( QLayout::SetFixedSize ).
    The latter is preferred.

    Regards

  3. #3
    Join Date
    Aug 2006
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget moves out of screen

    Quote Originally Posted by marcel View Post
    Yes, I've noticed this too with tool windows.
    You can make it not resizable with setFixedSize( sizeHint ), or if you have a top layout in it the use QLayout::setSizeConstraint( QLayout::SetFixedSize ).
    The latter is preferred.

    Regards
    Yes, I have tried with setFixedSize(sizeHint) and it didnt work.

    Will try the other.
    Thanks

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QDockWidget moves out of screen

    Try setting the flags Qt::Tool if you want to use setFixedSize.

    Regards

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.