[SOLVED] Horizontal stretch of QProgressBar within a QGridLayout
-
Hi all,
I'm using Qt 5.2.1 on Xubuntu 12.04 and I'm running into the following problem. Within my GUI I have a QGroupBox that holds a derived QGridLayout.
Within this derived QGridLayout a add several QWidgets:
@void ProgramState::setupWidgets(QWidget *parent)
{
lblState = new QLabel(parent);
lblState->setText("Info");pbProgress = new QProgressBar(parent); pbProgress->setRange(0, 100); pbProgress->setValue(50); btnStart = new QPushButton(parent); btnStart->setText("Start"); btnStart->setEnabled(false); btnStop = new QPushButton(parent); btnStop->setText("Stop"); btnStop->setEnabled(false); this->addWidget(pbProgress, 0, 0, 1, 6, Qt::AlignCenter); this->addWidget(lblState, 1, 0, 2, 2, Qt::AlignCenter); this->addWidget(btnStart, 1, 2, 1, 2, Qt::AlignCenter); this->addWidget(btnStop, 1, 4, 1, 2, Qt::AlignCenter);}@
The QWidgets are added in the right cell (grid) and each grid has the right column span.
!http://matis-digital.com/shutter/server/php/files/2014_03_17_Selection_01.png(Layout)!Unfortunately, I can't seem to find a way to strecht the QProgressBar across the whole width of the grid.
Is there an (easy) way of achieving the auto stretching of the QProgressBar across the whole width of the QGridLayout?
Thnaks in advance,
TOAOMatis
-
Yes, remove Qt::AlignCenter from the progress. You don't want it to center. You want it to stretch (the default) ;)