From 5ab191af20bf2b1fed2b8886ac247c2953087c14 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 9 Feb 2010 12:33:52 +0100 Subject: Fixed compilation with QT_NO_WHEELEVENT Reviewed-by: Prasanth --- src/gui/kernel/qapplication_mac.mm | 6 ++++++ src/gui/kernel/qapplication_p.h | 2 ++ src/gui/kernel/qapplication_x11.cpp | 8 ++++++++ src/gui/kernel/qcocoaview_mac.mm | 3 +++ src/gui/util/qsystemtrayicon_p.h | 2 ++ src/gui/util/qsystemtrayicon_x11.cpp | 2 ++ src/gui/widgets/qabstractslider.cpp | 6 +++++- src/gui/widgets/qabstractspinbox.h | 2 ++ src/gui/widgets/qcombobox.h | 2 ++ src/gui/widgets/qmenu.h | 2 ++ src/gui/widgets/qscrollbar.cpp | 2 ++ 11 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index e8b821af..54a4901 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -2143,6 +2143,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event } if (wheel_deltaX || wheel_deltaY) { +#ifndef QT_NO_WHEELEVENT if (wheel_deltaX) { QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal); QApplication::sendSpontaneousEvent(widget, &qwe); @@ -2165,6 +2166,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event handled_event = false; } } +#endif // QT_NO_WHEELEVENT } else { #ifdef QMAC_SPEAK_TO_ME const int speak_keys = Qt::AltModifier | Qt::ShiftModifier; @@ -2717,6 +2719,7 @@ int QApplication::keyboardInputInterval() return QApplicationPrivate::keyboard_input_time; } +#ifndef QT_NO_WHEELEVENT void QApplication::setWheelScrollLines(int n) { QApplicationPrivate::wheel_scroll_lines = n; @@ -2726,6 +2729,7 @@ int QApplication::wheelScrollLines() { return QApplicationPrivate::wheel_scroll_lines; } +#endif void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) { @@ -2888,9 +2892,11 @@ bool QApplicationPrivate::qt_mac_apply_settings() QApplication::cursorFlashTime()).toInt(); QApplication::setCursorFlashTime(num); +#ifndef QT_NO_WHEELEVENT num = settings.value(QLatin1String("wheelScrollLines"), QApplication::wheelScrollLines()).toInt(); QApplication::setWheelScrollLines(num); +#endif QString colorspec = settings.value(QLatin1String("colorSpec"), QVariant(QLatin1String("default"))).toString(); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 9c001ab..b3ec732 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -427,7 +427,9 @@ public: static int cursor_flash_time; static int mouse_double_click_time; static int keyboard_input_time; +#ifndef QT_NO_WHEELEVENT static int wheel_scroll_lines; +#endif static bool animate_ui; static bool animate_menu; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 2a1f655..afd927b 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -944,10 +944,12 @@ bool QApplicationPrivate::x11_apply_settings() QApplication::cursorFlashTime()).toInt(); QApplication::setCursorFlashTime(num); +#ifndef QT_NO_WHEELEVENT num = settings.value(QLatin1String("wheelScrollLines"), QApplication::wheelScrollLines()).toInt(); QApplication::setWheelScrollLines(num); +#endif QString colorspec = settings.value(QLatin1String("colorSpec"), QVariant(QLatin1String("default"))).toString(); @@ -4401,8 +4403,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta, QWidget* popup = qApp->activePopupWidget(); if (popup && window() != popup) popup->close(); +#ifndef QT_NO_WHEELEVENT QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); if (QApplication::sendSpontaneousEvent(widget, &e)) +#endif return true; } @@ -4413,8 +4417,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta, QWidget* popup = qApp->activePopupWidget(); if (popup && widget != popup) popup->hide(); +#ifndef QT_NO_WHEELEVENT QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient); if (QApplication::sendSpontaneousEvent(widget, &e)) +#endif return true; } return false; @@ -5313,6 +5319,7 @@ int QApplication::keyboardInputInterval() return QApplicationPrivate::keyboard_input_time; } +#ifndef QT_NO_WHEELEVENT void QApplication::setWheelScrollLines(int n) { QApplicationPrivate::wheel_scroll_lines = n; @@ -5322,6 +5329,7 @@ int QApplication::wheelScrollLines() { return QApplicationPrivate::wheel_scroll_lines; } +#endif void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable) { diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 756cf92..ad64a91 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -828,6 +828,7 @@ extern "C" { deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120); } +#ifndef QT_NO_WHEELEVENT if (deltaX != 0) { QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal); qt_sendSpontaneousEvent(widgetToGetMouse, &qwe); @@ -868,6 +869,8 @@ extern "C" { wheelOK = qwe2.isAccepted(); } } +#endif //QT_NO_WHEELEVENT + if (!wheelOK) { return [super scrollWheel:theEvent]; } diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h index b881f68..e8bf197 100644 --- a/src/gui/util/qsystemtrayicon_p.h +++ b/src/gui/util/qsystemtrayicon_p.h @@ -164,7 +164,9 @@ protected: bool x11Event(XEvent *event); void mousePressEvent(QMouseEvent *event); void mouseDoubleClickEvent(QMouseEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif bool event(QEvent *e); private: diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/gui/util/qsystemtrayicon_x11.cpp index a645050..82b4325 100644 --- a/src/gui/util/qsystemtrayicon_x11.cpp +++ b/src/gui/util/qsystemtrayicon_x11.cpp @@ -308,10 +308,12 @@ void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev) emit q->activated(QSystemTrayIcon::DoubleClick); } +#ifndef QT_NO_WHEELEVENT void QSystemTrayIconSys::wheelEvent(QWheelEvent *e) { QApplication::sendEvent(q, e); } +#endif bool QSystemTrayIconSys::event(QEvent *e) { diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 73c17db..4bd7b5a 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -705,7 +705,11 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb // Calculate how many lines to scroll. Depending on what delta is (and // offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can // only scroll whole lines, so we keep the reminder until next event. - qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * effectiveSingleStep(); + qreal stepsToScrollF = +#ifndef QT_NO_WHEELEVENT + QApplication::wheelScrollLines() * +#endif + offset * effectiveSingleStep(); // Check if wheel changed direction since last event: if (offset_accumulated != 0 && (offset / offset_accumulated) < 0) offset_accumulated = 0; diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h index 059943a..6c062c0 100644 --- a/src/gui/widgets/qabstractspinbox.h +++ b/src/gui/widgets/qabstractspinbox.h @@ -137,7 +137,9 @@ protected: void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *event); +#endif void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); void contextMenuEvent(QContextMenuEvent *event); diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h index f332d31..9b19a66 100644 --- a/src/gui/widgets/qcombobox.h +++ b/src/gui/widgets/qcombobox.h @@ -245,7 +245,9 @@ protected: void mouseReleaseEvent(QMouseEvent *e); void keyPressEvent(QKeyEvent *e); void keyReleaseEvent(QKeyEvent *e); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *e); +#endif void contextMenuEvent(QContextMenuEvent *e); void inputMethodEvent(QInputMethodEvent *); QVariant inputMethodQuery(Qt::InputMethodQuery) const; diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h index 5a6a5c7..47dff2b 100644 --- a/src/gui/widgets/qmenu.h +++ b/src/gui/widgets/qmenu.h @@ -162,7 +162,9 @@ protected: void mouseReleaseEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); void mouseMoveEvent(QMouseEvent *); +#ifndef QT_NO_WHEELEVENT void wheelEvent(QWheelEvent *); +#endif void enterEvent(QEvent *); void leaveEvent(QEvent *); void hideEvent(QHideEvent *); diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 3eed3a9..4eff260 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -521,6 +521,7 @@ bool QScrollBar::event(QEvent *event) if (const QHoverEvent *he = static_cast(event)) d_func()->updateHoverControl(he->pos()); break; +#ifndef QT_NO_WHEELEVENT case QEvent::Wheel: { // override wheel event without adding virtual function override QWheelEvent *ev = static_cast(event); @@ -537,6 +538,7 @@ bool QScrollBar::event(QEvent *event) event->accept(); return true; } +#endif default: break; } -- cgit v0.12