Results 1 to 10 of 10

Thread: scrollArea not updating

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: scrollArea not updating

    What kind of widget is "newprofile_"? Is it a custom widget, a basic Qt widget or a complex widget composed of other widgets?

  2. #2
    Join Date
    May 2007
    Location
    Australia
    Posts
    30
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6

    Default Re: scrollArea not updating

    newprofile_ is a class that inherits Qwidget. It contains another QWidget X which has buttons and frames. The frames will eventually display a Qwt plot. Its parent is a QMainWindow.
    Depending on user choice, I show/hide X. When X is hidden, another Qwidget Y is shown in its place. Y is also a class that inherits QWidget and I use the same parent (QMainWindow). An instance of Y is created inside newprofile_.
    So the display can change between X and Y but both are on newprofile_ widget.

    Actually, while trying to explain all that, I realised that maybe the parent of Y should be newprofile_ and not QMainWindow. I changed my code and now the layout works without setMinimumSize() and without me having to do anything special.
    Thanks wysota. Sometimes it helps just trying to explain the things I do.

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

    Default Re: scrollArea not updating

    A side note - for switching between X and Y you could use QStackedWidget. It would improve your design a little (as I assume you are creating/showing/hiding those widgets yourself).

    I'm digging the subject, because you were certainly missing a layout or a size hint here somewhere, but it's hard to say where without knowing the details.

  4. #4
    Join Date
    May 2007
    Location
    Australia
    Posts
    30
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    6

    Default Re: scrollArea not updating

    I only create the widgets once (I have 13 of them) and let the user select from a QTreeWidget which one to show. I need to do it this way since each type of widget can appear multiple times but present different info depending on it's location in the tree and user input.

    I had a look at QStackedWidget. It displays arrows (to move between the widgets), which probably was the reason I chose not to use it and I'm not sure if the size of the scroll area will adjust for different widget sizes if I put them all in the stacked widget or just always show the biggest size.
    Other than that it does seem like a good idea. I think the way I wrote the code is very similar to QStackedWidget just using show/hide instead of signals. I have to finish other parts of the application first but I will make a note to come back to this one and see if it makes a difference.

    I think my original problem stemmed from not having the right parent to all those new widgets. Once that was fixed everything worked well and I didn't have to set anything more.

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

    Default Re: scrollArea not updating

    Quote Originally Posted by user View Post
    I had a look at QStackedWidget. It displays arrows (to move between the widgets), which probably was the reason I chose not to use it and I'm not sure if the size of the scroll area will adjust for different widget sizes if I put them all in the stacked widget or just always show the biggest size.
    The arrows are only in Designer. They are not there in a real application.

Similar Threads

  1. updating database with custom delegate
    By Shaitan in forum Qt Programming
    Replies: 4
    Last Post: 17th July 2007, 10:34
  2. Replies: 5
    Last Post: 16th May 2007, 11:03
  3. Replies: 15
    Last Post: 8th May 2007, 11:46
  4. QTreeWidget without the ScrollArea?
    By Paalrammer in forum Newbie
    Replies: 5
    Last Post: 13th February 2007, 19:06
  5. Problem with QScrollArea updating from 4.0.1 to 4.1.0
    By SkripT in forum Qt Programming
    Replies: 8
    Last Post: 28th January 2006, 22:35

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.