summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-22 09:17:18 -0300
committerGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-05-22 09:17:18 -0300
commitdf57b657fdcc1ac4ff9cf7bdb81e0c7a575f7b3b (patch)
tree7168122687d32c914f70261fb60fc113698c0806 /qt-ui/maintab.cpp
parent003729bde6d88ed59ee0ce088e78b3953a670847 (diff)
downloadsubsurface-df57b657fdcc1ac4ff9cf7bdb81e0c7a575f7b3b.tar.gz
Rework on the Equipment tab to make it look more Modern.
Note that this is a WIP and it does break functionality - ie, not possible to add Equipments, but this will be fixed in the next commit. Removed add / edit / remove buttons, only a single '+' icon appears on the widget now. the edit / delete will be done in place. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
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) {