do not scroll encounter tabs with wheel, set current species combo by index instead of text
This commit is contained in:
parent
b5444ce803
commit
5c63dc9bbc
2 changed files with 6 additions and 2 deletions
|
@ -35,7 +35,7 @@ QWidget *SpeciesComboDelegate::createEditor(QWidget *parent, const QStyleOptionV
|
||||||
void SpeciesComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
|
void SpeciesComboDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const {
|
||||||
QString species = index.data(Qt::EditRole).toString();
|
QString species = index.data(Qt::EditRole).toString();
|
||||||
NoScrollComboBox *combo = static_cast<NoScrollComboBox *>(editor);
|
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 {
|
void SpeciesComboDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
MonTabWidget::MonTabWidget(Editor *editor, QWidget *parent) : QTabWidget(parent) {
|
MonTabWidget::MonTabWidget(Editor *editor, QWidget *parent) : QTabWidget(parent) {
|
||||||
this->editor = editor;
|
this->editor = editor;
|
||||||
populate();
|
populate();
|
||||||
installEventFilter(this);
|
this->tabBar()->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MonTabWidget::eventFilter(QObject *, QEvent *event) {
|
bool MonTabWidget::eventFilter(QObject *, QEvent *event) {
|
||||||
|
@ -21,6 +21,10 @@ bool MonTabWidget::eventFilter(QObject *, QEvent *event) {
|
||||||
if (tabIndex > -1) {
|
if (tabIndex > -1) {
|
||||||
askActivateTab(tabIndex, eventPos);
|
askActivateTab(tabIndex, eventPos);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (event->type() == QEvent::Wheel) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue