Add View::setZOrder()

Only relevant to QtQuick.
Removes some ifdefs.
This commit is contained in:
Sergio Martins
2022-05-31 10:37:14 +01:00
parent 8223f462c6
commit 2e92357adc
4 changed files with 11 additions and 8 deletions

View File

@@ -239,6 +239,9 @@ public:
/// only the specific frontend can know what's the actual type
virtual bool is(Type) const;
/// @brief Sets the z order
/// Not supported on all platforms
virtual void setZOrder(int) {};
/// @brief if this view is a FloatingWindow, then returns its controller
/// Mostly to save the call sites from having too many casts

View File

@@ -932,16 +932,10 @@ void DockWidget::setMDISize(QSize size)
void DockWidget::setMDIZ(int z)
{
#ifdef KDDOCKWIDGETS_QTQUICK
if (Frame *frame = d->frame()) {
if (!frame->isMDI())
return;
frame->setZ(z);
if (frame->isMDI())
frame->view()->setZOrder(z);
}
#else
Q_UNUSED(z);
qWarning() << Q_FUNC_INFO << "Not implemented for QtQuick";
#endif
}
bool DockWidget::isPersistentCentralDockWidget() const

View File

@@ -821,4 +821,9 @@ QQuickItem *View_qtquick::createQQuickItem(const QString &filename, QQuickItem *
return qquickitem;
}
void View_qtquick::setZOrder(int z)
{
QQuickItem::setZ(z);
}
#include "View_qtquick.moc"

View File

@@ -157,6 +157,7 @@ public:
void setCursor(Qt::CursorShape shape) override;
void setMouseTracking(bool enable) override;
QVector<std::shared_ptr<View>> childViews() const override;
void setZOrder(int) override;
/// @brief This is equivalent to "anchors.fill: parent but in C++
void makeItemFillParent(QQuickItem *item);