Results 1 to 7 of 7

Thread: QDockWidget nesting problem..

  1. #1
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default QDockWidget nesting problem..

    I have a main window and two dock widgets. When I nest one dock widget over the other, the widget inside them appear to draw on the parent, even though it is not desired. I found this problem related to setting the setMinimumSize on dock widgets. If u set the minimumsize and nest / overlap the dock widget, the widget that should be drawn is drawn. I am attaching an example showing the problem


    I also tried with the dock widget example in Qt Demos, and upon setting the minimum size say setMinimumSize(200,200), that example also behaves abnormally.

    Is this a bug ?
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: QDockWidget nesting problem..

    hellooo...
    nebody to help ??
    thers no problem if i remove the setMinimumSize() function. So is this a bug ??

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Unhappy Re: QDockWidget nesting problem..




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

    Default Re: QDockWidget nesting problem..

    use SizeHint to set initial size and use minimumSizeHint() for set minimum size.

    for eg:
    replace your code to
    MyDockWidget *dock1 = new MyDockWidget("dock 1");
    see attachment.
    Qt Code:
    1. class MyDockWidget : public QDockWidget
    2. {
    3. public:
    4. MyDockWidget(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0)
    5. :QDockWidget(title,parent, flags)
    6. {
    7. setWindowTitle(title);
    8. setAllowedAreas(Qt::AllDockWidgetAreas);
    9. szHint = QSize(-1, -1); // for initial size
    10. minSzHint = QSize(100, 100); // for minimum size
    11. }
    12. virtual QSize sizeHint() const
    13. {
    14. return szHint;
    15. }
    16. virtual QSize minimumSizeHint() const
    17. {
    18. return minSzHint;
    19. }
    20. private:
    21. QSize szHint, minSzHint;
    22. };
    To copy to clipboard, switch view to plain text mode 
    Attached Files Attached Files
    Last edited by jacek; 31st January 2007 at 15:34. Reason: changed [html] to [code]

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

    Default Re: QDockWidget nesting problem..

    you can nest / overlap the dock widget by code also.
    using:
    tabifyDockWidget(dock1, dock2);

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: QDockWidget nesting problem..

    Thanx for the reply, but it doesnt help

    already mentioned in the first post, that the problem occurs due to setting setMinimumSize. If setMinimumSize is not set, it works witout the size hint too.

    As for the size hint, it written in the docs...
    If minimumSize() is set, the minimum size hint will be ignored.

    So your solution deosnt work.
    Try setting minimum size for docking widget example. It will behave abnormally

    I just wanted to know if this abnormal behaviour is a bug ??

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

    Default Re: QDockWidget nesting problem..

    Hi,
    sometime back I got the same problem, So I removed setMinimumSize() and added minimumSizeHint() to fix minimum size.
    it may be bug, you need to report trolltech(support@trolltech.com) to create bug report.
    I have created some bug report releted to QDockWidget. you can track this
    http://www.trolltech.com/customer/task-tracker with task id 145881


    Thanks & Regards
    Rajesh

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. QDockWidget flicker
    By fellobo in forum Qt Programming
    Replies: 1
    Last Post: 28th April 2006, 20:42
  3. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  4. Problem in restoring more than one QDockWidget
    By vratojr in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2006, 13:45
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Qt is a trademark of The Qt Company.