Disable combobox scroll hijacking, and only show one event by default (rather than all)

This commit is contained in:
Marcus Huderle
2018-07-11 13:18:50 -05:00
parent 8930b2c01b
commit dc6b82b4dc
11 changed files with 158 additions and 64 deletions

15
noscrollcombobox.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include "noscrollcombobox.h"
NoScrollComboBox::NoScrollComboBox(QWidget *parent)
: QComboBox(parent)
{
// Don't let scrolling hijack focus.
setFocusPolicy(Qt::StrongFocus);
}
void NoScrollComboBox::wheelEvent(QWheelEvent *event)
{
// Only allow scrolling to modify contents when it explicitly has focus.
if (hasFocus())
QComboBox::wheelEvent(event);
}