Results 1 to 7 of 7

Thread: How to Create child widget behind parent widget?

  1. #1
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How to Create child widget behind parent widget?

    hi all,
    I want to create a child widget behind parent widget .How to do this.

  2. #2
    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 Create child widget behind parent widget?

    You can't. The child is always on top of its parent. You can only mix sibling widgets. But what is your usecase? It's very unlikely that you do need to place one widget behind the other.
    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.


  3. #3
    Join Date
    Apr 2009
    Posts
    58
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to Create child widget behind parent widget?

    thanx for reply
    Can u explain how i can place siblings behind one another.I tried stackUnder(QWidget *);

  4. #4
    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 Create child widget behind parent widget?

    This is not something you can really control and I would advise against trying and instead tell us what you are trying to do and we will think of a better solution.
    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.


  5. #5
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: How to Create child widget behind parent widget?

    hi wysota and all,

    is it the standard behavior of Qt that the parent widget will be displayed always below the child, if they are overlapped?

    In my app, i have a control bar widget which is the parent to all other widgets. When the control bar overlapped with any other widget it is being displayed under that widget. But I need to display the control bar on top of children if its clicked and children on top if they are clicked.

    How that can be achieved?

    Thanks in advance!

  6. #6
    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 Create child widget behind parent widget?

    Quote Originally Posted by netmat View Post
    is it the standard behavior of Qt that the parent widget will be displayed always below the child, if they are overlapped?
    Child widget is always on top of its parent and can't extend past the area occupied by its parent (so they always "overlap").
    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.


  7. #7
    Join Date
    Feb 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: How to Create child widget behind parent widget?

    in my case both widgets are window and normally they don't overlap unless you put one over another.
    i have made the "control bar" parent by calling setParent(this, Qt::Window) on it.

    how can i make the z-order normal so that the control bar (parent) will not stay always behind the child widget?

    edit:
    I got the answer here.
    Last edited by netmat; 22nd June 2010 at 13:15.

Similar Threads

  1. Replies: 7
    Last Post: 14th May 2009, 01:37
  2. Replies: 8
    Last Post: 7th May 2009, 14:38
  3. let parent widget grow with child widget?
    By BeS in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 11:17
  4. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  5. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15:13

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.