From 7f9fbd229568a85109860c18dd18e1e9928e351f Mon Sep 17 00:00:00 2001 From: Amit Chaudhuri Date: Thu, 9 May 2013 08:32:27 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 4e7f6b3a1..e1ac7c275 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -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 infoTabWidgets = ui->infoTab->children(); + Q_FOREACH( QObject* obj, infoTabWidgets ){ + QLabel* label = qobject_cast(obj); + if (label) + label->setAlignment(Qt::AlignHCenter); + } } void MainTab::clearEquipment() -- cgit v1.2.3-70-g09d2