diff options
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 293dafd932..28f4cd34ce 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1111,11 +1111,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) if (customize) ; // don't modify window flags if the user explicitly set them. else if (type == Qt::Dialog || type == Qt::Sheet) -#ifndef Q_OS_WINCE flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; -#else - flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; -#endif else if (type == Qt::Tool) flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint; else @@ -2412,9 +2408,8 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus painter->fillRect(0, 0, painter->device()->width(), painter->device()->height(), brush); painter->restore(); } else { - const QVector<QRect> &rects = rgn.rects(); - for (int i = 0; i < rects.size(); ++i) - painter->fillRect(rects.at(i), brush); + for (const QRect &rect : rgn) + painter->fillRect(rect, brush); } } @@ -4560,7 +4555,7 @@ const QPalette &QWidget::palette() const if (!isEnabled()) { data->pal.setCurrentColorGroup(QPalette::Disabled); } else if ((!isVisible() || isActiveWindow()) -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this)) #endif ) { @@ -8561,13 +8556,9 @@ QSize QWidgetPrivate::adjustedSize() const #else // all others QRect screen = QApplication::desktop()->screenGeometry(q->pos()); #endif -#if defined (Q_OS_WINCE) - s.setWidth(qMin(s.width(), screen.width())); - s.setHeight(qMin(s.height(), screen.height())); -#else s.setWidth(qMin(s.width(), screen.width()*2/3)); s.setHeight(qMin(s.height(), screen.height()*2/3)); -#endif + if (QTLWExtra *extra = maybeTopData()) extra->sizeAdjusted = true; } @@ -8848,7 +8839,7 @@ bool QWidget::event(QEvent *event) case QEvent::KeyRelease: keyReleaseEvent((QKeyEvent*)event); - // fall through + Q_FALLTHROUGH(); case QEvent::ShortcutOverride: break; @@ -8967,7 +8958,7 @@ bool QWidget::event(QEvent *event) 0, this); break; } - // fall through + Q_FALLTHROUGH(); #endif default: event->ignore(); @@ -9216,7 +9207,7 @@ bool QWidget::event(QEvent *event) } if (windowHandle() && !qstrncmp(propName, "_q_platform_", 12)) windowHandle()->setProperty(propName, property(propName)); - // fall through + Q_FALLTHROUGH(); } #endif default: @@ -9464,10 +9455,13 @@ void QWidget::tabletEvent(QTabletEvent *event) void QWidget::keyPressEvent(QKeyEvent *event) { +#ifndef QT_NO_SHORTCUT if ((windowType() == Qt::Popup) && event->matches(QKeySequence::Cancel)) { event->accept(); close(); - } else { + } else +#endif + { event->ignore(); } } @@ -9549,7 +9543,7 @@ void QWidget::focusOutEvent(QFocusEvent *) if (focusPolicy() != Qt::NoFocus || !isWindow()) update(); -#ifndef Q_OS_IOS +#if !defined(QT_PLATFORM_UIKIT) // FIXME: revisit autoSIP logic, QTBUG-42906 if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled)) QGuiApplication::inputMethod()->hide(); @@ -10764,10 +10758,8 @@ void QWidget::scroll(int dx, int dy) // Graphics View maintains its own dirty region as a list of rects; // until we can connect item updates directly to the view, we must // separately add a translated dirty region. - if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) - proxy->update(rect); - } + for (const QRect &rect : d->dirty) + proxy->update(rect.translated(dx, dy)); proxy->scroll(dx, dy, proxy->subWidgetRect(this)); return; } @@ -10807,7 +10799,7 @@ void QWidget::scroll(int dx, int dy, const QRect &r) // until we can connect item updates directly to the view, we must // separately add a translated dirty region. if (!d->dirty.isEmpty()) { - foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) + for (const QRect &rect : d->dirty.translated(dx, dy) & r) proxy->update(rect); } proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); @@ -11218,13 +11210,13 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) d->enforceNativeChildren(); } #endif - // fall through + Q_FALLTHROUGH(); case Qt::WA_OpaquePaintEvent: d->updateIsOpaque(); break; case Qt::WA_NoSystemBackground: d->updateIsOpaque(); - // fall through... + Q_FALLTHROUGH(); case Qt::WA_UpdatesDisabled: d->updateSystemBackground(); break; |