mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
UI: Disable wheel scrolling on QComboBoxes
Adds a new ProxyStyle, OBSIgnoreWheelProxyStyle, and applies it to the entire program. This style sets a StyleHint to disable mouse wheel scrolling on QComboBoxes. The existing OBSProxyStyle, which is used only for the context bar, has been renamed accordingly.
This commit is contained in:
+17
-3
@@ -12,9 +12,10 @@ static inline uint qt_intensity(uint r, uint g, uint b)
|
||||
*
|
||||
* https://code.woboq.org/qt5/qtbase/src/widgets/styles/qcommonstyle.cpp.html#6429
|
||||
*/
|
||||
QPixmap OBSProxyStyle::generatedIconPixmap(QIcon::Mode iconMode,
|
||||
const QPixmap &pixmap,
|
||||
const QStyleOption *option) const
|
||||
QPixmap
|
||||
OBSContextBarProxyStyle::generatedIconPixmap(QIcon::Mode iconMode,
|
||||
const QPixmap &pixmap,
|
||||
const QStyleOption *option) const
|
||||
{
|
||||
if (iconMode == QIcon::Disabled) {
|
||||
QImage im =
|
||||
@@ -75,3 +76,16 @@ QPixmap OBSProxyStyle::generatedIconPixmap(QIcon::Mode iconMode,
|
||||
|
||||
return QProxyStyle::generatedIconPixmap(iconMode, pixmap, option);
|
||||
}
|
||||
|
||||
int OBSIgnoreWheelProxyStyle::styleHint(StyleHint hint,
|
||||
const QStyleOption *option,
|
||||
const QWidget *widget,
|
||||
QStyleHintReturn *returnData) const
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
if (hint == SH_ComboBox_AllowWheelScrolling)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user