QWheelEvent: Make NoScrollPhase public
This reverts d5fde51410
and makes
that enum value the default for QWheelEvent::phase() with non
phase-aware mice.
[ChangeLog][QtGui] QWheelEvent::phase() returns NoScrollPhase with
non phase-aware mice. This is most mice and input devices except,
for now, Apple's trackpads and Magic Mouse.
Change-Id: I929fb39889cf116e89dcd134c1b1ec6587b8f05e
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This commit is contained in:
parent
0fed37e2cf
commit
96740193e1
@ -1635,7 +1635,7 @@ public:
|
||||
};
|
||||
|
||||
enum ScrollPhase {
|
||||
NoScrollPhase = 0, // Make public in 5.7 or asap
|
||||
NoScrollPhase = 0,
|
||||
ScrollBegin,
|
||||
ScrollUpdate,
|
||||
ScrollEnd
|
||||
|
@ -3089,7 +3089,8 @@
|
||||
|
||||
This enum describes the phase of scrolling.
|
||||
|
||||
\omitvalue NoScrollPhase The input device doesn't support scroll phase.
|
||||
\value NoScrollPhase The input device doesn't support scroll phase.
|
||||
This value was introduced in Qt 5.7.
|
||||
|
||||
\value ScrollBegin Scrolling is about to begin, but the scrolling
|
||||
distance did not yet change.
|
||||
|
@ -761,8 +761,6 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
|
||||
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
|
||||
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
|
||||
{
|
||||
if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
|
||||
ph = Qt::ScrollUpdate;
|
||||
g = QCursor::pos();
|
||||
if (orient == Qt::Vertical)
|
||||
angleD = QPoint(0, delta);
|
||||
@ -798,8 +796,6 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
|
||||
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
|
||||
ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
|
||||
{
|
||||
if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
|
||||
ph = Qt::ScrollUpdate;
|
||||
if (orient == Qt::Vertical)
|
||||
angleD = QPoint(0, delta);
|
||||
else
|
||||
@ -836,10 +832,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
|
||||
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
|
||||
angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(Qt::NoScrollPhase),
|
||||
src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
|
||||
{
|
||||
if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
|
||||
ph = Qt::ScrollUpdate;
|
||||
}
|
||||
{}
|
||||
|
||||
/*!
|
||||
Constructs a wheel event object.
|
||||
|
@ -199,9 +199,6 @@ bool QGuiApplicationPrivate::obey_desktop_settings = true;
|
||||
|
||||
QInputDeviceManager *QGuiApplicationPrivate::m_inputDeviceManager = 0;
|
||||
|
||||
// enable the fix for QTBUG-50199; TODO remove this check in 5.7
|
||||
bool QGuiApplicationPrivate::scrollNoPhaseAllowed = false;
|
||||
|
||||
static qreal fontSmoothingGamma = 1.7;
|
||||
|
||||
extern void qRegisterGuiVariant();
|
||||
@ -1458,8 +1455,6 @@ void QGuiApplicationPrivate::init()
|
||||
|
||||
if (layout_direction == Qt::LayoutDirectionAuto || force_reverse)
|
||||
QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight);
|
||||
|
||||
scrollNoPhaseAllowed = qEnvironmentVariableIsSet("QT_ENABLE_MOUSE_WHEEL_TRACKING");
|
||||
}
|
||||
|
||||
extern void qt_cleanupFontDatabase();
|
||||
|
@ -302,9 +302,6 @@ public:
|
||||
|
||||
static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false);
|
||||
|
||||
// enable the fix for QTBUG-50199; TODO remove this check in 5.7
|
||||
static bool scrollNoPhaseAllowed;
|
||||
|
||||
protected:
|
||||
virtual void notifyThemeChanged();
|
||||
bool tryCloseRemainingWindows(QWindowList processedWindows);
|
||||
|
@ -318,9 +318,6 @@ void QWindowSystemInterface::handleWheelEvent(QWindow *w, const QPointF & local,
|
||||
void QWindowSystemInterface::handleWheelEvent(QWindow *tlw, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase,
|
||||
Qt::MouseEventSource source, bool invertedScrolling)
|
||||
{
|
||||
if (!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase)
|
||||
phase = Qt::ScrollUpdate;
|
||||
|
||||
// Qt 4 sends two separate wheel events for horizontal and vertical
|
||||
// deltas. For Qt 5 we want to send the deltas in one event, but at the
|
||||
// same time preserve source and behavior compatibility with Qt 4.
|
||||
@ -944,9 +941,7 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
|
||||
QWindowSystemInterfacePrivate::WheelEvent::WheelEvent(QWindow *w, ulong time, const QPointF &local, const QPointF &global, QPoint pixelD,
|
||||
QPoint angleD, int qt4D, Qt::Orientation qt4O, Qt::KeyboardModifiers mods, Qt::ScrollPhase phase, Qt::MouseEventSource src, bool inverted)
|
||||
: InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D),
|
||||
qt4Orientation(qt4O), localPos(local), globalPos(global),
|
||||
phase(!QGuiApplicationPrivate::scrollNoPhaseAllowed && phase == Qt::NoScrollPhase ? Qt::ScrollUpdate : phase),
|
||||
source(src), inverted(inverted)
|
||||
qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src), inverted(inverted)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1414,8 +1414,6 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
m_scrolling = false;
|
||||
} else if (phase == NSEventPhaseNone && momentumPhase == NSEventPhaseNone) {
|
||||
ph = Qt::NoScrollPhase;
|
||||
if (!QGuiApplicationPrivate::scrollNoPhaseAllowed)
|
||||
ph = Qt::ScrollUpdate;
|
||||
}
|
||||
// "isInverted": natural OS X scrolling, inverted from the Qt/other platform/Jens perspective.
|
||||
bool isInverted = [theEvent isDirectionInvertedFromDevice];
|
||||
|
@ -3370,7 +3370,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
|
||||
// A new scrolling sequence or partial sequence starts and w has accepted
|
||||
// the event. Therefore, we can set wheel_widget, but only if it's not
|
||||
// the end of a sequence.
|
||||
if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate) && QGuiApplicationPrivate::scrollNoPhaseAllowed)
|
||||
if (spontaneous && (phase == Qt::ScrollBegin || phase == Qt::ScrollUpdate))
|
||||
QApplicationPrivate::wheel_widget = w;
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user