mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-12 16:36:16 +00:00
Makes the 'auto' edition behave in a better way.
This patch makes the auto editon behave in a better way, now you can scroll the notes widget without marking it as editable, and also adds a bit of code cleanup, and a better logic for editing the other widgets. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
This commit is contained in:
parent
16addbf373
commit
3464bcf6ef
2 changed files with 20 additions and 10 deletions
|
@ -52,7 +52,7 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||||
ui->divemaster->installEventFilter(this);
|
ui->divemaster->installEventFilter(this);
|
||||||
ui->buddy->installEventFilter(this);
|
ui->buddy->installEventFilter(this);
|
||||||
ui->suit->installEventFilter(this);
|
ui->suit->installEventFilter(this);
|
||||||
ui->notes->installEventFilter(this);
|
ui->notes->viewport()->installEventFilter(this);
|
||||||
ui->rating->installEventFilter(this);
|
ui->rating->installEventFilter(this);
|
||||||
ui->visibility->installEventFilter(this);
|
ui->visibility->installEventFilter(this);
|
||||||
|
|
||||||
|
@ -126,18 +126,27 @@ void MainTab::equipmentPlusUpdate()
|
||||||
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
|
addWeight->setGeometry(ui->weightGroup->contentsRect().width() - 30, 2, 24,24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainTab::enableEdition()
|
||||||
|
{
|
||||||
|
if (ui->editAccept->isVisible() || !currentDive)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ui->editAccept->setChecked(true);
|
||||||
|
ui->editAccept->show();
|
||||||
|
ui->editReset->show();
|
||||||
|
on_editAccept_clicked(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool MainTab::eventFilter(QObject* object, QEvent* event)
|
bool MainTab::eventFilter(QObject* object, QEvent* event)
|
||||||
{
|
{
|
||||||
if (event->type() == QEvent::FocusIn || event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::FocusIn && (object == ui->rating || object == ui->visibility)){
|
||||||
if (ui->editAccept->isVisible() || !currentDive)
|
enableEdition();
|
||||||
return false;
|
|
||||||
|
|
||||||
ui->editAccept->setChecked(true);
|
|
||||||
ui->editAccept->show();
|
|
||||||
ui->editReset->show();
|
|
||||||
on_editAccept_clicked(true);
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
enableEdition();
|
||||||
|
}
|
||||||
|
return false; // don't "eat" the event.
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainTab::clearEquipment()
|
void MainTab::clearEquipment()
|
||||||
|
|
|
@ -72,6 +72,7 @@ private:
|
||||||
QPushButton *addCylinder;
|
QPushButton *addCylinder;
|
||||||
QPushButton *addWeight;
|
QPushButton *addWeight;
|
||||||
enum { NONE, DIVE, TRIP } editMode;
|
enum { NONE, DIVE, TRIP } editMode;
|
||||||
|
void enableEdition();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue