Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_gui_kernel_qevent.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QWheelEvent>
4
6class MyWidget //: public QWidget
7{
8 void wheelEvent(QWheelEvent *event);
9 void scrollWithPixels(QPoint point);
10 void scrollWithDegrees(QPoint point);
11};
12
13
15void MyWidget::wheelEvent(QWheelEvent *event)
16{
17 QPoint numPixels = event->pixelDelta();
18 QPoint numDegrees = event->angleDelta() / 8;
19
20 if (!numPixels.isNull()) {
21 scrollWithPixels(numPixels);
22 } else if (!numDegrees.isNull()) {
23 QPoint numSteps = numDegrees / 15;
24 scrollWithDegrees(numSteps);
25 }
26
27 event->accept();
28}
30
31
32} // src_gui_kernel_qevent
\inmodule QtCore\reentrant
Definition qpoint.h:25
struct _cl_event * event