QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget
-
QWidget::createWindowContainer() ,how to put this widget createdby this API to stackunder another QWidget
-
@jimfar As any other widget? Put both in a vertical layout.
-
@jimfar
hi,
that really depends on how you manage your Widget position.
But, generally speaking, you can useQWidget::raise()
to move it on top of the stack,QWidget::lower()
to move it to the bottom, or useQWidget::stackUnder(QWidget *w)
to place it under the QWidget W -
yes i try all these method for my QProgressBar (mentioned as another QWidget)and also for the WindowContainer ,but it not work for me
-
@jimfar Can you show your code?
-
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();
-
@jimfar You never do
pw->show();
-
just a code fragment , now the mian problem is when pw is showing and then shoing the pProgressBar will not work
-
above it is just Code snippet , i tryed "pw->lower();" the pProgressBar also couldnt show after execute pProgressBar ->show()
-
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
-
@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? -
sorry type wrong word ,pw should be this
-
6/12