Results 1 to 6 of 6

Thread: How to create a sibling widget

  1. #1
    Join Date
    Jul 2014
    Posts
    39
    Qt products
    Qt5
    Platforms
    Windows

    Default How to create a sibling widget

    guys can anyone tell me how can i create sibling widget i am using two qvideowidget i want one to be sibling od other and the i need to use it the command stack under to put it under one another.
    Please help me in this.

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

    Default Re: How to create a sibling widget

    Sibling are entities that have a common parent.
    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
    Jul 2014
    Posts
    39
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to create a sibling widget

    how can i do that means syntax can you help me with a sample code.

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

    Default Re: How to create a sibling widget

    Pass the same parent to constructors of both widgets.

    Qt Code:
    1. QWidget *w1 = new QWidget(someParent);
    2. QWidget *w2 = new QWidget(someParent);
    To copy to clipboard, switch view to plain text mode 
    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
    Jul 2014
    Posts
    39
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to create a sibling widget

    QWidget *window=new QWidget();
    { window->resize(400,300);
    window->show();}
    screen = new QVideoWidget(window);
    mediaPlayer.setVideoOutput(screen);
    //screen->show();
    screen1 = new QVideoWidget(window);
    mediaPlayer1.setVideoOutput(screen1);
    screen1->stackUnder(screen);

    i did it like this
    is screen 1 and screen siblings?

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to create a sibling widget

    Quote Originally Posted by herculis View Post
    is screen 1 and screen siblings?
    They have the same parent, don't they?

    Cheers,
    _

    Quote Originally Posted by herculis View Post
    is screen 1 and screen siblings?
    They have the same parent, don't they?

    Cheers,
    _

Similar Threads

  1. create dock widget from some other widget
    By Onanymous in forum Qt Programming
    Replies: 1
    Last Post: 16th December 2011, 15:22
  2. Replies: 9
    Last Post: 14th September 2010, 18:00
  3. QModelIndex and check if a row sibling has focus
    By Lykurg in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2010, 05:39
  4. How to Create child widget behind parent widget?
    By anupamgee in forum Qt Programming
    Replies: 6
    Last Post: 22nd June 2010, 13:03
  5. Pass mouseEvent to sibling widget?
    By nish in forum Qt Programming
    Replies: 5
    Last Post: 1st September 2009, 13:00

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.