Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. widget overlapping using layout
QtWS25 Last Chance

widget overlapping using layout

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 5 Posters 13.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by
    #1

    hi guys,,suggest me to solve this problem
    1.I want to add 2 sub widgets in this root widget.
    2.second sub widget is up to first sub widget.
    3.We have loading widget in each ui file.
    4.loading widget is overlapped above other sub widgets.
    I want to add like this,in this layout mode??
    I want to add such above by applyiing layout because our app is small in high resolution coms,To fix this, we must make resizable app and apply layout?

    J.HilkJ 1 Reply Last reply
    0
    • B Bharth

      hi guys,,suggest me to solve this problem
      1.I want to add 2 sub widgets in this root widget.
      2.second sub widget is up to first sub widget.
      3.We have loading widget in each ui file.
      4.loading widget is overlapped above other sub widgets.
      I want to add like this,in this layout mode??
      I want to add such above by applyiing layout because our app is small in high resolution coms,To fix this, we must make resizable app and apply layout?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      hi @Bharth ,

      As far as I know, there's only one way to stack widgets on top of each other, while using a layout.

      That is QGridLayout
      the addWidget functions allows you to place multiple widgets inside the same Cell and all will be effected by the Layout and it's resizing mechanism.

      However this is a c++-code only way. AFAIK you can not do this via the Designer-Plugin.

      Otherwise, you'll have to override the resizeEvent- function of the parent widget and manually adjust the other widgets in that slot.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        To add to @J-Hilk, can you provide one or more pictures of what you would like to achieve ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        B 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          To add to @J-Hilk, can you provide one or more pictures of what you would like to achieve ?

          B Offline
          B Offline
          Bharth
          wrote on last edited by Bharth
          #4

          hi,,
          blue color with two pushbutton is one widget and label with loading image (transparent)is another widget i want like this,,,,here i did't use layout,,
          but want to use layout how to do this using layouts
          0_1548133009382_1548132835094.JPEG

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            QStackedLayout comes to mind to have the widgets on top of each others.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 1 Reply Last reply
            2
            • B Offline
              B Offline
              Bharth
              wrote on last edited by Bharth
              #6

              thank you for your reply
              In desiging mode how to apply stackedlayout,,,,
              QStackedlayout not showing in qt ,its showing only 4 layouts
              vertical,horizontal,grid and form layout

              thanks in advance

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Bharth
                wrote on last edited by
                #7

                i got solution thanks for your reply
                i used resizeEvent function

                in the constructor added below 4 lines
                Qsize window = this->size();
                la=new QLabel(this);
                la->setStylesheet("background-color:red");
                la->setAlignment(Qt::AlignCenter);
                la->setText("testing");

                Void MindowWindow::resizeEvent(QResizeEvent* event)
                {
                QSize window=thia->size();
                la->setMinimumWidth(window.width());
                la->setMinimumHeight(window.width());
                la->setMaximumWidth(window.width());
                la->setMaximumHeight(window.width());
                QMainwindow::resizeEvent(event);
                }

                1 Reply Last reply
                0
                • Maaz MominM Offline
                  Maaz MominM Offline
                  Maaz Momin
                  wrote on last edited by Maaz Momin
                  #8

                  @Bharth Is your label still in Layout? As @SGaist pointed out, using QStackedLayout is the right way.

                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    QStackedLayout comes to mind to have the widgets on top of each others.

                    S Offline
                    S Offline
                    sani1486
                    wrote on last edited by
                    #9

                    @SGaist Can I Use QStackedLayout , two overlay two widgets ? i think what OP wanted to know is , two widget on top of each other , the below widget probably have some child widgets like buttons and other controls, the top widget probably have a logo or something , which is little transparent, so the widget below(with buttons) can also be viewed, .. So far my understanding , QStackedLayout is used by QStackedWidget , and only one widget is visible. but to be able to have both widget visble with some trasnparency , and both of them are sibling , not parent of each other , how one can acheive it . ?

                    Thank you in Advance

                    SGaistS 1 Reply Last reply
                    0
                    • S sani1486

                      @SGaist Can I Use QStackedLayout , two overlay two widgets ? i think what OP wanted to know is , two widget on top of each other , the below widget probably have some child widgets like buttons and other controls, the top widget probably have a logo or something , which is little transparent, so the widget below(with buttons) can also be viewed, .. So far my understanding , QStackedLayout is used by QStackedWidget , and only one widget is visible. but to be able to have both widget visble with some trasnparency , and both of them are sibling , not parent of each other , how one can acheive it . ?

                      Thank you in Advance

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @sani1486 hi and welcome to devnet,

                      Check the stackingMode property. It allows to check whether you see on widget at a time or all of them.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved