summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-09-04 21:09:44 +0200
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2020-12-09 20:30:04 +0100
commitff8d757e222d0b9b8618b83e6c4186e366e917e9 (patch)
treefc1971a9ee963aa3eb09b935de6a0b745600714c /src/widgets
parentac09bd40fa3d38e1416503ac0b39797e93d332d9 (diff)
QWidget: mark obsolete function isTopLevel() as deprecated
QWidget::isTopLevel() is deprecated and can be replaced 1:1 with isWindow(). Sadly it's was not marked with Q_DECL_DEPRECATED in 5.15 Change-Id: I4508fbde41927f3b82e47a75011179548325029d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidget.cpp6
-rw-r--r--src/widgets/kernel/qwidget.h3
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp2
5 files changed, 9 insertions, 6 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index bcd718d521..023a987dc4 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1328,7 +1328,7 @@ void QWidgetPrivate::create()
if (!store) {
if (q->windowType() != Qt::Desktop) {
- if (q->isTopLevel())
+ if (q->isWindow())
q->setBackingStore(new QBackingStore(win));
} else {
q->setAttribute(Qt::WA_PaintOnScreen, true);
@@ -11855,7 +11855,7 @@ void QWidget::setBackingStore(QBackingStore *store)
{
// ### createWinId() ??
- if (!isTopLevel())
+ if (!isWindow())
return;
Q_D(QWidget);
@@ -11872,7 +11872,7 @@ void QWidget::setBackingStore(QBackingStore *store)
if (!repaintManager)
return;
- if (isTopLevel()) {
+ if (isWindow()) {
if (repaintManager->backingStore() != oldStore && repaintManager->backingStore() != store)
delete repaintManager->backingStore();
repaintManager->setBackingStore(store);
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 14608a5f13..11d143d0e4 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -230,7 +230,10 @@ public:
void setStyle(QStyle *);
// Widget types and states
+#if QT_DEPRECATED_SINCE(6, 2)
+ QT_DEPRECATED_VERSION_X_6_1("Use isWindow()")
bool isTopLevel() const;
+#endif
bool isWindow() const;
bool isModal() const;
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index e4e8f9f9d1..ae1e461d7a 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -800,7 +800,7 @@ void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
auto oldPosition = m_widget->data->crect.topLeft();
auto newPosition = geometry().topLeft();
- if (!m_widget->isTopLevel()) {
+ if (!m_widget->isWindow()) {
if (auto *nativeParent = m_widget->nativeParentWidget())
newPosition = m_widget->parentWidget()->mapFrom(nativeParent, newPosition);
}
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 8e7005fafa..a7a3c20e1a 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -1091,7 +1091,7 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
QColor dimHighlight(qMin(highlight.red()/2 + 110, 255),
qMin(highlight.green()/2 + 110, 255),
qMin(highlight.blue()/2 + 110, 255));
- dimHighlight.setAlpha(widget && widget->isTopLevel() ? 255 : 80);
+ dimHighlight.setAlpha(widget && widget->isWindow() ? 255 : 80);
QLinearGradient gradient(rect.topLeft(), QPoint(rect.bottomLeft().x(), rect.bottomLeft().y()));
gradient.setColorAt(0, dimHighlight.lighter(120));
gradient.setColorAt(1, dimHighlight);
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 95ee90eb31..59e2e4e57a 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -2593,7 +2593,7 @@ void QMainWindowLayout::hover(QLayoutItem *widgetItem, const QPoint &mousePos)
continue;
if (!qobject_cast<QDockWidget*>(w) && !qobject_cast<QDockWidgetGroupWindow *>(w))
continue;
- if (w != widget && w->isTopLevel() && w->isVisible() && !w->isMinimized())
+ if (w != widget && w->isWindow() && w->isVisible() && !w->isMinimized())
candidates << w;
if (QDockWidgetGroupWindow *group = qobject_cast<QDockWidgetGroupWindow *>(w)) {
// Sometimes, there are floating QDockWidget that have a QDockWidgetGroupWindow as a parent.