summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 10645c12f..bbd9ebad8 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -61,8 +61,38 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
if (label)
label->setAlignment(Qt::AlignHCenter);
}
+
+ /*Thid couldn't be done on the ui file because element
+ is floating, instead of being fixed on the layout. */
+ QIcon plusIcon(":plus");
+ addCylinder = new QPushButton(plusIcon, QString(), ui->cylindersGroup);
+ addCylinder->setFlat(true);
+ addCylinder->setToolTip(tr("Add Cylinder"));
+ addWeight = new QPushButton(plusIcon, QString(), ui->weightGroup);
+ addWeight->setFlat(true);
+ addWeight->setToolTip(tr("Add Weight System"));
+}
+
+// We need to manually position the 'plus' on cylinder and weight.
+void MainTab::resizeEvent(QResizeEvent* event)
+{
+ if (ui->cylindersGroup->isVisible())
+ addCylinder->setGeometry( ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
+
+ if (ui->weightGroup->isVisible())
+ addWeight->setGeometry( ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
+
+ QTabWidget::resizeEvent(event);
}
+void MainTab::showEvent(QShowEvent* event)
+{
+ QTabWidget::showEvent(event);
+ addCylinder->setGeometry( ui->cylindersGroup->contentsRect().width() - 30, 2, 24,24);
+ addWeight->setGeometry( ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
+}
+
+
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::FocusIn) {