summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-12-19 19:45:54 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-20 09:53:04 -0800
commit890d60ff9ec1876ccc3e7af87bf1eb28a480a8e9 (patch)
tree99f298a58ab631ccee3333939ea6f1c36e050b34
parentbffceb18e79fa82fbaa674c814afd5c2612bcdaf (diff)
downloadsubsurface-890d60ff9ec1876ccc3e7af87bf1eb28a480a8e9.tar.gz
Simplify the code by removing a few options from the if.
There was some options on the 'if' that didn't really belonged there, so I create a if before those to quit earlier if the condition is true. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/groupedlineedit.h1
-rw-r--r--qt-ui/maintab.cpp14
2 files changed, 9 insertions, 6 deletions
diff --git a/qt-ui/groupedlineedit.h b/qt-ui/groupedlineedit.h
index 1e29f0039..0433b06b6 100644
--- a/qt-ui/groupedlineedit.h
+++ b/qt-ui/groupedlineedit.h
@@ -65,7 +65,6 @@ signals:
protected:
virtual void paintEvent(QPaintEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
-
private:
struct Private;
Private *d;
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 00498f549..08079c82d 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -281,23 +281,27 @@ void MainTab::enableEdition(EditMode newEditMode)
bool MainTab::eventFilter(QObject* object, QEvent* event)
{
+ if (!isEnabled())
+ return false;
+
+ if (editMode != NONE)
+ return false;
// we want to prevent the user from accidentally enabling editMode:
// for the tagWidget we ignore FocusIn - that's both a click and starting the scroll wheel
// this means a click by itself won't start edit mode - but typing something will
- if (isEnabled() && editMode == NONE && object->objectName() == "tagWidget" &&
+ if (object->objectName() == "tagWidget" &&
event->type() == QEvent::FocusIn)
return true;
// for the dateTimeEdit widget we need to ignore Wheel events as well (as long as we aren't editing)
- if (isEnabled() && editMode == NONE && object->objectName() == "dateTimeEdit" &&
+ if (object->objectName() == "dateTimeEdit" &&
(event->type() == QEvent::FocusIn || event->type() == QEvent::Wheel))
return true;
// MouseButtonPress in any widget (not all will ever get this), KeyPress in the dateTimeEdit,
// FocusIn for the starWidgets or RequestSoftwareInputPanel for tagWidget start the editing
- if (isEnabled() && editMode == NONE &&
- ((event->type() == QEvent::MouseButtonPress) ||
+ if ((event->type() == QEvent::MouseButtonPress) ||
(event->type() == QEvent::KeyPress && object == ui.dateTimeEdit) ||
(event->type() == QEvent::FocusIn && (object == ui.rating || object == ui.visibility)) ||
- (event->type() == QEvent::RequestSoftwareInputPanel && object == ui.tagWidget))) {
+ (event->type() == QEvent::RequestSoftwareInputPanel && object == ui.tagWidget)) {
tabBar()->setTabIcon(currentIndex(), QIcon(":warning"));
enableEdition();
}