diff options
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qaction.cpp | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication.h | 1 | ||||
-rw-r--r-- | src/widgets/kernel/qapplication_qpa.cpp | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qgridlayout.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qgridlayout.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qstackedlayout.cpp | 32 | ||||
-rw-r--r-- | src/widgets/kernel/qstackedlayout.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 14 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 9 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_qpa.cpp | 11 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 27 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetsvariant.cpp | 8 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow_qpa.cpp | 17 |
13 files changed, 72 insertions, 70 deletions
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp index f450d13a39..c4f7995087 100644 --- a/src/widgets/kernel/qaction.cpp +++ b/src/widgets/kernel/qaction.cpp @@ -879,7 +879,7 @@ QString QAction::statusTip() const the action. The text may contain rich text. There is no default "What's This?" text. - \sa QWhatsThis Q3StyleSheet + \sa QWhatsThis */ void QAction::setWhatsThis(const QString &whatsthis) { diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 3e11db0863..6c1ced1623 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -244,7 +244,6 @@ private: friend class QWidgetPrivate; friend class QWidgetWindow; friend class QETWidget; - friend class Q3AccelManager; friend class QTranslator; friend class QWidgetAnimator; #ifndef QT_NO_SHORTCUT diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index 97fc794252..da6a02a41d 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -305,7 +305,6 @@ void QApplicationPrivate::initializeWidgetPaletteHash() setPossiblePalette(platformTheme->palette(QPlatformTheme::ToolButtonPalette), "QToolButton"); setPossiblePalette(platformTheme->palette(QPlatformTheme::ButtonPalette), "QAbstractButton"); setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "QHeaderView"); - setPossiblePalette(platformTheme->palette(QPlatformTheme::HeaderPalette), "Q3Header"); setPossiblePalette(platformTheme->palette(QPlatformTheme::ItemViewPalette), "QAbstractItemView"); setPossiblePalette(platformTheme->palette(QPlatformTheme::MessageBoxLabelPelette), "QMessageBoxLabel"); setPossiblePalette(platformTheme->palette(QPlatformTheme::TabBarPalette), "QTabBar"); @@ -340,10 +339,8 @@ void QApplicationPrivate::initializeWidgetFontHash() fontHash->insert(QByteArrayLiteral("QTitleBar"), *font); if (const QFont *font = theme->font(QPlatformTheme::StatusBarFont)) fontHash->insert(QByteArrayLiteral("QStatusBar"), *font); - if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont)) { - fontHash->insert(QByteArrayLiteral("QWorkspaceTitleBar"), *font); + if (const QFont *font = theme->font(QPlatformTheme::MdiSubWindowTitleFont)) fontHash->insert(QByteArrayLiteral("QMdiSubWindowTitleBar"), *font); - } if (const QFont *font = theme->font(QPlatformTheme::DockWidgetTitleFont)) fontHash->insert(QByteArrayLiteral("QDockWidgetTitle"), *font); if (const QFont *font = theme->font(QPlatformTheme::PushButtonFont)) @@ -354,10 +351,8 @@ void QApplicationPrivate::initializeWidgetFontHash() fontHash->insert(QByteArrayLiteral("QAbstractItemView"), *font); if (const QFont *font = theme->font(QPlatformTheme::ListViewFont)) fontHash->insert(QByteArrayLiteral("QListViewFont"), *font); - if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont)) { + if (const QFont *font = theme->font(QPlatformTheme::HeaderViewFont)) fontHash->insert(QByteArrayLiteral("QHeaderViewFont"), *font); - fontHash->insert(QByteArrayLiteral("Q3Header"), *font); - } if (const QFont *font = theme->font(QPlatformTheme::ListBoxFont)) fontHash->insert(QByteArrayLiteral("QListBox"), *font); if (const QFont *font = theme->font(QPlatformTheme::ComboMenuItemFont)) diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 3607d88d9e..39daf96eb8 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -167,9 +167,9 @@ public: return item; } - void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) { + void getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const { if (index < things.count()) { - QGridBox *b = things.at(index); + const QGridBox *b = things.at(index); int toRow = b->toRow(rr); int toCol = b->toCol(cc); *row = b->row; @@ -1347,9 +1347,9 @@ QLayoutItem *QGridLayout::takeAt(int index) \sa itemAtPosition(), itemAt() */ -void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) +void QGridLayout::getItemPosition(int index, int *row, int *column, int *rowSpan, int *columnSpan) const { - Q_D(QGridLayout); + Q_D(const QGridLayout); d->getItemPosition(index, row, column, rowSpan, columnSpan); } diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h index 02789b7794..930fdf4511 100644 --- a/src/widgets/kernel/qgridlayout.h +++ b/src/widgets/kernel/qgridlayout.h @@ -120,7 +120,7 @@ public: void addItem(QLayoutItem *item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment = 0); void setDefaultPositioning(int n, Qt::Orientation orient); - void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan); + void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan) const; protected: void addItem(QLayoutItem *); diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp index 9b40063e65..0d2e7716e5 100644 --- a/src/widgets/kernel/qstackedlayout.cpp +++ b/src/widgets/kernel/qstackedlayout.cpp @@ -477,6 +477,38 @@ void QStackedLayout::setGeometry(const QRect &rect) } /*! + \reimp +*/ +bool QStackedLayout::hasHeightForWidth() const +{ + const int n = count(); + + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + if (item->hasHeightForWidth()) + return true; + } + } + return false; +} + +/*! + \reimp +*/ +int QStackedLayout::heightForWidth(int width) const +{ + const int n = count(); + + int hfw = 0; + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + hfw = qMax(hfw, item->heightForWidth(width)); + } + } + return hfw; +} + +/*! \enum QStackedLayout::StackingMode \since 4.4 diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h index e54efa886e..fa77341c52 100644 --- a/src/widgets/kernel/qstackedlayout.h +++ b/src/widgets/kernel/qstackedlayout.h @@ -94,6 +94,8 @@ public: QLayoutItem *itemAt(int) const; QLayoutItem *takeAt(int); void setGeometry(const QRect &rect); + bool hasHeightForWidth() const; + int heightForWidth(int width) const; Q_SIGNALS: void widgetRemoved(int index); diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 9a32d952f9..e6d5a7af6d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2884,7 +2884,7 @@ void QWidget::showNormal() \sa setEnabled() enabled */ -bool QWidget::isEnabledTo(QWidget* ancestor) const +bool QWidget::isEnabledTo(const QWidget *ancestor) const { const QWidget * w = this; while (!w->testAttribute(Qt::WA_ForceDisabled) @@ -3860,13 +3860,13 @@ void QWidget::setFixedHeight(int h) \sa mapFrom() mapToParent() mapToGlobal() underMouse() */ -QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const +QPoint QWidget::mapTo(const QWidget * parent, const QPoint & pos) const { QPoint p = pos; if (parent) { const QWidget * w = this; while (w != parent) { - Q_ASSERT_X(w, "QWidget::mapTo(QWidget *parent, const QPoint &pos)", + Q_ASSERT_X(w, "QWidget::mapTo(const QWidget *parent, const QPoint &pos)", "parent must be in parent hierarchy"); p = w->mapToParent(p); w = w->parentWidget(); @@ -3884,13 +3884,13 @@ QPoint QWidget::mapTo(QWidget * parent, const QPoint & pos) const \sa mapTo() mapFromParent() mapFromGlobal() underMouse() */ -QPoint QWidget::mapFrom(QWidget * parent, const QPoint & pos) const +QPoint QWidget::mapFrom(const QWidget * parent, const QPoint & pos) const { QPoint p(pos); if (parent) { const QWidget * w = this; while (w != parent) { - Q_ASSERT_X(w, "QWidget::mapFrom(QWidget *parent, const QPoint &pos)", + Q_ASSERT_X(w, "QWidget::mapFrom(const QWidget *parent, const QPoint &pos)", "parent must be in parent hierarchy"); p = w->mapFromParent(p); @@ -7574,7 +7574,7 @@ bool QWidget::close() \sa show() hide() isVisible() */ -bool QWidget::isVisibleTo(QWidget* ancestor) const +bool QWidget::isVisibleTo(const QWidget *ancestor) const { if (!ancestor) return isVisible(); @@ -8441,7 +8441,7 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event) void QWidget::mouseDoubleClickEvent(QMouseEvent *event) { - Q_UNUSED(event) + Q_UNUSED(event); } #ifndef QT_NO_WHEELEVENT diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 78b693c78d..cf907e14cd 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -243,7 +243,7 @@ public: void setWindowModality(Qt::WindowModality windowModality); bool isEnabled() const; - bool isEnabledTo(QWidget*) const; + bool isEnabledTo(const QWidget *) const; bool isEnabledToTLW() const; public Q_SLOTS: @@ -306,8 +306,8 @@ public: QPoint mapFromGlobal(const QPoint &) const; QPoint mapToParent(const QPoint &) const; QPoint mapFromParent(const QPoint &) const; - QPoint mapTo(QWidget *, const QPoint &) const; - QPoint mapFrom(QWidget *, const QPoint &) const; + QPoint mapTo(const QWidget *, const QPoint &) const; + QPoint mapFrom(const QWidget *, const QPoint &) const; QWidget *window() const; QWidget *nativeParentWidget() const; @@ -505,8 +505,7 @@ public: bool restoreGeometry(const QByteArray &geometry); void adjustSize(); bool isVisible() const; - bool isVisibleTo(QWidget*) const; - // ### Qt 5: bool isVisibleTo(_const_ QWidget *) const + bool isVisibleTo(const QWidget *) const; inline bool isHidden() const; bool isMinimized() const; diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 3d23b04ddf..0f55646958 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -440,9 +440,9 @@ static inline QRect positionTopLevelWindow(QRect geometry, const QScreen *screen void QWidgetPrivate::show_sys() { Q_Q(QWidget); - q->setAttribute(Qt::WA_Mapped); if (q->testAttribute(Qt::WA_DontShowOnScreen)) { invalidateBuffer(q->rect()); + q->setAttribute(Qt::WA_Mapped); return; } @@ -483,8 +483,8 @@ void QWidgetPrivate::show_sys() void QWidgetPrivate::hide_sys() { Q_Q(QWidget); - q->setAttribute(Qt::WA_Mapped, false); deactivateWidgetCleanup(); + if (!q->isWindow()) { QWidget *p = q->parentWidget(); if (p &&p->isVisible()) { @@ -492,7 +492,12 @@ void QWidgetPrivate::hide_sys() } return; } - if (QWindow *window = q->windowHandle()) { + + invalidateBuffer(q->rect()); + + if (q->testAttribute(Qt::WA_DontShowOnScreen)) { + q->setAttribute(Qt::WA_Mapped, false); + } else if (QWindow *window = q->windowHandle()) { window->setVisible(false); } } diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index b331356e66..2e9f072a0f 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -914,29 +914,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) { - if (!tlw || !tlwExtra) - return true; - -#ifdef Q_WS_X11 - // Delay the sync until we get an Expose event from X11 (initial show). - // Qt::WA_Mapped is set to true, but the actual mapping has not yet occurred. - // However, we must repaint immediately regardless of the state if someone calls repaint(). - if (tlwExtra->waitingForMapNotify && !tlwExtra->inRepaint) - return true; -#endif - - if (!tlw->testAttribute(Qt::WA_Mapped)) - return true; - - if (!tlw->isVisible() -#ifndef Q_WS_X11 - // If we're minimized on X11, WA_Mapped will be false and we - // will return in the case above. Some window managers on X11 - // sends us the PropertyNotify to change the minimized state - // *AFTER* we've received the expose event, which is baaad. - || tlw->isMinimized() -#endif - ) + if (!tlw || !tlwExtra || !tlw->testAttribute(Qt::WA_Mapped) || !tlw->isVisible()) return true; return false; @@ -1345,6 +1323,9 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) return; Q_Q(QWidget); + if (discardSyncRequest(q, maybeTopData())) + return; + if (q->testAttribute(Qt::WA_StaticContents)) { if (!extra) createExtra(); diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index 81847681e4..f6817cec8a 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -184,12 +184,4 @@ void qRegisterWidgetsVariant() } Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant) -void qUnregisterWidgetsVariant() -{ - QVariantPrivate::unregisterHandler(QModulesPrivate::Widgets); - qMetaTypeWidgetsHelper = 0; -} -Q_DESTRUCTOR_FUNCTION(qUnregisterWidgetsVariant) - - QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp index ed7371a9bd..4723901625 100644 --- a/src/widgets/kernel/qwidgetwindow_qpa.cpp +++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp @@ -152,15 +152,6 @@ bool QWidgetWindow::event(QEvent *event) handleDragEvent(event); break; - case QEvent::Map: - m_widget->setAttribute(Qt::WA_Mapped); - m_widget->d_func()->syncBackingStore(); - return true; - - case QEvent::Unmap: - m_widget->setAttribute(Qt::WA_Mapped, false); - return true; - case QEvent::Expose: handleExposeEvent(static_cast<QExposeEvent *>(event)); return true; @@ -447,7 +438,13 @@ void QWidgetWindow::handleDragEvent(QEvent *event) void QWidgetWindow::handleExposeEvent(QExposeEvent *event) { - m_widget->d_func()->syncBackingStore(event->region()); + if (isExposed()) { + m_widget->setAttribute(Qt::WA_Mapped); + if (!event->region().isNull()) + m_widget->d_func()->syncBackingStore(event->region()); + } else { + m_widget->setAttribute(Qt::WA_Mapped, false); + } } void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event) |