From 4df6e058490b4202a5bb5ac0a34b7b2b18493250 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Wed, 22 Feb 2012 11:41:28 -0800 Subject: Clean up some Q_WS_WIN Q_WS_WIN does not exist any more. Change-Id: Icb7f542cfcd4d21e994f246ff665583cb6b57610 Reviewed-by: Oswald Buddenhagen Reviewed-by: Friedemann Kleint --- doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp b/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp index 9fa9a23234..9de685a7b5 100644 --- a/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp +++ b/doc/src/snippets/code/src_corelib_plugin_qlibrary.cpp @@ -76,7 +76,7 @@ extern "C" MY_EXPORT int avg(int a, int b) //! [4] -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN #define MY_EXPORT __declspec(dllexport) #else #define MY_EXPORT -- cgit v1.2.3 From 5a2efb490bc3549ef42420a0dafcf22072785e0d Mon Sep 17 00:00:00 2001 From: Morten Johan Sorvig Date: Mon, 9 Jan 2012 11:25:40 +0100 Subject: QWheelEvent high-resolution delta support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support pixel-based deltas as well as sending dx and dy values in the same event. Keep source and behavior compatibility with Qt 4. New API: QPoint pixelDelta() const QPoint angleDelta() const Deprecate delta() and orientation(). Both pixel-based deltas and combined updates are necessary for smooth trackpad-based scrolling on OS X. Qt 4 compatible behavior is achieved by sending an extra wheel event in cases where the initial event has a combined dx and dy update. This extra event sends dx in delta() and orientation(), with pixelDelta() and angleDelta() set to null. Modify the Cocoa implementation to provide pixel deltas. It is expected that not all platforms can provide these. Angle deltas will always be available. Change-Id: I20c10f0df338ddcd6a3f7a4d40949ed5ae3b4795 Reviewed-by: Morten Johan Sørvig --- doc/src/snippets/code/src_gui_kernel_qevent.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'doc') diff --git a/doc/src/snippets/code/src_gui_kernel_qevent.cpp b/doc/src/snippets/code/src_gui_kernel_qevent.cpp index 35c53337f4..d8bdeebe84 100644 --- a/doc/src/snippets/code/src_gui_kernel_qevent.cpp +++ b/doc/src/snippets/code/src_gui_kernel_qevent.cpp @@ -41,14 +41,16 @@ //! [0] void MyWidget::wheelEvent(QWheelEvent *event) { - int numDegrees = event->delta() / 8; - int numSteps = numDegrees / 15; + QPoint numPixels = envent->pixelDelta(); + QPoint numDegrees = envent->angleDelta() / 8; - if (event->orientation() == Qt::Horizontal) { - scrollHorizontally(numSteps); - } else { - scrollVertically(numSteps); + if (!numPixels.isNull()) { + scrollWithPixels(numpixels); + } else if (!numDegrees.isNull()) { + QPoint numSteps = numDegrees / 15; + scrollWithDegrees(numSteps); } + event->accept(); } //! [0] -- cgit v1.2.3