do not scroll encounter tabs with wheel, set current species combo by index instead of text

This commit is contained in:
garak 2023-01-16 15:45:45 -05:00 committed by t
parent b5444ce803
commit 5c63dc9bbc
2 changed files with 6 additions and 2 deletions

View file

@ -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<NoScrollComboBox *>(editor);
combo->setCurrentText(species);
combo->setCurrentIndex(combo->findText(species));
}
void SpeciesComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {

View file

@ -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;
}