-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1811 from akapar2016/UI_scrollWheelEvents
Ui scroll wheel events
- Loading branch information
Showing
12 changed files
with
149 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "comboBox-ignorewheel.hpp" | ||
|
||
ComboBoxIgnoreScroll::ComboBoxIgnoreScroll(QWidget *parent) : QComboBox(parent) | ||
{ | ||
setFocusPolicy(Qt::StrongFocus); | ||
} | ||
|
||
void ComboBoxIgnoreScroll::wheelEvent(QWheelEvent * event) | ||
{ | ||
if (!hasFocus()) | ||
event->ignore(); | ||
else | ||
QComboBox::wheelEvent(event); | ||
} | ||
|
||
void ComboBoxIgnoreScroll::leaveEvent(QEvent * event) | ||
{ | ||
clearFocus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <QComboBox> | ||
#include <QInputEvent> | ||
#include <QtCore/QObject> | ||
|
||
|
||
class ComboBoxIgnoreScroll : public QComboBox { | ||
Q_OBJECT | ||
|
||
public: | ||
ComboBoxIgnoreScroll(QWidget *parent = nullptr); | ||
|
||
protected: | ||
|
||
virtual void wheelEvent(QWheelEvent *event) override; | ||
virtual void leaveEvent(QEvent *event) override; | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "slider-ignorewheel.hpp" | ||
|
||
SliderIgnoreScroll::SliderIgnoreScroll(QWidget *parent) : QSlider(parent) | ||
{ | ||
setFocusPolicy(Qt::StrongFocus); | ||
} | ||
|
||
void SliderIgnoreScroll::wheelEvent(QWheelEvent * event) | ||
{ | ||
if (!hasFocus()) | ||
event->ignore(); | ||
else | ||
QSlider::wheelEvent(event); | ||
} | ||
|
||
void SliderIgnoreScroll::leaveEvent(QEvent * event) | ||
{ | ||
clearFocus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <QSlider> | ||
#include <QInputEvent> | ||
#include <QtCore/QObject> | ||
|
||
|
||
class SliderIgnoreScroll : public QSlider { | ||
Q_OBJECT | ||
|
||
public: | ||
SliderIgnoreScroll(QWidget *parent = nullptr); | ||
|
||
protected: | ||
|
||
virtual void wheelEvent(QWheelEvent *event) override; | ||
virtual void leaveEvent(QEvent *event) override; | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include "spinBox-ignorewheel.hpp" | ||
|
||
SpinBoxIgnoreScroll::SpinBoxIgnoreScroll(QWidget *parent) : QSpinBox(parent) | ||
{ | ||
setFocusPolicy(Qt::StrongFocus); | ||
} | ||
|
||
void SpinBoxIgnoreScroll::wheelEvent(QWheelEvent * event) | ||
{ | ||
if (!hasFocus()) | ||
event->ignore(); | ||
else | ||
QSpinBox::wheelEvent(event); | ||
} | ||
|
||
void SpinBoxIgnoreScroll::leaveEvent(QEvent * event) | ||
{ | ||
clearFocus(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include <QSpinBox> | ||
#include <QInputEvent> | ||
#include <QtCore/QObject> | ||
|
||
|
||
class SpinBoxIgnoreScroll : public QSpinBox { | ||
Q_OBJECT | ||
|
||
public: | ||
SpinBoxIgnoreScroll(QWidget *parent = nullptr); | ||
|
||
protected: | ||
|
||
virtual void wheelEvent(QWheelEvent *event) override; | ||
virtual void leaveEvent(QEvent *event) override; | ||
}; | ||
|
||
|