diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-01 10:03:53 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-07-01 16:25:19 +0200 |
commit | a09a8d509a69ed16d8afbe15296b8332cacd6c66 (patch) | |
tree | 28645b437fd0390d903f753a44ba79626eecb8ac /src/widgets | |
parent | 4b28152da64f7f23a1bbb810d8cdb7626a5f0b8e (diff) | |
parent | 83f06da1c6bffff61af78cbe75a0691d53742b53 (diff) |
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts:
mkspecs/qnx-x86-qcc/qplatformdefs.h
src/corelib/global/qglobal.h
src/network/socket/qnativesocketengine_winrt.cpp
src/plugins/platforms/android/androidjniaccessibility.cpp
src/plugins/platforms/windows/qwindowswindow.cpp
Manually adjusted:
mkspecs/qnx-armle-v7-qcc/qplatformdefs.h
to include 9ce697f2d54be6d94381c72af28dda79cbc027d4
Thanks goes to Sergio for the qnx mkspecs adjustments.
Change-Id: I53b1fd6bc5bc884e5ee2c2b84975f58171a1cb8e
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qcolordialog.cpp | 39 | ||||
-rw-r--r-- | src/widgets/dialogs/qcolordialog_p.h | 11 | ||||
-rw-r--r-- | src/widgets/doc/snippets/qstyleplugin/main.cpp | 2 | ||||
-rw-r--r-- | src/widgets/doc/src/qtwidgets-index.qdoc | 1 | ||||
-rw-r--r-- | src/widgets/doc/src/widgets-and-layouts/layout.qdoc | 10 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 8 | ||||
-rw-r--r-- | src/widgets/styles/qfusionstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 22 | ||||
-rw-r--r-- | src/widgets/styles/qstylehelper.cpp | 10 | ||||
-rw-r--r-- | src/widgets/styles/qstylehelper_p.h | 1 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 1 | ||||
-rw-r--r-- | src/widgets/util/qsystemtrayicon_x11.cpp | 6 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 45 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox_p.h | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qfontcombobox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qmainwindow.cpp | 9 | ||||
-rw-r--r-- | src/widgets/widgets/qstackedwidget.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qtoolbar.cpp | 4 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 7 |
20 files changed, 124 insertions, 61 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 744666155a..714dcfa1f4 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1450,7 +1450,7 @@ void QColorDialogPrivate::_q_newHsv(int h, int s, int v) } //sets all widgets to display rgb -void QColorDialogPrivate::setCurrentColor(QRgb rgb) +void QColorDialogPrivate::setCurrentRgbColor(QRgb rgb) { if (!nativeDialogInUse) { cs->setRgb(rgb); @@ -1533,14 +1533,14 @@ void QColorDialogPrivate::_q_nextCustom(int r, int c) void QColorDialogPrivate::_q_newCustom(int r, int c) { const int i = r + 2 * c; - setCurrentColor(QColorDialogOptions::customColor(i)); + setCurrentRgbColor(QColorDialogOptions::customColor(i)); if (standard) standard->setSelected(-1,-1); } void QColorDialogPrivate::_q_newStandard(int r, int c) { - setCurrentColor(QColorDialogOptions::standardColor(r + c * 6)); + setCurrentRgbColor(QColorDialogOptions::standardColor(r + c * 6)); if (custom) custom->setSelected(-1,-1); } @@ -1881,6 +1881,21 @@ QColorDialog::QColorDialog(const QColor &initial, QWidget *parent) d->init(initial); } +void QColorDialogPrivate::setCurrentColor(const QColor &color, SetColorMode setColorMode) +{ + if (nativeDialogInUse) { + platformColorDialogHelper()->setCurrentColor(color); + return; + } + + if (setColorMode & ShowColor) { + setCurrentRgbColor(color.rgb()); + setCurrentAlpha(color.alpha()); + } + if (setColorMode & SelectColor) + selectColor(color); +} + /*! \property QColorDialog::currentColor \brief the currently selected color in the dialog @@ -1889,13 +1904,7 @@ QColorDialog::QColorDialog(const QColor &initial, QWidget *parent) void QColorDialog::setCurrentColor(const QColor &color) { Q_D(QColorDialog); - if (d->nativeDialogInUse) - d->platformColorDialogHelper()->setCurrentColor(color); - else { - d->setCurrentColor(color.rgb()); - d->selectColor(color); - d->setCurrentAlpha(color.alpha()); - } + d->setCurrentColor(color); } QColor QColorDialog::currentColor() const @@ -2170,10 +2179,11 @@ void QColorDialog::changeEvent(QEvent *e) bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) { - Q_Q(QColorDialog); const QPoint globalPos = e->globalPos(); const QColor color = grabScreenColor(globalPos); - q->setCurrentColor(color); + // QTBUG-39792, do not change standard, custom color selectors while moving as + // otherwise it is not possible to pre-select a custom cell for assignment. + setCurrentColor(color, ShowColor); lblScreenColorInfo->setText(QColorDialog::tr("Cursor at %1, %2, color: %3\nPress ESC to cancel") .arg(globalPos.x()).arg(globalPos.y()).arg(color.name())); return true; @@ -2181,8 +2191,7 @@ bool QColorDialogPrivate::handleColorPickingMouseMove(QMouseEvent *e) bool QColorDialogPrivate::handleColorPickingMouseButtonRelease(QMouseEvent *e) { - Q_Q(QColorDialog); - q->setCurrentColor(grabScreenColor(e->globalPos())); + setCurrentColor(grabScreenColor(e->globalPos()), SetColorAll); releaseColorPicking(); return true; } diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h index 72c3b0e3cd..feabce4bbf 100644 --- a/src/widgets/dialogs/qcolordialog_p.h +++ b/src/widgets/dialogs/qcolordialog_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -77,6 +77,12 @@ class QColorDialogPrivate : public QDialogPrivate Q_DECLARE_PUBLIC(QColorDialog) public: + enum SetColorMode { + ShowColor = 0x1, + SelectColor = 0x2, + SetColorAll = ShowColor | SelectColor + }; + QColorDialogPrivate() : options(new QColorDialogOptions) {} QPlatformColorDialogHelper *platformColorDialogHelper() const @@ -86,7 +92,8 @@ public: void initWidgets(); QRgb currentColor() const; QColor currentQColor() const; - void setCurrentColor(QRgb rgb); + void setCurrentColor(const QColor &color, SetColorMode setColorMode = SetColorAll); + void setCurrentRgbColor(QRgb rgb); void setCurrentQColor(const QColor &color); bool selectColor(const QColor &color); QColor grabScreenColor(const QPoint &p); diff --git a/src/widgets/doc/snippets/qstyleplugin/main.cpp b/src/widgets/doc/snippets/qstyleplugin/main.cpp index 4cf20ab960..e1a0d1b626 100644 --- a/src/widgets/doc/snippets/qstyleplugin/main.cpp +++ b/src/widgets/doc/snippets/qstyleplugin/main.cpp @@ -45,7 +45,7 @@ class MyStylePlugin : public QStylePlugin { Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE mystyleplugin.json) + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QStyleFactoryInterface" FILE "mystyleplugin.json") public: MyStylePlugin(QObject *parent = 0); diff --git a/src/widgets/doc/src/qtwidgets-index.qdoc b/src/widgets/doc/src/qtwidgets-index.qdoc index 859a0ef933..bc74f43b35 100644 --- a/src/widgets/doc/src/qtwidgets-index.qdoc +++ b/src/widgets/doc/src/qtwidgets-index.qdoc @@ -139,6 +139,7 @@ interfaces \section2 Examples \list \li \l{Qt Widgets Examples} + \li \l{Layout Examples} \endlist \section1 API Reference diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index 99d512b507..f581df4cb3 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -386,5 +386,13 @@ then set it. (This does not only apply to layouts, you should do the same if you implement your own resizeEvent(), for example.) \endlist -*/ + \section1 Layout Examples + + Many Qt Widgets \l{Qt Widgets Examples}{examples} already use layouts, + however, several examples exist to showcase various layouts. + + \list + \li \l{Layout Examples} + \endlist +*/ diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 605e96802b..551f229611 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -9943,7 +9943,7 @@ void QGraphicsTextItem::setDefaultTextColor(const QColor &col) } /*! - Returns the default text color that is used to for unformatted text. + Returns the default text color that is used for unformatted text. */ QColor QGraphicsTextItem::defaultTextColor() const { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index a1f3fbe8db..52d39759dc 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -3182,7 +3182,13 @@ void QWidget::showNormal() This is the case if neither the widget itself nor every parent up to but excluding \a ancestor has been explicitly disabled. - isEnabledTo(0) is equivalent to isEnabled(). + isEnabledTo(0) returns false if this widget or any if its ancestors + was explicitly disabled. + + The word ancestor here means a parent widget within the same window. + + Therefore isEnabledTo(0) stops at this widget's window, unlike + isEnabled() which also takes parent windows into considerations. \sa setEnabled(), enabled */ diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index 2172c9082f..82c53def7d 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -2493,7 +2493,7 @@ void QFusionStyle::drawComplexControl(ComplexControl control, const QStyleOption QColor arrowColor = option->palette.foreground().color(); arrowColor.setAlpha(220); - const QColor bgColor = option->palette.color(QPalette::Base); + const QColor bgColor = QStyleHelper::backgroundColor(option->palette, widget); const bool isDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128; if (transient) { diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index da6422ffec..f03a7796d9 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -3186,17 +3186,15 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai fdi.version = qt_mac_hitheme_version; fdi.state = tds; SInt32 frame_size; - if (pe == PE_FrameLineEdit) { - fdi.kind = frame->features & QStyleOptionFrame::Rounded ? kHIThemeFrameTextFieldRound : - kHIThemeFrameTextFieldSquare; - GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size); - if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled)) - fdi.state = kThemeStateInactive; - } else { - baseColor = QColor(150, 150, 150); //hardcoded since no query function --Sam - fdi.kind = kHIThemeFrameListBox; - GetThemeMetric(kThemeMetricListBoxFrameOutset, &frame_size); - } + fdi.kind = frame->features & QStyleOptionFrame::Rounded ? kHIThemeFrameTextFieldRound : + kHIThemeFrameTextFieldSquare; + GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size); + if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled)) + fdi.state = kThemeStateInactive; + else if (fdi.state == kThemeStatePressed) + // This pressed state doesn't make sense for a line edit frame. + // And Yosemite agrees with us. Otherwise it starts showing yellow pixels. + fdi.state = kThemeStateActive; fdi.isFocused = (frame->state & State_HasFocus); int lw = frame->lineWidth; if (lw <= 0) @@ -5134,7 +5132,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex [scroller initWithFrame:NSMakeRect(0, 0, slider->rect.width(), slider->rect.height())]; // mac os behaviour: as soon as one color channel is >= 128, // the bg is considered bright, scroller is dark - const QColor bgColor = opt->palette.color(QPalette::Base); + const QColor bgColor = QStyleHelper::backgroundColor(opt->palette, widget); const bool isDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128; if (isDarkBg) diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp index fc73488154..6be07a3f45 100644 --- a/src/widgets/styles/qstylehelper.cpp +++ b/src/widgets/styles/qstylehelper.cpp @@ -45,6 +45,8 @@ #include <private/qmath_p.h> #include <private/qstyle_p.h> #include <qmath.h> +#include <qscrollbar.h> +#include <qabstractscrollarea.h> #include "qstylehelper_p.h" #include <qstringbuilder.h> @@ -387,5 +389,13 @@ void drawBorderPixmap(const QPixmap &pixmap, QPainter *painter, const QRect &rec } } + +QColor backgroundColor(const QPalette &pal, const QWidget* widget) +{ + if (qobject_cast<const QScrollBar *>(widget) && widget->parent() && + qobject_cast<const QAbstractScrollArea *>(widget->parent()->parent())) + return widget->parentWidget()->parentWidget()->palette().color(QPalette::Base); + return pal.color(QPalette::Base); +} } QT_END_NAMESPACE diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h index 6355cbc985..73e5c94dcd 100644 --- a/src/widgets/styles/qstylehelper_p.h +++ b/src/widgets/styles/qstylehelper_p.h @@ -86,6 +86,7 @@ namespace QStyleHelper bool isInstanceOf(QObject *obj, QAccessible::Role role); bool hasAncestor(QObject *obj, QAccessible::Role role); #endif + QColor backgroundColor(const QPalette &pal, const QWidget* widget = 0); } diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index a22d0a3dca..b82aa1b5a0 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -2698,6 +2698,7 @@ void QStyleSheetStyle::polish(QWidget *w) styleSheetCaches->styleRulesCache.remove(w); styleSheetCaches->hasStyleRuleCache.remove(w); styleSheetCaches->renderRulesCache.remove(w); + styleSheetCaches->styleSheetCache.remove(w); } setGeometry(w); setProperties(w); diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp index 27d0418dff..06eaf86004 100644 --- a/src/widgets/util/qsystemtrayicon_x11.cpp +++ b/src/widgets/util/qsystemtrayicon_x11.cpp @@ -86,6 +86,7 @@ protected: virtual void mouseDoubleClickEvent(QMouseEvent *ev); virtual bool event(QEvent *); virtual void paintEvent(QPaintEvent *); + virtual void resizeEvent(QResizeEvent *); private slots: void systemTrayWindowChanged(QScreen *screen); @@ -208,6 +209,11 @@ void QSystemTrayIconSys::paintEvent(QPaintEvent *) q->icon().paint(&painter, rect); } +void QSystemTrayIconSys::resizeEvent(QResizeEvent *) +{ + update(); +} + //////////////////////////////////////////////////////////////////////////// QSystemTrayIconPrivate::QSystemTrayIconPrivate() diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index f857f4eac0..eae0cbbd06 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1085,6 +1085,19 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity() lineEdit->setPalette(q->palette()); } +void QComboBoxPrivate::updateFocusPolicy() +{ +#ifdef Q_OS_OSX + Q_Q(QComboBox); + + // See comment in QComboBoxPrivate::init() + if (q->isEditable()) + q->setFocusPolicy(Qt::WheelFocus); + else + q->setFocusPolicy(Qt::TabFocus); +#endif +} + /*! Initialize \a option with the values from this QComboBox. This method is useful for subclasses when they need a QStyleOptionComboBox, but don't want @@ -1691,10 +1704,6 @@ void QComboBox::setEditable(bool editable) } QLineEdit *le = new QLineEdit(this); setLineEdit(le); -#ifdef Q_OS_MAC - // See comment in QComboBoxPrivate::init() - setFocusPolicy(Qt::WheelFocus); -#endif } else { if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { d->viewContainer()->updateScrollers(); @@ -1704,12 +1713,10 @@ void QComboBox::setEditable(bool editable) d->lineEdit->hide(); d->lineEdit->deleteLater(); d->lineEdit = 0; -#ifdef Q_OS_MAC - // See comment in QComboBoxPrivate::init() - setFocusPolicy(Qt::TabFocus); -#endif } + d->updateFocusPolicy(); + d->viewContainer()->updateTopBottomMargin(); if (!testAttribute(Qt::WA_Resized)) adjustSize(); @@ -1743,6 +1750,7 @@ void QComboBox::setLineEdit(QLineEdit *edit) connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(currentTextChanged(QString))); d->lineEdit->setFrame(false); d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu); + d->updateFocusPolicy(); d->lineEdit->setFocusProxy(this); d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false); #ifndef QT_NO_COMPLETER @@ -2055,7 +2063,7 @@ void QComboBoxPrivate::setCurrentIndex(const QModelIndex &mi) if (indexChanged) currentIndex = QPersistentModelIndex(normalized); if (lineEdit) { - QString newText = q->itemText(normalized.row()); + const QString newText = itemText(normalized); if (lineEdit->text() != newText) lineEdit->setText(newText); updateLineEditGeometry(); @@ -2377,6 +2385,16 @@ QSize QComboBox::sizeHint() const } #ifdef Q_OS_OSX + +namespace { +struct IndexSetter { + int index; + QComboBox *cb; + + void operator()(void) { cb->setCurrentIndex(index); } +}; +} + /*! * \internal * @@ -2391,13 +2409,6 @@ bool QComboBoxPrivate::showNativePopup() if (QPlatformMenu *menu = theme->createPlatformMenu()) { int itemsCount = q->count(); - struct IndexSetter { - int index; - QComboBox *cb; - - void operator()(void) { cb->setCurrentIndex(index); } - }; - QList<QPlatformMenuItem *> items; items.reserve(itemsCount); QPlatformMenuItem *currentItem = 0; diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h index dceffe8d35..fb1ed71ee6 100644 --- a/src/widgets/widgets/qcombobox_p.h +++ b/src/widgets/widgets/qcombobox_p.h @@ -376,6 +376,7 @@ public: void keyboardSearchString(const QString &text); void modelChanged(); void updateViewContainerPaletteAndOpacity(); + void updateFocusPolicy(); #ifdef Q_OS_OSX bool showNativePopup(); diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 40ca73904c..db01543629 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -548,7 +548,7 @@ bool QFontComboBox::event(QEvent *e) if (e->type() == QEvent::Resize) { QListView *lview = qobject_cast<QListView*>(view()); if (lview) { - setFixedWidth(qMin(width() * 5 / 3, + lview->window()->setFixedWidth(qMin(width() * 5 / 3, QApplication::desktop()->availableGeometry(lview).width())); } } diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp index 358569a5e4..36ca90ba00 100644 --- a/src/widgets/widgets/qmainwindow.cpp +++ b/src/widgets/widgets/qmainwindow.cpp @@ -1226,7 +1226,9 @@ Qt::DockWidgetArea QMainWindow::dockWidgetArea(QDockWidget *dockwidget) const /*! Saves the current state of this mainwindow's toolbars and - dockwidgets. The \a version number is stored as part of the data. + dockwidgets. This includes the corner settings which can + be set with setCorner(). The \a version number is stored + as part of the data. The \l{QObject::objectName}{objectName} property is used to identify each QToolBar and QDockWidget. You should make sure @@ -1255,8 +1257,9 @@ QByteArray QMainWindow::saveState(int version) const /*! Restores the \a state of this mainwindow's toolbars and - dockwidgets. The \a version number is compared with that stored - in \a state. If they do not match, the mainwindow's state is left + dockwidgets. Also restores the corner settings too. The + \a version number is compared with that stored in \a state. + If they do not match, the mainwindow's state is left unchanged, and this function returns \c false; otherwise, the state is restored, and this function returns \c true. diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp index 4b7170a596..6dbc7c8fad 100644 --- a/src/widgets/widgets/qstackedwidget.cpp +++ b/src/widgets/widgets/qstackedwidget.cpp @@ -91,7 +91,7 @@ public: the list using the addWidget() function, or inserted at a given index using the insertWidget() function. The removeWidget() function removes a widget from the stacked widget. The number of - widgets contained in the stacked widget, can + widgets contained in the stacked widget can be obtained using the count() function. The widget() function returns the widget at a given index diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp index 3fd615c3c7..1c05529cd6 100644 --- a/src/widgets/widgets/qtoolbar.cpp +++ b/src/widgets/widgets/qtoolbar.cpp @@ -59,6 +59,10 @@ #include <private/qwidgetaction_p.h> #include <private/qmainwindowlayout_p.h> +#ifdef Q_OS_OSX +#include <qpa/qplatformnativeinterface.h> +#endif + #include "qtoolbar_p.h" #include "qtoolbarseparator_p.h" #include "qtoolbarlayout_p.h" diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index da348e4edc..a6b1aceb66 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1694,9 +1694,6 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button return; } - if (!mousePressed) - return; - const qreal mouseX = qreal(mousePos.x()); int newCursorPos = q->hitTest(mousePos, Qt::FuzzyHit); @@ -1717,7 +1714,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button if (newCursorPos == -1) return; - if (wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { + if (mousePressed && wordSelectionEnabled && !selectedWordOnDoubleClick.hasSelection()) { selectedWordOnDoubleClick = cursor; selectedWordOnDoubleClick.select(QTextCursor::WordUnderCursor); } @@ -1726,7 +1723,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button extendBlockwiseSelection(newCursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(newCursorPos, mouseX); - else if (!isPreediting()) + else if (mousePressed && !isPreediting()) setCursorPosition(newCursorPos, QTextCursor::KeepAnchor); if (interactionFlags & Qt::TextEditable) { |