From 038893af4241add08cbcf4ee9973b17209bc2272 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 3 Feb 2010 17:32:15 +0100 Subject: Doc: Fixed typo. Reviewed-by: Trust Me --- src/xml/dom/qdom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index cae959b..8d9ae4f 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -2973,7 +2973,7 @@ QDomElement QDomNode::lastChildElement(const QString &tagName) const } /*! - Returns the next sibilng element with tag name \a tagName if \a tagName + Returns the next sibling element with tag name \a tagName if \a tagName is non-empty; otherwise returns any next sibling element. Returns a null element if no such sibling exists. -- cgit v0.12 From fcb431bfe807997b475b8b315e07fc7bd898ef61 Mon Sep 17 00:00:00 2001 From: Iain Date: Fri, 5 Feb 2010 10:04:11 +0000 Subject: Iain's changes for 4.6.2 --- dist/changes-4.6.2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dist/changes-4.6.2 b/dist/changes-4.6.2 index aa8d40b..5e0be9a 100644 --- a/dist/changes-4.6.2 +++ b/dist/changes-4.6.2 @@ -227,6 +227,14 @@ Qt for Windows CE Qt for Symbian -------------- + * [QTBUG-6556] Improve the DEF file handling scheme, to allow simple enable/ + disable of DEF file usage (for use _during development only_ to decouple + the need to update the DEF files at the precise point that symbols are + removed, therefore allowing builds by CI systems to succeed even if symbols + have been removed. This does not remove the need to update the DEF files + before release. NOTE: Builds generated using this flag are not binary + compatible with previous versions of Qt.) + - QProcess * [QTBUG-7667] Fixed no-timeout case for QProcess::waitForFinished. -- cgit v0.12 From 906f77bcfd4358f35155075b6d5fd8a383adadba Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Fri, 5 Feb 2010 13:13:49 +0100 Subject: A fix for accidently reused variable names in nested iterations. Reviewed-by: Peter Hartmann --- src/corelib/codecs/qtextcodec.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 698ca9e..b63a82e 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -958,8 +958,8 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) if (nameMatch(cursor->name(), name)) return cursor; QList aliases = cursor->aliases(); - for (int i = 0; i < aliases.size(); ++i) - if (nameMatch(aliases.at(i), name)) + for (int y = 0; y < aliases.size(); ++y) + if (nameMatch(aliases.at(y), name)) return cursor; } -- cgit v0.12 From 440aa04f0dec0eb9742a774723e1d27e42078c9c Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 Feb 2010 15:58:26 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( da5d96a26e80162027bc95ce7e5725fe4b277ff7 ) Changes in WebKit/qt since the last update: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 38 ++++++++++++++++++++++ .../webkit/WebCore/platform/qt/RenderThemeQt.cpp | 29 +++++++++-------- .../webkit/WebCore/platform/qt/RenderThemeQt.h | 10 +++--- .../WebCore/platform/qt/ScrollbarThemeQt.cpp | 22 ++++++++----- .../webkit/WebCore/platform/qt/ScrollbarThemeQt.h | 8 +++++ 6 files changed, 81 insertions(+), 28 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index c304876..4348cbc 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 69dd29fbeb12d076741dce70ac6bc155101ccd6f + da5d96a26e80162027bc95ce7e5725fe4b277ff7 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 18d119a..1f6f290 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -2,6 +2,44 @@ Reviewed by Kenneth Rohde Christiansen. + [Qt] In the StyledPainter determine the style from the Render and Scrollbar theme instead of from the paint device + https://bugs.webkit.org/show_bug.cgi?id=34054 + + Getting the style from the painter's paint device is a hack that breaks when + the paint device's style is different than the style that is used when + calculating the metries earlier when there is no painter available. + + This change moves us closer to always using the same style. + + * platform/qt/RenderThemeQt.cpp: + (WebCore::StylePainter::StylePainter): + (WebCore::StylePainter::init): + (WebCore::RenderThemeQt::paintButton): + (WebCore::RenderThemeQt::paintTextField): + (WebCore::RenderThemeQt::paintMenuList): + (WebCore::RenderThemeQt::paintMenuListButton): + (WebCore::RenderThemeQt::paintSliderTrack): + (WebCore::RenderThemeQt::paintMediaMuteButton): + (WebCore::RenderThemeQt::paintMediaPlayButton): + (WebCore::RenderThemeQt::paintMediaSliderTrack): + (WebCore::RenderThemeQt::paintMediaSliderThumb): + * platform/qt/RenderThemeQt.h: + * platform/qt/ScrollbarThemeQt.cpp: + (WebCore::ScrollbarThemeQt::paint): + (WebCore::ScrollbarThemeQt::hitTest): + (WebCore::ScrollbarThemeQt::shouldCenterOnThumb): + (WebCore::ScrollbarThemeQt::scrollbarThickness): + (WebCore::ScrollbarThemeQt::thumbLength): + (WebCore::ScrollbarThemeQt::trackPosition): + (WebCore::ScrollbarThemeQt::trackLength): + (WebCore::ScrollbarThemeQt::paintScrollCorner): + (WebCore::ScrollbarThemeQt::style): + * platform/qt/ScrollbarThemeQt.h: + +2010-01-25 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + [Qt] Use the fallback style on Maemo 5 https://bugs.webkit.org/show_bug.cgi?id=34376 diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp index 6a1eee8..37a6408 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.cpp @@ -44,6 +44,7 @@ #include "Page.h" #include "RenderBox.h" #include "RenderTheme.h" +#include "ScrollbarThemeQt.h" #include "UserAgentStyleSheets.h" #include "QWebPageClient.h" #include "qwebpage.h" @@ -66,17 +67,17 @@ namespace WebCore { using namespace HTMLNames; -StylePainter::StylePainter(const RenderObject::PaintInfo& paintInfo) +StylePainter::StylePainter(RenderThemeQt* theme, const RenderObject::PaintInfo& paintInfo) { - init(paintInfo.context ? paintInfo.context : 0); + init(paintInfo.context ? paintInfo.context : 0, theme->qStyle()); } -StylePainter::StylePainter(GraphicsContext* context) +StylePainter::StylePainter(ScrollbarThemeQt* theme, GraphicsContext* context) { - init(context); + init(context, theme->style()); } -void StylePainter::init(GraphicsContext* context) +void StylePainter::init(GraphicsContext* context, QStyle* themeStyle) { painter = static_cast(context->platformContext()); widget = 0; @@ -85,7 +86,7 @@ void StylePainter::init(GraphicsContext* context) dev = painter->device(); if (dev && dev->devType() == QInternal::Widget) widget = static_cast(dev); - style = (widget ? widget->style() : QApplication::style()); + style = themeStyle; if (painter) { // the styles often assume being called with a pristine painter where no brush is set, @@ -464,7 +465,7 @@ void RenderThemeQt::setButtonPadding(RenderStyle* style) const bool RenderThemeQt::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -497,7 +498,7 @@ void RenderThemeQt::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, bool RenderThemeQt::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -566,7 +567,7 @@ void RenderThemeQt::setPopupPadding(RenderStyle* style) const bool RenderThemeQt::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -606,7 +607,7 @@ void RenderThemeQt::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* st bool RenderThemeQt::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) { - StylePainter p(i); + StylePainter p(this, i); if (!p.isValid()) return true; @@ -837,7 +838,7 @@ bool RenderThemeQt::paintMediaMuteButton(RenderObject* o, const RenderObject::Pa if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -866,7 +867,7 @@ bool RenderThemeQt::paintMediaPlayButton(RenderObject* o, const RenderObject::Pa if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -905,7 +906,7 @@ bool RenderThemeQt::paintMediaSliderTrack(RenderObject* o, const RenderObject::P if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; @@ -932,7 +933,7 @@ bool RenderThemeQt::paintMediaSliderThumb(RenderObject* o, const RenderObject::P if (!mediaElement) return false; - StylePainter p(paintInfo); + StylePainter p(this, paintInfo); if (!p.isValid()) return true; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h index 19337ac..13fb42f 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/RenderThemeQt.h @@ -35,6 +35,7 @@ namespace WebCore { class RenderStyle; class HTMLMediaElement; +class ScrollbarThemeQt; class RenderThemeQt : public RenderTheme { private: @@ -75,6 +76,8 @@ public: virtual String extraMediaControlsStyleSheet(); #endif + QStyle* qStyle() const; + protected: virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r); virtual void setCheckboxSize(RenderStyle*) const; @@ -137,7 +140,6 @@ private: void setButtonPadding(RenderStyle*) const; void setPopupPadding(RenderStyle*) const; - QStyle* qStyle() const; QStyle* fallbackStyle() const; Page* m_page; @@ -152,8 +154,8 @@ private: class StylePainter { public: - explicit StylePainter(const RenderObject::PaintInfo& paintInfo); - explicit StylePainter(GraphicsContext* context); + explicit StylePainter(RenderThemeQt*, const RenderObject::PaintInfo&); + explicit StylePainter(ScrollbarThemeQt*, GraphicsContext*); ~StylePainter(); bool isValid() const { return painter && style; } @@ -170,7 +172,7 @@ public: { style->drawComplexControl(cc, &opt, painter, widget); } private: - void init(GraphicsContext* context); + void init(GraphicsContext* context, QStyle*); QBrush oldBrush; bool oldAntialiasing; diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp index 561e55f..c0692ca 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.cpp @@ -140,7 +140,7 @@ bool ScrollbarThemeQt::paint(Scrollbar* scrollbar, GraphicsContext* graphicsCont return false; } - StylePainter p(graphicsContext); + StylePainter p(this, graphicsContext); if (!p.isValid()) return true; @@ -172,14 +172,14 @@ ScrollbarPart ScrollbarThemeQt::hitTest(Scrollbar* scrollbar, const PlatformMous QStyleOptionSlider* opt = styleOptionSlider(scrollbar); const QPoint pos = scrollbar->convertFromContainingWindow(evt.pos()); opt->rect.moveTo(QPoint(0, 0)); - QStyle::SubControl sc = QApplication::style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0); + QStyle::SubControl sc = style()->hitTestComplexControl(QStyle::CC_ScrollBar, opt, pos, 0); return scrollbarPart(sc); } bool ScrollbarThemeQt::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt) { // Middle click centers slider thumb (if supported) - return QApplication::style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton; + return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton; } void ScrollbarThemeQt::invalidatePart(Scrollbar* scrollbar, ScrollbarPart) @@ -190,13 +190,12 @@ void ScrollbarThemeQt::invalidatePart(Scrollbar* scrollbar, ScrollbarPart) int ScrollbarThemeQt::scrollbarThickness(ScrollbarControlSize controlSize) { - QStyle* s = QApplication::style(); QStyleOptionSlider o; o.orientation = Qt::Vertical; o.state &= ~QStyle::State_Horizontal; if (controlSize != RegularScrollbar) o.state |= QStyle::State_Mini; - return s->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0); + return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &o, 0); } int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar) @@ -209,21 +208,21 @@ int ScrollbarThemeQt::thumbPosition(Scrollbar* scrollbar) int ScrollbarThemeQt::thumbLength(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect thumb = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0); + IntRect thumb = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarSlider, 0); return scrollbar->orientation() == HorizontalScrollbar ? thumb.width() : thumb.height(); } int ScrollbarThemeQt::trackPosition(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); + IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); return scrollbar->orientation() == HorizontalScrollbar ? track.x() - scrollbar->x() : track.y() - scrollbar->y(); } int ScrollbarThemeQt::trackLength(Scrollbar* scrollbar) { QStyleOptionSlider* opt = styleOptionSlider(scrollbar); - IntRect track = QApplication::style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); + IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height(); } @@ -237,7 +236,7 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext #if QT_VERSION < 0x040500 context->fillRect(rect, QApplication::palette().color(QPalette::Normal, QPalette::Window)); #else - StylePainter p(context); + StylePainter p(this, context); if (!p.isValid()) return; @@ -247,5 +246,10 @@ void ScrollbarThemeQt::paintScrollCorner(ScrollView* scrollView, GraphicsContext #endif } +QStyle* ScrollbarThemeQt::style() const +{ + return QApplication::style(); +} + } diff --git a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h index 6ca44ea..cf4882d 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h +++ b/src/3rdparty/webkit/WebCore/platform/qt/ScrollbarThemeQt.h @@ -28,6 +28,12 @@ #include "ScrollbarTheme.h" +#include + +QT_BEGIN_NAMESPACE +class QStyle; +QT_END_NAMESPACE + namespace WebCore { class ScrollbarThemeQt : public ScrollbarTheme { @@ -49,6 +55,8 @@ public: virtual int trackLength(Scrollbar*); virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); + + QStyle* style() const; }; } -- cgit v0.12 From ced7ed0bc745618e1b0618a17b112f983dd4a9c6 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 5 Feb 2010 16:01:29 +0100 Subject: Doc: Clarified ownership of custom buttons added to a QDialogButtonBox. Reviewed-by: Trust Me Suggested-by: Robert Griebl --- src/gui/widgets/qdialogbuttonbox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 48d7022..6a0e363 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -1017,6 +1017,8 @@ void QDialogButtonBox::removeButton(QAbstractButton *button) If the button has already been added, it is removed and added again with the new role. + \note The button box takes ownership of the button. + \sa removeButton(), clear() */ void QDialogButtonBox::addButton(QAbstractButton *button, ButtonRole role) -- cgit v0.12 From e855b199319c932f2e9500235775f961bc32e41a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Tue, 2 Feb 2010 16:12:34 +0100 Subject: Fixes scrolling horizontally with a mouse wheel over sliders. When scrolling horizontally over sliders the slider should go to the right, which means the value of the slider should increase. However in Qt scrolling with a mouse wheel horizontally means the delta value is negative, which is wrong. So changed the delta to be inversed. Reviewed-by: Richard Moe Gustavsen --- src/gui/widgets/qabstractslider.cpp | 67 ++++++++++++++++++++++--------------- src/gui/widgets/qabstractslider_p.h | 1 + src/gui/widgets/qscrollbar.cpp | 16 +++++++++ 3 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 2874647..f119a4f 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -688,51 +688,64 @@ void QAbstractSlider::sliderChange(SliderChange) update(); } - -/*! - \reimp -*/ -#ifndef QT_NO_WHEELEVENT -void QAbstractSlider::wheelEvent(QWheelEvent * e) +bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::KeyboardModifiers modifiers, int delta) { - Q_D(QAbstractSlider); - e->ignore(); - + Q_Q(QAbstractSlider); int stepsToScroll = 0; - qreal offset = qreal(e->delta()) / 120; + // in Qt scrolling to the right gives negative values. + if (orientation == Qt::Horizontal) + delta = -delta; + qreal offset = qreal(delta) / 120; - if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier)) { + if ((modifiers & Qt::ControlModifier) || (modifiers & Qt::ShiftModifier)) { // Scroll one page regardless of delta: - stepsToScroll = qBound(-d->pageStep, int(offset * d->pageStep), d->pageStep); - d->offset_accumulated = 0; + stepsToScroll = qBound(-pageStep, int(offset * pageStep), pageStep); + offset_accumulated = 0; } else { // 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() * d->effectiveSingleStep(); + qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * effectiveSingleStep(); // Check if wheel changed direction since last event: - if (d->offset_accumulated != 0 && (offset / d->offset_accumulated) < 0) - d->offset_accumulated = 0; + if (offset_accumulated != 0 && (offset / offset_accumulated) < 0) + offset_accumulated = 0; - d->offset_accumulated += stepsToScrollF; - stepsToScroll = qBound(-d->pageStep, int(d->offset_accumulated), d->pageStep); - d->offset_accumulated -= int(d->offset_accumulated); + offset_accumulated += stepsToScrollF; + stepsToScroll = qBound(-pageStep, int(offset_accumulated), pageStep); + offset_accumulated -= int(offset_accumulated); if (stepsToScroll == 0) - return; + return false; } - if (d->invertedControls) + if (invertedControls) stepsToScroll = -stepsToScroll; - int prevValue = d->value; - d->position = d->overflowSafeAdd(stepsToScroll); // value will be updated by triggerAction() - triggerAction(SliderMove); + int prevValue = value; + position = overflowSafeAdd(stepsToScroll); // value will be updated by triggerAction() + q->triggerAction(QAbstractSlider::SliderMove); - if (prevValue == d->value) - d->offset_accumulated = 0; - else + if (prevValue == value) { + offset_accumulated = 0; + return false; + } + return true; +} + +/*! + \reimp +*/ +#ifndef QT_NO_WHEELEVENT +void QAbstractSlider::wheelEvent(QWheelEvent * e) +{ + Q_D(QAbstractSlider); + e->ignore(); + if (e->orientation() != d->orientation && !rect().contains(e->pos())) + return; + int delta = e->delta(); + if (d->scrollByDelta(e->orientation(), e->modifiers(), delta)) e->accept(); } + #endif #ifdef QT_KEYPAD_NAVIGATION /*! diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index 6cde468..6e6ff6e 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -138,6 +138,7 @@ public: } q->triggerAction(repeatAction); } + bool scrollByDelta(Qt::Orientation orientation, Qt::KeyboardModifiers modifiers, int delta); }; QT_END_NAMESPACE diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 73ce122..3eed3a9 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -521,6 +521,22 @@ bool QScrollBar::event(QEvent *event) if (const QHoverEvent *he = static_cast(event)) d_func()->updateHoverControl(he->pos()); break; + case QEvent::Wheel: { + // override wheel event without adding virtual function override + QWheelEvent *ev = static_cast(event); + int delta = ev->delta(); + // scrollbar is a special case - in vertical mode it reaches minimum + // value in the upper position, however QSlider's minimum value is on + // the bottom. So we need to invert a value, but since the scrollbar is + // inverted by default, we need to inverse the delta value for the + // horizontal orientation. + if (ev->orientation() == Qt::Horizontal) + delta = -delta; + Q_D(QScrollBar); + if (d->scrollByDelta(ev->orientation(), ev->modifiers(), delta)) + event->accept(); + return true; + } default: break; } -- cgit v0.12