Results 1 to 3 of 3

Thread: QScrollArea behaves differently after I call hide() or show() on contained widget

  1. #1
    Join Date
    Dec 2010
    Location
    Israel
    Posts
    90
    Thanks
    59
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QScrollArea behaves differently after I call hide() or show() on contained widget

    I have an application showing QwtPlot widgets inside a QScrollArea.

    I have the following code defining my scrollable container:

    Qt Code:
    1. holder = new QWidget(ui.groupBoxChart);
    2.  
    3. myVerticalLayout = new QVBoxLayout(holder);
    4. ui.scrollArea->setWidgetResizable(true);
    5. ui.scrollArea->setWidget(holder);
    To copy to clipboard, switch view to plain text mode 

    When the user checks a checkbox deciding which plot to display, this code is called:
    Qt Code:
    1. MyPlot *newPlot = new MyPlot(ui.scrollArea);
    2.  
    3. myVerticalLayout->addWidget(newPlot);
    4.  
    5. newPlot->show();
    To copy to clipboard, switch view to plain text mode 

    When the user checks a different checkbox, the code hides any displayed plots with hide();

    Currently the behavior I get is -
    * the first time a plot is shown it is shrinked to fit the size of the scroll area *without* scrollbars displayed.
    * after checking a different check box and then checking the first one again (causing hide and then show) the plot is redisplayed larger than the scroll area (thus causing the scrollbars to appear).

    I would like to understand what causes this, and then decide how i want it to behave.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QScrollArea behaves differently after I call hide() or show() on contained widget

    Can you post a fully compiling example (preferably without the qwt requirement...)?
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Dec 2010
    Location
    Israel
    Posts
    90
    Thanks
    59
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QScrollArea behaves differently after I call hide() or show() on contained widget

    Thanks for the reply. Will be a bit hard as I'm working around other issues. I hope I can manage to and then I will update the thread.

Similar Threads

  1. Replies: 10
    Last Post: 20th April 2015, 23:24
  2. Replies: 3
    Last Post: 30th December 2010, 16:34
  3. MAC: Getting Dock widget show/hide events
    By jay in forum Qt Programming
    Replies: 3
    Last Post: 31st May 2010, 09:07
  4. Hide and Show QMenu
    By febil in forum Qt Programming
    Replies: 3
    Last Post: 25th March 2009, 10:31
  5. hide from taskbar but show to ALT-TAB
    By musikit in forum Qt Programming
    Replies: 0
    Last Post: 15th August 2008, 17:14

Tags for this Thread

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.