summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qabstractscrollarea.cpp11
-rw-r--r--src/gui/widgets/qabstractslider.cpp73
-rw-r--r--src/gui/widgets/qabstractslider_p.h1
-rw-r--r--src/gui/widgets/qabstractspinbox.h2
-rw-r--r--src/gui/widgets/qcombobox.h2
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp2
-rw-r--r--src/gui/widgets/qlinecontrol.cpp7
-rw-r--r--src/gui/widgets/qlinecontrol_p.h5
-rw-r--r--src/gui/widgets/qmainwindow.cpp2
-rw-r--r--src/gui/widgets/qmainwindowlayout.cpp14
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm12
-rw-r--r--src/gui/widgets/qmenu.cpp7
-rw-r--r--src/gui/widgets/qmenu.h2
-rw-r--r--src/gui/widgets/qmenu_mac.mm36
-rw-r--r--src/gui/widgets/qmenu_p.h7
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp34
-rw-r--r--src/gui/widgets/qmenubar.cpp2
-rw-r--r--src/gui/widgets/qprintpreviewwidget.cpp6
-rw-r--r--src/gui/widgets/qscrollbar.cpp18
-rw-r--r--src/gui/widgets/qtoolbar.cpp3
20 files changed, 167 insertions, 79 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp
index 87f6c83..1d496d5 100644
--- a/src/gui/widgets/qabstractscrollarea.cpp
+++ b/src/gui/widgets/qabstractscrollarea.cpp
@@ -1134,13 +1134,10 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e)
void QAbstractScrollArea::wheelEvent(QWheelEvent *e)
{
Q_D(QAbstractScrollArea);
- QScrollBar *const bars[2] = { d->hbar, d->vbar };
- int idx = (e->orientation() == Qt::Vertical) ? 1 : 0;
- int other = (idx + 1) % 2;
- if (!bars[idx]->isVisible() && bars[other]->isVisible())
- idx = other; // If the scrollbar of the event orientation is hidden, fallback to the other.
-
- QApplication::sendEvent(bars[idx], e);
+ if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal)
+ QApplication::sendEvent(d->hbar, e);
+ else
+ QApplication::sendEvent(d->vbar, e);
}
#endif
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index 2874647..4bd7b5a 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -214,8 +214,8 @@ QT_BEGIN_NAMESPACE
*/
QAbstractSliderPrivate::QAbstractSliderPrivate()
- : minimum(0), maximum(99), singleStep(1), pageStep(10),
- value(0), position(0), pressValue(-1), offset_accumulated(0), tracking(true),
+ : minimum(0), maximum(99), pageStep(10), value(0), position(0), pressValue(-1),
+ singleStep(1), offset_accumulated(0), tracking(true),
blocktracking(false), pressed(false),
invertedAppearance(false), invertedControls(false),
orientation(Qt::Horizontal), repeatAction(QAbstractSlider::SliderNoAction)
@@ -688,51 +688,66 @@ 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 =
+#ifndef QT_NO_WHEELEVENT
+ QApplication::wheelScrollLines() *
+#endif
+ offset * 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();
+ 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/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/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)
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 414c2ed..db099e8 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -524,8 +524,11 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
m_textLayout.draw(painter, offset, selections, clip);
if (flags & DrawCursor){
+ int cursor = m_cursor;
+ if (m_preeditCursor != -1)
+ cursor += m_preeditCursor;
if(!m_blinkPeriod || m_blinkStatus)
- m_textLayout.drawCursor(painter, offset, m_cursor, m_cursorWidth);
+ m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth);
}
}
@@ -1368,6 +1371,8 @@ bool QLineControl::processEvent(QEvent* ev)
processInputMethodEvent(static_cast<QInputMethodEvent*>(ev)); break;
#ifndef QT_NO_SHORTCUT
case QEvent::ShortcutOverride:{
+ if (isReadOnly())
+ return false;
QKeyEvent* ke = static_cast<QKeyEvent*>(ev);
if (ke == QKeySequence::Copy
|| ke == QKeySequence::Paste
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 301ff72..d6f2705 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -549,7 +549,10 @@ inline qreal QLineControl::cursorToX(int cursor) const
inline qreal QLineControl::cursorToX() const
{
- return cursorToX(m_cursor);
+ int cursor = m_cursor;
+ if (m_preeditCursor != -1)
+ cursor += m_preeditCursor;
+ return cursorToX(cursor);
}
inline bool QLineControl::isReadOnly() const
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 1622191..269cd12 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -119,8 +119,6 @@ void QMainWindowPrivate::init()
q->setAttribute(Qt::WA_Hover);
#ifdef QT_SOFTKEYS_ENABLED
menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q);
- menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction"));
- menuBarAction->setVisible(false);
#endif
}
diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp
index d1e7285..fc75c92 100644
--- a/src/gui/widgets/qmainwindowlayout.cpp
+++ b/src/gui/widgets/qmainwindowlayout.cpp
@@ -1627,6 +1627,13 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
tb->d_func()->plug(currentGapRect);
#endif
+ savedState.clear();
+ currentGapPos.clear();
+ pluggingWidget = 0;
+ //applying the state will make sure that the currentGap is updated correctly
+ //and all the geometries (especially the one from the central widget) is correct
+ layoutState.apply(false);
+
#ifndef QT_NO_DOCKWIDGET
#ifndef QT_NO_TABBAR
if (qobject_cast<QDockWidget*>(widget) != 0) {
@@ -1637,13 +1644,6 @@ void QMainWindowLayout::animationFinished(QWidget *widget)
}
#endif
#endif
-
- savedState.clear();
- currentGapPos.clear();
- pluggingWidget = 0;
- //applying the state will make sure that the currentGap is updated correctly
- //and all the geometries (especially the one from the central widget) is correct
- layoutState.apply(false);
}
if (!widgetAnimator.animating()) {
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index ee79f5a..d92168a 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -472,14 +472,20 @@ void QMainWindowLayout::removeFromMacToolbar(QToolBar *toolbar)
void QMainWindowLayout::cleanUpMacToolbarItems()
{
- for (int i = 0; i < toolbarItemsCopy.size(); ++i)
+#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+#endif
+ for (int i = 0; i < toolbarItemsCopy.size(); ++i) {
+#ifdef QT_MAC_USE_COCOA
+ NSToolbarItem *item = static_cast<NSToolbarItem *>(toolbarItemsCopy.at(i));
+ [item setView:0];
+#endif
CFRelease(toolbarItemsCopy.at(i));
+ }
toolbarItemsCopy.clear();
unifiedToolbarHash.clear();
#ifdef QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
-
OSWindowRef window = qt_mac_window_for(layoutState.mainWindow);
NSToolbar *macToolbar = [window toolbar];
if (macToolbar) {
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 5031d88..8ce7cc0 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1588,10 +1588,9 @@ QAction *QMenu::insertSeparator(QAction *before)
}
/*!
- This will set the default action to \a act. The default action may
- have a visual queue depending on the current QStyle. A default
- action is usually meant to indicate what will defaultly happen on a
- drop, as shown in a context menu.
+ This sets the default action to \a act. The default action may have
+ a visual cue, depending on the current QStyle. A default action
+ usually indicates what will happen by default when a drop occurs.
\sa defaultAction()
*/
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/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index cd7f9bd..7e4bbb5 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -175,6 +175,22 @@ static quint32 constructModifierMask(quint32 accel_key)
return ret;
}
+static void cancelAllMenuTracking()
+{
+#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
+ NSMenu *mainMenu = [NSApp mainMenu];
+ [mainMenu cancelTracking];
+ for (NSMenuItem *item in [mainMenu itemArray]) {
+ if ([item submenu]) {
+ [[item submenu] cancelTracking];
+ }
+ }
+#else
+ CancelMenuTracking(AcquireRootMenu(), true, 0);
+#endif
+}
+
static bool actualMenuItemVisibility(const QMenuBarPrivate::QMacMenuBarPrivate *mbp,
const QMacMenuAction *action)
{
@@ -1830,6 +1846,12 @@ void QMenuBarPrivate::macDestroyMenuBar()
mac_menubar = 0;
if (qt_mac_current_menubar.qmenubar == q) {
+#ifdef QT_MAC_USE_COCOA
+ QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+ [loader removeActionsFromAppMenu];
+#else
+ cancelAllMenuTracking();
+#endif
extern void qt_event_request_menubarupdate(); //qapplication_mac.cpp
qt_event_request_menubarupdate();
}
@@ -1933,20 +1955,6 @@ static bool qt_mac_should_disable_menu(QMenuBar *menuBar, QWidget *modalWidget)
return qt_mac_is_ancestor(menuBar->parentWidget(), modalWidget);
}
-static void cancelAllMenuTracking()
-{
-#ifdef QT_MAC_USE_COCOA
- QMacCocoaAutoReleasePool pool;
- NSMenu *mainMenu = [NSApp mainMenu];
- [mainMenu cancelTracking];
- for (NSMenuItem *item in [mainMenu itemArray]) {
- if ([item submenu]) {
- [[item submenu] cancelTracking];
- }
- }
-#endif
-}
-
/*!
\internal
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index b7272f7..aaed6b1 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -71,6 +71,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENU
#ifdef Q_WS_S60
+void qt_symbian_next_menu_from_action(QWidget* actionContainer);
void qt_symbian_show_toplevel(CEikMenuPane* menuPane);
void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id);
#endif // Q_WS_S60
@@ -87,7 +88,7 @@ QT_BEGIN_NAMESPACE
typedef void NSMenuItem;
# endif //__OBJC__
struct QMacMenuAction {
- QMacMenuAction()
+ QMacMenuAction()
#ifndef QT_MAC_USE_COCOA
: command(0)
#else
@@ -124,7 +125,7 @@ typedef QList<QMenuMergeItem> QMenuMergeList;
#ifdef Q_WS_WINCE
struct QWceMenuAction {
- uint command;
+ uint command;
QPointer<QAction> action;
HMENU menuHandle;
QWceMenuAction() : menuHandle(0), command(0) {}
@@ -340,7 +341,7 @@ public:
QList<QWceMenuAction*> actionItems;
HMENU menuHandle;
QWceMenuPrivate();
- ~QWceMenuPrivate();
+ ~QWceMenuPrivate();
void addAction(QAction *, QWceMenuAction* =0);
void addAction(QWceMenuAction *, QWceMenuAction* =0);
void syncAction(QWceMenuAction *);
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index b8370ec..c064791 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -81,6 +81,7 @@ static QList<QMenuBar*> nativeMenuBars;
static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
static QPointer<QWidget> widgetWithContextMenu;
static QList<QAction*> contextMenuActionList;
+static QWidget* actionMenu = NULL;
static int contexMenuCommand=0;
bool menuExists()
@@ -224,8 +225,26 @@ static void rebuildMenu()
}
#ifdef Q_WS_S60
+void qt_symbian_next_menu_from_action(QWidget *actionContainer)
+{
+ actionMenu = actionContainer;
+}
+
void qt_symbian_show_toplevel( CEikMenuPane* menuPane)
{
+ if (actionMenu) {
+ QMenuBarPrivate *mb = 0;
+ mb = menubars()->value(actionMenu);
+ qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
+ deleteAll( &symbianMenus );
+ Q_ASSERT(mb);
+ mb->symbian_menubar->rebuild();
+ for (int i = 0; i < symbianMenus.count(); ++i)
+ QT_TRAP_THROWING(menuPane->AddMenuItemL(symbianMenus.at(i)->menuItemData));
+ actionMenu = NULL;
+ return;
+ }
+
if (!menuExists())
return;
rebuildMenu();
@@ -271,10 +290,16 @@ int QMenuBarPrivate::symbianCommands(int command)
void QMenuBarPrivate::symbianCreateMenuBar(QWidget *parent)
{
Q_Q(QMenuBar);
- if (parent && parent->isWindow()){
- menubars()->insert(q->window(), this);
- symbian_menubar = new QSymbianMenuBarPrivate(this);
- nativeMenuBars.append(q);
+ if (parent) {
+ if(parent->isWindow()) {
+ menubars()->insert(q->window(), this);
+ symbian_menubar = new QSymbianMenuBarPrivate(this);
+ nativeMenuBars.append(q);
+ } else {
+ menubars()->insert(q->parentWidget(), this);
+ symbian_menubar = new QSymbianMenuBarPrivate(this);
+ nativeMenuBars.append(q);
+ }
}
}
@@ -284,6 +309,7 @@ void QMenuBarPrivate::symbianDestroyMenuBar()
int index = nativeMenuBars.indexOf(q);
nativeMenuBars.removeAt(index);
menubars()->remove(q->window(), this);
+ menubars()->remove(q->parentWidget(), this);
rebuildMenu();
if (symbian_menubar)
delete symbian_menubar;
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 0e14385..9caadb7 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -667,7 +667,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti
\i Application Menu | About <application name>
\i The application name is fetched from the \c {Info.plist} file
(see note below). If this entry is not found no About item
- will appear in the Application Menu.
+ will appear in the Application Menu.
\row \i config, options, setup, settings or preferences
\i Application Menu | Preferences
\i If this entry is not found the Settings item will be disabled
diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp
index 747a227..45b15ef 100644
--- a/src/gui/widgets/qprintpreviewwidget.cpp
+++ b/src/gui/widgets/qprintpreviewwidget.cpp
@@ -151,7 +151,11 @@ class GraphicsView : public QGraphicsView
public:
GraphicsView(QWidget* parent = 0)
: QGraphicsView(parent)
- {}
+ {
+#ifdef Q_WS_MAC
+ setFrameStyle(QFrame::NoFrame);
+#endif
+ }
signals:
void resized();
diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp
index 73ce122..4eff260 100644
--- a/src/gui/widgets/qscrollbar.cpp
+++ b/src/gui/widgets/qscrollbar.cpp
@@ -521,6 +521,24 @@ bool QScrollBar::event(QEvent *event)
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(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<QWheelEvent *>(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;
+ }
+#endif
default:
break;
}
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index 53050ac..8beda55 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -441,8 +441,7 @@ void QToolBarPrivate::plug(const QRect &r)
When a QToolBar is not a child of a QMainWindow, it looses the ability
to populate the extension pop up with widgets added to the toolbar using
addWidget(). Please use widget actions created by inheriting QWidgetAction
- and implementing QWidgetAction::createWidget() instead. This is a known
- issue which will be fixed in a future release.
+ and implementing QWidgetAction::createWidget() instead.
\sa QToolButton, QMenu, QAction, {Application Example}
*/