Ignore mouse wheel events on tags widget
This prevents tags widgets (dive tags and buddy) from grabbing focus on mouse wheel events but allows entering dive edit mode on mouse click. It was attempted earlier by Dirk (commit d117beca), but edit mode did not work properly. Signed-off-by: Sergey Starosek <sergey.starosek@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1891cf1881
commit
ec1088f2cc
@ -305,8 +305,7 @@ bool MainTab::eventFilter(QObject* object, QEvent* event)
|
||||
// FocusIn for the starWidgets or RequestSoftwareInputPanel for tagWidget start the editing
|
||||
if ((event->type() == QEvent::MouseButtonPress) ||
|
||||
(event->type() == QEvent::KeyPress && object == ui.dateTimeEdit) ||
|
||||
(event->type() == QEvent::FocusIn && (object == ui.rating || object == ui.visibility || object == ui.buddy)) ||
|
||||
(event->type() == QEvent::RequestSoftwareInputPanel && object == ui.tagWidget)) {
|
||||
(event->type() == QEvent::FocusIn && (object == ui.rating || object == ui.visibility || object == ui.buddy || object == ui.tagWidget))) {
|
||||
tabBar()->setTabIcon(currentIndex(), QIcon(":warning"));
|
||||
enableEdition();
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NUL
|
||||
addColor( QColor(Qt::green).darker(120) );
|
||||
addColor( QColor(Qt::blue).darker(120) );
|
||||
} // light text. get a dark background.
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
}
|
||||
|
||||
void TagWidget::setCompleter(QCompleter *completer)
|
||||
@ -187,3 +188,8 @@ void TagWidget::keyPressEvent(QKeyEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
void TagWidget::wheelEvent(QWheelEvent *event) {
|
||||
if (hasFocus()) {
|
||||
GroupedLineEdit::wheelEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ public:
|
||||
void setText(QString text);
|
||||
void clear();
|
||||
void setCursorPosition(int position);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
public slots:
|
||||
void reparse();
|
||||
void completionSelected(QString);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user