Results 1 to 7 of 7

Thread: QWidegt->show() pops out a new window (windows only)

  1. #1
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QWidegt->show() pops out a new window (windows only)

    Hi,
    I discovered a rather strange behavior in my application under Windows. I'm developing an application under Linux and use it on Windows machines also.

    I have a GroupBox holding a widget, and hide and show the widget depending on the toggled Slot of the groupBox.
    In Linux this works really fine.

    In Windows however the widget doesn't show when I start the application. When I click on the checkBox a second time. A new Window containing my widget pops out. I have really no idea how this can happen.
    Anyone any advice?

    Although I have some experience I'm not sure if this isn't a very noobish mistake and therefore post it in the newbs group.

    thx for the help

    Code looks something like this:

    Qt Code:
    1. void myWidget::gbToggled(bool on){
    2. if(on)
    3. otherWidger->show();
    4. else
    5. oderWidget->hide();
    6. }
    To copy to clipboard, switch view to plain text mode 

    linuxout.jpglinux in.jpgwindows in.jpg

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    is this widget parented?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    No it was not! Thx, now it doesn't pop out anymore.
    It just refuses to show itself at all now. Just a little line under box text if the box is checked.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    Well, you have to make sure its not sharing the same space with other widget!
    Use a layout.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    I do.
    But maybe I'm doing t wrong.

    Qt Code:
    1. QGridLayout *layout = new QGridLayout();
    2. gbTimePeriod = new QGroupBox(tr("Zeitraumbezogen"));
    3. gbTimePeriod->setCheckable(true);
    4. connect(gbTimePeriod, SIGNAL(toggled(bool)), this, SLOT(gbToggled(bool)));
    5. layout->addWidget(gbTimePeriod, 0, 0);
    6. QGridLayout *lPeriod = new QGridLayout();
    7. cabw = new ContinuousActionBaseWidget(videoPlayer, this);
    8. lPeriod->addWidget(cabw, 1, 0);
    9. gbTimePeriod->setLayout(lPeriod);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    you embed your widget inside 'layout', but didn't set 'layout' to any widget.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Apr 2012
    Posts
    8
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QWidegt->show() pops out a new window (windows only)

    True, its not in this part.
    the setLayout is at the end of the Constructor. Other widgets are added to the layout as well.

    But nevermind I already found the bug, it was just me being extremely stupid. I still had the addWidget in comments on my Windows Machine and posted code from my VBox where i actually work.
    I didn't consider that because I was so flubber gusted by the widget popping out.
    Anyhow thank you very much for your help and patience, have an awesome day.

Similar Threads

  1. When does show a window?
    By avis_phoenix in forum Qt Programming
    Replies: 2
    Last Post: 7th September 2011, 20:06
  2. Replies: 3
    Last Post: 17th March 2010, 16:47
  3. [HELP] window won't show after build
    By jsmi in forum Newbie
    Replies: 3
    Last Post: 9th March 2010, 22:17
  4. Show parent window
    By Qt Coder in forum Qt Programming
    Replies: 7
    Last Post: 8th June 2009, 09:19
  5. How to show a window widget...
    By agent007se in forum Newbie
    Replies: 3
    Last Post: 20th July 2006, 10:42

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.