Results 1 to 8 of 8

Thread: How to get childwidget to appear below parent widget?

  1. #1
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Red face How to get childwidget to appear below parent widget?

    Hey guys,

    I created a parent widget using the mainwindow class and I have a separate widget which I would like to use as a "child widget". When I call the function "show()" on the childwidget, it always appears above the parent widget, is there anyway to have it appear below the parent widget? Thank you.

    I've tried to "lower()" the childwidget, but it just makes both windows "disappear", and it doesn't solve the problem. "raise()" on the parent widget doesn't seem to work either.

    From my understanding "stackunder()" only works on siblig widgets, not parent -child widgets.

    Regards,
    Pembar

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to get childwidget to appear below parent widget?

    "child widget"? I don't understand.

    • if you want a separate window use QDialog (modular or non modular)
    • if you want to layout different widgets, buttons etc. inside a main window use QLayout (QHBoxLayout...)

  3. #3
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get childwidget to appear below parent widget?

    "child widget" was declared as a separate window - QDialog.

    When I get the QDialog to "show()", it appears on top of the mainwindow, I want it to appear below.

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to get childwidget to appear below parent widget?

    then use the move() function to move the dialog accorrding to the parents:os()...

  5. #5
    Join Date
    May 2009
    Posts
    30
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to get childwidget to appear below parent widget?

    I can move it around, no problem. But it seems to always overlap the parent window. I'd like the parent window (mainwindow) to always appear above the child window (QDialog).

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to get childwidget to appear below parent widget?

    Quote Originally Posted by Pembar View Post
    I can move it around, no problem. But it seems to always overlap the parent window. I'd like the parent window (mainwindow) to always appear above the child window (QDialog).
    Ah, ok, now I get you. Sorry took a time. If the dialog is not modular a parent::setFocus() should do the trick.

  7. #7
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to get childwidget to appear below parent widget?

    Quote Originally Posted by Lykurg View Post
    Ah, ok, now I get you. Sorry took a time. If the dialog is not modular a parent::setFocus() should do the trick.
    EDIT: No it doesn't...
    EDIT 2: ...and this wasn't the edit button
    EDIT 3: Answer to your question: it is not possible

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    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: How to get childwidget to appear below parent widget?

    A child window (dialog) is always above its parent. If you want another stack order, don't pass a parent to the dialog (of course then you won't be able to make the dialog modal to the other window).
    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.


Similar Threads

  1. let parent widget grow with child widget?
    By BeS in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 12:17
  2. Replies: 6
    Last Post: 3rd September 2008, 15:27
  3. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 13:00
  4. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 16:13
  5. how to kill parent widget?
    By mahe2310 in forum Qt Programming
    Replies: 3
    Last Post: 23rd March 2006, 13:56

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.