Results 1 to 11 of 11

Thread: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

Hybrid View

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

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    Change the "widgetResizable" property of the scroll area to true. Also bear in mind your construction is very weird (or at least unusual). You allow test2 to be created with a parent and then you place it inside some other widget (the scroll area) that reparents the widget to itself. Furthermore there is no reference to the window (scroll area) outside the test2 object which leads to a certain memory leak.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  2. #2
    Join Date
    Apr 2010
    Posts
    25
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    Diph already pointed out the source of error: I forgot that I don't get the QScrollArea fro free when I have it inside a Widget, I need to add the QScrollArea and not the Widget to the layout.

    I have Destructors which delete every object created including the scroll area from the test2 destructor equivalent in my non-test code. Or is there something else about memory leaks I should be aware of?

    Lars

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

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    Quote Originally Posted by planetLars View Post
    I have Destructors which delete every object created including the scroll area from the test2 destructor equivalent in my non-test code. Or is there something else about memory leaks I should be aware of?
    So when exactly do you delete the scroll area object? Actually I see the question is meaningless as you didn't want the scroll area to be a top level widget, despite what your code says...
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Apr 2010
    Posts
    25
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    I delete the scrollbar when the class2-equivalent gets destroyed. And class2 gets deleted when the main application gets destroyed. I wanted my class2-equivalent be a self contained widget which (I can place anywhere and which) brings its own scroll area without the user having to fuss with scrollbars.

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

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    Don't you think it should inherit QScrollArea or QAbstractScrollArea then?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Apr 2010
    Posts
    25
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QScrollArea ->setWidget(this) doesn't produce a ScrollArea. Why?

    This was a question. I ponder it further. Thanks. Good Night.

    Lars

Similar Threads

  1. Definitively QScrollArea doesn't want work. I need help.
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 7th January 2010, 07:21
  2. Replies: 2
    Last Post: 24th August 2009, 12:40
  3. why scrollbar doesn't display in QscrollArea
    By myhot21 in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2009, 02:38
  4. Replies: 1
    Last Post: 26th December 2008, 12:59
  5. How to dynamiclly produce the tab by QT/E?
    By xxthink in forum Qt Programming
    Replies: 1
    Last Post: 27th September 2008, 22:08

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