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. QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget
QtWS25 Last Chance

QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 3 Posters 3.0k 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.
  • J jimfar

    QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget

    jsulmJ Online
    jsulmJ Online
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #2

    @jimfar As any other widget? Put both in a vertical layout.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • J jimfar

      QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #3

      @jimfar
      hi,
      that really depends on how you manage your Widget position.
      But, generally speaking, you can use QWidget::raise() to move it on top of the stack, QWidget::lower() to move it to the bottom, or use QWidget::stackUnder(QWidget *w) to place it under the QWidget W


      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
      0
      • J Offline
        J Offline
        jimfar
        wrote on last edited by
        #4

        yes i try all these method for my QProgressBar (mentioned as another QWidget)and also for the WindowContainer ,but it not work for me

        jsulmJ 1 Reply Last reply
        0
        • J jimfar

          yes i try all these method for my QProgressBar (mentioned as another QWidget)and also for the WindowContainer ,but it not work for me

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #5

          @jimfar Can you show your code?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jimfar
            wrote on last edited by
            #6
              QGridLayout *layout = new QGridLayout(this);
            

            m_window->lower();
            QWidget*pw=QWidget::createWindowContainer(m_window, pw, Qt::Widget);

            pw->setFocusPolicy(Qt::TabFocus);
            pw->setAcceptDrops(true);
            setAcceptDrops(true);
            layout->setMargin(0);
            layout->setSpacing(0);
            layout->setContentsMargins(0, 0, 0, 0);
            this->setContentsMargins(0, 0, 0, 0);
            layout->addWidget(pw);
            
            
            
            pProgressBar = NULL;
            pProgressBar = new QProgressBar(this);
            pProgressBar->setVisible(true);
            pProgressBar->setMinimum(0);
            pProgressBar->setMaximum(100);
            QPoint PT = this->geometry().center();
            pProgressBar->setMinimumWidth(this->width() / 4);
            pProgressBar->move(PT.x() - pProgressBar->width() / 2, PT.y() -   pProgressBar->height() / 2);
            pProgressBar->raise();
            
            jsulmJ 1 Reply Last reply
            0
            • J jimfar
                QGridLayout *layout = new QGridLayout(this);
              

              m_window->lower();
              QWidget*pw=QWidget::createWindowContainer(m_window, pw, Qt::Widget);

              pw->setFocusPolicy(Qt::TabFocus);
              pw->setAcceptDrops(true);
              setAcceptDrops(true);
              layout->setMargin(0);
              layout->setSpacing(0);
              layout->setContentsMargins(0, 0, 0, 0);
              this->setContentsMargins(0, 0, 0, 0);
              layout->addWidget(pw);
              
              
              
              pProgressBar = NULL;
              pProgressBar = new QProgressBar(this);
              pProgressBar->setVisible(true);
              pProgressBar->setMinimum(0);
              pProgressBar->setMaximum(100);
              QPoint PT = this->geometry().center();
              pProgressBar->setMinimumWidth(this->width() / 4);
              pProgressBar->move(PT.x() - pProgressBar->width() / 2, PT.y() -   pProgressBar->height() / 2);
              pProgressBar->raise();
              
              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @jimfar You never do

              pw->show();
              

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jimfar
                wrote on last edited by
                #8

                just a code fragment , now the mian problem is when pw is showing and then shoing the pProgressBar will not work

                1 Reply Last reply
                0
                • J Offline
                  J Offline
                  jimfar
                  wrote on last edited by
                  #9

                  above it is just Code snippet , i tryed "pw->lower();" the pProgressBar also couldnt show after execute pProgressBar ->show()

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jimfar
                    wrote on last edited by
                    #10

                    and if replacing "QWidgetpw=QWidget::createWindowContainer(m_window, pw, Qt::Widget);"as "QWidgetpw=new QWidget(this)", it work well for me ,i suspect this createWindowContainer api maybe have some bug i dont found yet

                    jsulmJ 1 Reply Last reply
                    0
                    • J jimfar

                      and if replacing "QWidgetpw=QWidget::createWindowContainer(m_window, pw, Qt::Widget);"as "QWidgetpw=new QWidget(this)", it work well for me ,i suspect this createWindowContainer api maybe have some bug i dont found yet

                      jsulmJ Online
                      jsulmJ Online
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #11

                      @jimfar In this line you pass pw as parent:

                      QWidget*pw=QWidget::createWindowContainer(m_window, pw, Qt::Widget);
                      

                      Do you have another pw there? Because if not this code actually should not compile.
                      Can you show the whole code?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        jimfar
                        wrote on last edited by
                        #12

                        sorry type wrong word ,pw should be this

                        1 Reply Last reply
                        0
                        • JonBJ JonB referenced this topic on

                        • Login

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