Results 1 to 6 of 6

Thread: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

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

    Exclamation BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    See http://www.qtcentre.org/threads/2995...-how-its-added.

    This has nothing to do with the particular child-widget used.

    In any order 4 is the maximum number of child widgets a layout can handle (even via sub-layouts or addRow where one row equals one child-widget) before the widget becomes invisible.

    So confirmed with Qt 4.6.2 under Windows 7.


    See submission at http://bugreports.qt.nokia.com/browse/QTBUG-10008
    Last edited by planetLars; 18th April 2010 at 12:27.

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

    Default Re: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    You mean this doesn't work?

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char **argv){
    4. QApplication app(argc, argv);
    5. QVBoxLayout *l = new QVBoxLayout(&w);
    6. for(int i=0;i<10;i++) {
    7. QPushButton *b = new QPushButton(QString::number(i+1));
    8. l->addWidget(b);
    9. }
    10. w.showMaximized();
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    Hi,

    this does work. I phrased too general obviously.

    I checked other parts of my code. I have 2 QWidget windows. The first accesses the seconds position when the first gets moved. This appears to work as long as there are 4 child-widgets inside. Having 5 leads to the second window being invisible. So it may even be a bug in my code or something I can work around now. I am going to check further with the first window (I stripped the code related to the second window and that "BUG" occurs) and report back.

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

    Default Re: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    Please ask your invisible widget for its geometry. It is possible you just moved it out of the screen boundaries.

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

    Default Re: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    Hello,

    it appears that a void moveEvent(QMoveEvent*) gets fired on void show() and the moveEvent code gets executed before the show code which is where I initialize variables for the second windows position. As the moveEvent uses these variables the second window gets put to some outside random location thus being invisible.

    Not a bug after all (except if that event mechansim is unintentional or not wanted). Apparently the randomness of the uninitialized variables is "outside screen" for 5 child-widgets and "inside screen" for 4 child-widgets.

    Thank you.

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

    Default Re: BUG: adding 5 child-widgets to a widgets layout makes widget invisible

    Quote Originally Posted by planetLars View Post
    Not a bug after all
    Yeeeay... another one bites the star dust
    (except if that event mechansim is unintentional or not wanted).
    Of course it is intentional.

    Apparently the randomness of the uninitialized variables is "outside screen" for 5 child-widgets and "inside screen" for 4 child-widgets.
    Not really

  7. The following user says thank you to wysota for this useful post:

    planetLars (25th April 2010)

Similar Threads

  1. Replies: 5
    Last Post: 18th March 2010, 09:54
  2. Replies: 1
    Last Post: 14th May 2009, 22:00
  3. Replies: 1
    Last Post: 30th March 2009, 14:28
  4. How to get the child widgets from a Widget?
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2009, 13:26
  5. Qidget height resize if child widgets invisible
    By visor_ua in forum Qt Programming
    Replies: 1
    Last Post: 27th April 2008, 11:27

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.