From 5c63dc9bbc0fb49ef86e0e1c22abce59369a3421 Mon Sep 17 00:00:00 2001 From: garak Date: Mon, 16 Jan 2023 15:45:45 -0500 Subject: [PATCH] do not scroll encounter tabs with wheel, set current species combo by index instead of text --- src/ui/encountertabledelegates.cpp | 2 +- src/ui/montabwidget.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ui/encountertabledelegates.cpp b/src/ui/encountertabledelegates.cpp index a0baec3e..f47cc6cd 100644 --- a/src/ui/encountertabledelegates.cpp +++ b/src/ui/encountertabledelegates.cpp @@ -35,7 +35,7 @@ QWidget *SpeciesComboDelegate::createEditor(QWidget *parent, const QStyleOptionV void SpeciesComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { QString species = index.data(Qt::EditRole).toString(); NoScrollComboBox *combo = static_cast(editor); - combo->setCurrentText(species); + combo->setCurrentIndex(combo->findText(species)); } void SpeciesComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { diff --git a/src/ui/montabwidget.cpp b/src/ui/montabwidget.cpp index 37897d5f..458a50e8 100644 --- a/src/ui/montabwidget.cpp +++ b/src/ui/montabwidget.cpp @@ -9,7 +9,7 @@ MonTabWidget::MonTabWidget(Editor *editor, QWidget *parent) : QTabWidget(parent) { this->editor = editor; populate(); - installEventFilter(this); + this->tabBar()->installEventFilter(this); } bool MonTabWidget::eventFilter(QObject *, QEvent *event) { @@ -21,6 +21,10 @@ bool MonTabWidget::eventFilter(QObject *, QEvent *event) { if (tabIndex > -1) { askActivateTab(tabIndex, eventPos); } + return true; + } + else if (event->type() == QEvent::Wheel) { + return true; } return false; }