Horizontally align labels on info widget page.

Left aligning text values looked wrong.

Use Qobject cast to filter labels from any other qobjects around and
set alignment. Doing this via Qt Designer would be tedious.

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Amit Chaudhuri 2013-05-09 08:32:27 +01:00 committed by Dirk Hohndel
parent 4f4d40925b
commit 7f9fbd2295

View file

@ -21,6 +21,14 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
ui->setupUi(this);
ui->cylinders->setModel(cylindersModel);
ui->weights->setModel(weightModel);
/* example of where code is more concise than Qt designer */
QList<QObject *> infoTabWidgets = ui->infoTab->children();
Q_FOREACH( QObject* obj, infoTabWidgets ){
QLabel* label = qobject_cast<QLabel *>(obj);
if (label)
label->setAlignment(Qt::AlignHCenter);
}
}
void MainTab::clearEquipment()