mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
003729bde6
commit
df57b657fd
5 changed files with 69 additions and 146 deletions
BIN
plus.png
Normal file
BIN
plus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
|
@ -61,8 +61,38 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
if (label)
|
if (label)
|
||||||
label->setAlignment(Qt::AlignHCenter);
|
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)
|
bool MainTab::eventFilter(QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FocusIn) {
|
if (event->type() == QEvent::FocusIn) {
|
||||||
|
|
|
@ -38,6 +38,8 @@ public:
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
bool eventFilter(QObject* , QEvent*);
|
bool eventFilter(QObject* , QEvent*);
|
||||||
|
virtual void resizeEvent(QResizeEvent* );
|
||||||
|
virtual void showEvent(QShowEvent* );
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void on_addCylinder_clicked();
|
void on_addCylinder_clicked();
|
||||||
|
@ -63,6 +65,8 @@ private:
|
||||||
CylindersModel *cylindersModel;
|
CylindersModel *cylindersModel;
|
||||||
NotesBackup notesBackup;
|
NotesBackup notesBackup;
|
||||||
struct dive* currentDive;
|
struct dive* currentDive;
|
||||||
|
QPushButton *addCylinder;
|
||||||
|
QPushButton *addWeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
132
qt-ui/maintab.ui
132
qt-ui/maintab.ui
|
@ -14,7 +14,7 @@
|
||||||
<string>TabWidget</string>
|
<string>TabWidget</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="notesTab">
|
<widget class="QWidget" name="notesTab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -151,55 +151,17 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QGroupBox" name="groupBox">
|
<widget class="QGroupBox" name="cylindersGroup">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Cylinders</string>
|
<string>Cylinders</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="cylinders"/>
|
<widget class="QTableView" name="cylinders"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="editCylinder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addCylinder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delCylinder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="weightGroup">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Weight</string>
|
<string>Weight</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -207,44 +169,6 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="weights"/>
|
<widget class="QTableView" name="weights"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="editWeight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Edit</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="addWeight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer_2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="delWeight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Delete</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -271,24 +195,15 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="diveInfoUpperGridLayout">
|
<layout class="QGridLayout" name="diveInfoUpperGridLayout">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>15</number>
|
<number>15</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="sacLabel">
|
<widget class="QLabel" name="sacLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
|
@ -386,16 +301,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="diveInfoLowerGridLayout">
|
<layout class="QGridLayout" name="diveInfoLowerGridLayout">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -598,16 +504,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="statsUpperGridLayout">
|
<layout class="QGridLayout" name="statsUpperGridLayout">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -750,16 +647,7 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="statsLowerGridLayout">
|
<layout class="QGridLayout" name="statsLowerGridLayout">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>10</number>
|
<number>10</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
<qresource>
|
<qresource>
|
||||||
<file alias="star">star.svg</file>
|
<file alias="star">star.svg</file>
|
||||||
<file alias="subsurface-icon">subsurface-icon.png</file>
|
<file alias="subsurface-icon">subsurface-icon.png</file>
|
||||||
|
<file alias="plus">plus.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue