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
Forum Updated to NodeBB v4.3 + New Features

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.1k 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 Offline
    J Offline
    jimfar
    wrote on 3 Apr 2018, 07:35 last edited by
    #1

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

    J J 2 Replies Last reply 3 Apr 2018, 07:51
    0
    • J jimfar
      3 Apr 2018, 07:35

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

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 3 Apr 2018, 07:51 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
        3 Apr 2018, 07:35

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

        J Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 3 Apr 2018, 07:52 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 3 Apr 2018, 08:03 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

          J 1 Reply Last reply 3 Apr 2018, 08:34
          0
          • J jimfar
            3 Apr 2018, 08:03

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

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 3 Apr 2018, 08:34 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 3 Apr 2018, 08:42 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();
              
              J 1 Reply Last reply 3 Apr 2018, 08:44
              0
              • J jimfar
                3 Apr 2018, 08:42
                  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();
                
                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 3 Apr 2018, 08:44 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 3 Apr 2018, 08:53 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 3 Apr 2018, 09:07 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 3 Apr 2018, 09:14 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

                      J 1 Reply Last reply 3 Apr 2018, 11:50
                      0
                      • J jimfar
                        3 Apr 2018, 09:14

                        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

                        J Offline
                        J Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on 3 Apr 2018, 11:50 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 4 Apr 2018, 00:01 last edited by
                          #12

                          sorry type wrong word ,pw should be this

                          1 Reply Last reply
                          0
                          • J JonB referenced this topic on 5 May 2023, 07:54

                          6/12

                          3 Apr 2018, 08:42

                          • Login

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