Use visible property from QQuickWindow
Don't override it anymore, but react to the changed signal to do our magic.
This commit is contained in:
parent
714042904f
commit
04fd5d719a
@ -62,7 +62,7 @@ DialogProxy::DialogProxy(QQuickItem *parent)
|
||||
//Can't just connect to start() since it can't resolve the overload
|
||||
connect(this, &QWindow::xChanged, [=](){m_syncTimer->start();});
|
||||
connect(this, &QWindow::yChanged, [=](){m_syncTimer->start();});
|
||||
|
||||
connect(this, &QWindow::visibleChanged, this, &DialogProxy::onVisibleChanged);
|
||||
//HACK: this property is invoked due to the initialization that gets done to contentItem() in the getter
|
||||
property("data");
|
||||
//Create the FrameSvg background.
|
||||
@ -120,7 +120,6 @@ void DialogProxy::setVisualParent(QQuickItem *visualParent)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
m_visualParent = visualParent;
|
||||
emit visualParentChanged();
|
||||
if (visualParent && isVisible()) {
|
||||
@ -128,13 +127,9 @@ void DialogProxy::setVisualParent(QQuickItem *visualParent)
|
||||
}
|
||||
}
|
||||
|
||||
bool DialogProxy::isVisible() const
|
||||
{
|
||||
return QQuickWindow::isVisible();
|
||||
}
|
||||
|
||||
void DialogProxy::setVisible(const bool visible)
|
||||
void DialogProxy::onVisibleChanged()
|
||||
{
|
||||
const bool visible = isVisible();
|
||||
if (visible) {
|
||||
if (location() == Plasma::Types::FullScreen) {
|
||||
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
|
||||
@ -174,7 +169,6 @@ void DialogProxy::setVisible(const bool visible)
|
||||
}
|
||||
|
||||
KWindowEffects::slideWindow(winId(), slideLocation, -1);
|
||||
QQuickWindow::setVisible(visible);
|
||||
|
||||
if (visible) {
|
||||
raise();
|
||||
@ -188,7 +182,6 @@ void DialogProxy::setVisible(const bool visible)
|
||||
}
|
||||
setFlags(Qt::FramelessWindowHint|m_flags);
|
||||
}
|
||||
emit visibleChanged();
|
||||
}
|
||||
|
||||
QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
||||
|
@ -56,11 +56,6 @@ class DialogProxy : public QQuickWindow
|
||||
*/
|
||||
Q_PROPERTY(QQuickItem *visualParent READ visualParent WRITE setVisualParent NOTIFY visualParentChanged)
|
||||
|
||||
/**
|
||||
* Visibility of the Dialog window. Doesn't have anything to do with the visibility of the mainItem.
|
||||
*/
|
||||
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
||||
|
||||
/**
|
||||
* Window flags of the Dialog window
|
||||
*/
|
||||
@ -115,9 +110,6 @@ public:
|
||||
QQuickItem *visualParent() const;
|
||||
void setVisualParent(QQuickItem *visualParent);
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(const bool visible);
|
||||
|
||||
bool isActiveWindow() const;
|
||||
|
||||
/**
|
||||
@ -149,7 +141,6 @@ public:
|
||||
|
||||
Q_SIGNALS:
|
||||
void mainItemChanged();
|
||||
void visibleChanged();
|
||||
void activeWindowChanged();
|
||||
void locationChanged();
|
||||
void visualParentChanged();
|
||||
@ -176,6 +167,8 @@ protected:
|
||||
private Q_SLOTS:
|
||||
void syncBorders();
|
||||
|
||||
void onVisibleChanged();
|
||||
|
||||
private:
|
||||
Qt::WindowFlags m_flags;
|
||||
bool m_activeWindow;
|
||||
|
Loading…
Reference in New Issue
Block a user