Results 1 to 19 of 19

Thread: how to overlap widgets

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

    Default how to overlap widgets

    I need to overlap two qvideowidget in same lyout how can i do it plz could anyone help me in 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 overlap widgets

    Implement your own layout that will do that. However that's (I mean overlapping widgets) probably not the proper approach to solve your real problem, whatever it might be.
    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 overlap widgets

    ''Implement your own layout that will do that.''
    i didnt get it.Can u explain it lil bit more

  4. #4
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: how to overlap widgets

    Use QStackedWidget class. The QStackedWidget is a "notebook" but without "bookmarks". Changing a page in QStackedWidget is made otherwise (using setCurrentIndex(), which is a slot, but like any other slot, which can be called directly).

  5. #5
    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 overlap widgets

    Quote Originally Posted by herculis View Post
    i didnt get it.Can u explain it lil bit more
    Subclass QLayout and implement virtual functions that will position the widgets the way you want.

    However, again, that will probably not solve your real problem which is the goal of overlapping widgets. Overlapping widgets is usually a bad idea and there are other ways to achieve similar results. Choosing the right approach depends on the task that needs to be solved.

    http://www.catb.org/esr/faqs/smart-questions.html#goal
    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.


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

    Default Re: how to overlap widgets

    I want to show a video on let say on display1 after some time will hide the display1 and then display2 will show the remaining video.
    So i need widget tobe overlap.

  7. #7
    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 overlap widgets

    Quote Originally Posted by herculis View Post
    So i need widget tobe overlap.
    No, you don't. You can e.g. use QGraphicsView with two QGraphicsVideoItem instances and fade (or whatever you want) those. Even if you choose to go with widgets, you don't need any layout for overlapping them, just place them in a common parent and make sure their geometry covers the geometry of the 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.


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

    Default Re: how to overlap widgets

    Thanks wysota.
    Actually i am new to Qt and C++ so can you plz give me one short exmaple of this parent and child concept.

  9. #9
    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 overlap widgets

    This is the most basic thing about Qt. See docs on Object Trees & Ownership
    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.


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

    Default Re: how to overlap widgets

    ok thanks
    and How can i hide or fade one widget and show other.

  11. #11
    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 overlap widgets

    By calling hide() and show() respectively.
    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.


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

    Default Re: how to overlap widgets

    So if i use hide and show the problem is it takes a few mili seconds to hide and show other and therefore there is a gap very small but it exist i dont want that gap how can i remove gap

  13. #13
    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 overlap widgets

    With widgets you will always have a small gap. That's why I suggested to use QGraphicsView. Then you can easily manipulate opacity of each item to provide a fluent transition.
    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.


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

    Default Re: how to overlap widgets

    I tried to make the qwidget tranparent as i m using qstackwidget class and i did the upper widget transparent but i cannot see the lower widget its just a black screen can u help me in this

    and regarding qgraphicview how can i make it transparent.

  15. #15
    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 overlap widgets

    Please have a look at API exposed for graphics items, you will surely find a relevant method. I even mentioned it a couple of posts back. I don't want to repeat myself over and over again.
    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.


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

    Default Re: how to overlap widgets

    Hi wysota,
    I used qgraphicvideoitem ,overlap them with setsize and make one of the item transparent but then also there is somemili sec gap to make it transpaent and show other video item

  17. #17
    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 overlap widgets

    How are you switching the items? Show your code please.
    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.


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

    Default Re: how to overlap widgets

    screen=qgraphicvideoitem();
    screen1->setOpacity(0);

    with this command I am making it transparent.

  19. #19
    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 overlap widgets

    Quote Originally Posted by herculis View Post
    screen=qgraphicvideoitem();
    screen1->setOpacity(0);

    with this command I am making it transparent.
    That's not enough to help you. Please show complete code which demonstrates how the whole process looks like.
    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. Replies: 1
    Last Post: 31st March 2017, 09:51
  2. Make Dock Widgets overlap main view
    By genjix in forum Qt Programming
    Replies: 1
    Last Post: 23rd October 2010, 14:16
  3. multiple toolbars overlap
    By bittuthegr8 in forum Newbie
    Replies: 1
    Last Post: 2nd October 2010, 07:58
  4. Can I Programatically Overlap Dock Widgets?
    By bieber in forum Qt Programming
    Replies: 0
    Last Post: 29th June 2010, 19:42
  5. Widget overlap
    By Oleg in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2010, 19:53

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.