diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc | 2 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 5 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget.cpp | 7 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 17 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 8 | ||||
-rw-r--r-- | src/widgets/styles/qstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstyleanimation.cpp | 15 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qspinbox.cpp | 2 | ||||
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol.cpp | 6 |
13 files changed, 56 insertions, 25 deletions
diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc index 7f6f1a3d8b..36d3dc6af4 100644 --- a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc +++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc @@ -874,7 +874,7 @@ QGroupBox::title { subcontrol-position: top center; /* position at the top center */ padding: 0 3px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #FFOECE, stop: 1 #FFFFFF); + stop: 0 #FF0ECE, stop: 1 #FFFFFF); } //! [114] diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 04047d8d0a..2d07e545c8 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7634,7 +7634,10 @@ QGraphicsObject::~QGraphicsObject() bool QGraphicsObject::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { - update(); + if (isVisible()) { + ev->accept(); + update(); + } return true; } return QObject::event(ev); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 4abb5e39e5..ccc51120a9 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1409,9 +1409,14 @@ bool QGraphicsWidget::event(QEvent *event) break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: - case QEvent::StyleAnimationUpdate: update(); break; + case QEvent::StyleAnimationUpdate: + if (isVisible()) { + event->accept(); + update(); + } + break; // Taken from QWidget::event case QEvent::ActivationChange: case QEvent::EnabledChange: diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 57a2063b78..be349bfced 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1888,14 +1888,29 @@ bool QApplication::event(QEvent *e) \obsolete */ +// ### FIXME: topLevelWindows does not contain QWidgets without a parent +// until create_sys is called. So we have to override the +// QGuiApplication::notifyLayoutDirectionChange +// to do the right thing. void QApplicationPrivate::notifyLayoutDirectionChange() { - QWidgetList list = QApplication::topLevelWidgets(); + const QWidgetList list = QApplication::topLevelWidgets(); + QWindowList windowList = QGuiApplication::topLevelWindows(); + + // send to all top-level QWidgets for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); + windowList.removeAll(w->windowHandle()); QEvent ev(QEvent::ApplicationLayoutDirectionChange); QCoreApplication::sendEvent(w, &ev); } + + // in case there are any plain QWindows in this QApplication-using + // application, also send the notification to them + for (int i = 0; i < windowList.size(); ++i) { + QEvent ev(QEvent::ApplicationLayoutDirectionChange); + QCoreApplication::sendEvent(windowList.at(i), &ev); + } } /*! diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index fc7bade9f7..7a86b6affe 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8249,7 +8249,10 @@ bool QWidget::event(QEvent *event) update(static_cast<QUpdateLaterEvent*>(event)->region()); break; case QEvent::StyleAnimationUpdate: - update(); + if (isVisible() && !window()->isMinimized()) { + event->accept(); + update(); + } break; case QEvent::WindowBlocked: diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 93234f3958..3b6127e4e7 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -148,10 +148,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QBackingStore *store = q->backingStore(); if (!store) { - if (win && q->windowType() != Qt::Desktop) - q->setBackingStore(new QBackingStore(win)); - else + if (win && q->windowType() != Qt::Desktop) { + if (q->isTopLevel()) + q->setBackingStore(new QBackingStore(win)); + } else { q->setAttribute(Qt::WA_PaintOnScreen, true); + } } setWindowModified_helper(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 2e96247873..167102c633 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -49,6 +49,7 @@ #endif #include <private/qwidgetbackingstore_p.h> #include <qpa/qwindowsysteminterface_p.h> +#include <qpa/qplatformtheme.h> #include <private/qgesturemanager_p.h> QT_BEGIN_NAMESPACE @@ -354,6 +355,9 @@ void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e) void QWidgetWindow::handleMouseEvent(QMouseEvent *event) { + static const QEvent::Type contextMenuTrigger = + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ? + QEvent::MouseButtonRelease : QEvent::MouseButtonPress; if (qApp->d_func()->inPopupMode()) { QWidget *activePopupWidget = qApp->activePopupWidget(); QWidget *popup = activePopupWidget; @@ -438,7 +442,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) } qt_replay_popup_mouse_event = false; #ifndef QT_NO_CONTEXTMENU - } else if (event->type() == QEvent::MouseButtonPress + } else if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { QWidget *popupEvent = popup; @@ -487,7 +491,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) qt_last_mouse_receiver); #ifndef QT_NO_CONTEXTMENU - if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::RightButton) { + if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton) { QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); QGuiApplication::sendSpontaneousEvent(receiver, &e); } diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 77f869f036..da9b5da2a5 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -619,7 +619,7 @@ void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, c void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const { - int scale = pixmap.devicePixelRatio(); + qreal scale = pixmap.devicePixelRatio(); QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect); QRect inter = aligned.intersected(rect); diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 4fb67d90c0..90fb371982 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -93,7 +93,10 @@ void QStyleAnimation::setStartTime(const QTime &time) void QStyleAnimation::updateTarget() { QEvent event(QEvent::StyleAnimationUpdate); + event.setAccepted(false); QCoreApplication::sendEvent(target(), &event); + if (!event.isAccepted()) + stop(); } bool QStyleAnimation::isUpdateNeeded() const @@ -103,16 +106,8 @@ bool QStyleAnimation::isUpdateNeeded() const void QStyleAnimation::updateCurrentTime(int) { - if (QObject *tgt = target()) { - if (tgt->isWidgetType()) { - QWidget *widget = static_cast<QWidget *>(tgt); - if (!widget->isVisible() || widget->window()->isMinimized()) - stop(); - } - - if (isUpdateNeeded()) - updateTarget(); - } + if (target() && isUpdateNeeded()) + updateTarget(); } QProgressStyleAnimation::QProgressStyleAnimation(int speed, QObject *target) : diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ab98dfbdcf..2f36e0e53c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5271,7 +5271,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder(); bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition(); - bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition(); + bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition(); if (ruleMatch || upRuleMatch || downRuleMatch) { switch (sc) { case SC_SpinBoxFrame: diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index fd74ab7595..17a6ededfe 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3073,7 +3073,7 @@ void QComboBox::wheelEvent(QWheelEvent *e) newIndex--; while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) newIndex--; - } else { + } else if (e->delta() < 0) { newIndex++; while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) newIndex++; diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index a43b937951..e198dae168 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1042,7 +1042,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, if (max != min && (copy.isEmpty() || (min < 0 && copy == QLatin1String("-")) - || (min >= 0 && copy == QLatin1String("+")))) { + || (max >= 0 && copy == QLatin1String("+")))) { state = QValidator::Intermediate; QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; } else if (copy.startsWith(QLatin1Char('-')) && min >= 0) { diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 0255183c87..b8f8762240 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -2158,11 +2158,14 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget setActionIcon(a, QStringLiteral("edit-redo")); menu->addSeparator(); +#ifndef QT_NO_CLIPBOARD a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); a->setEnabled(d->cursor.hasSelection()); setActionIcon(a, QStringLiteral("edit-cut")); +#endif } +#ifndef QT_NO_CLIPBOARD if (showTextSelectionActions) { a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); a->setEnabled(d->cursor.hasSelection()); @@ -2175,9 +2178,10 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); a->setEnabled(!d->linkToCopy.isEmpty()); } +#endif // QT_NO_CLIPBOARD if (d->interactionFlags & Qt::TextEditable) { -#if !defined(QT_NO_CLIPBOARD) +#ifndef QT_NO_CLIPBOARD a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); a->setEnabled(canPaste()); setActionIcon(a, QStringLiteral("edit-paste")); |