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
|
//Can't just connect to start() since it can't resolve the overload
|
||||||
connect(this, &QWindow::xChanged, [=](){m_syncTimer->start();});
|
connect(this, &QWindow::xChanged, [=](){m_syncTimer->start();});
|
||||||
connect(this, &QWindow::yChanged, [=](){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
|
//HACK: this property is invoked due to the initialization that gets done to contentItem() in the getter
|
||||||
property("data");
|
property("data");
|
||||||
//Create the FrameSvg background.
|
//Create the FrameSvg background.
|
||||||
@ -120,7 +120,6 @@ void DialogProxy::setVisualParent(QQuickItem *visualParent)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_visualParent = visualParent;
|
m_visualParent = visualParent;
|
||||||
emit visualParentChanged();
|
emit visualParentChanged();
|
||||||
if (visualParent && isVisible()) {
|
if (visualParent && isVisible()) {
|
||||||
@ -128,13 +127,9 @@ void DialogProxy::setVisualParent(QQuickItem *visualParent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogProxy::isVisible() const
|
void DialogProxy::onVisibleChanged()
|
||||||
{
|
|
||||||
return QQuickWindow::isVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DialogProxy::setVisible(const bool visible)
|
|
||||||
{
|
{
|
||||||
|
const bool visible = isVisible();
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (location() == Plasma::Types::FullScreen) {
|
if (location() == Plasma::Types::FullScreen) {
|
||||||
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
|
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::NoBorder);
|
||||||
@ -174,7 +169,6 @@ void DialogProxy::setVisible(const bool visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
KWindowEffects::slideWindow(winId(), slideLocation, -1);
|
KWindowEffects::slideWindow(winId(), slideLocation, -1);
|
||||||
QQuickWindow::setVisible(visible);
|
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
raise();
|
raise();
|
||||||
@ -188,7 +182,6 @@ void DialogProxy::setVisible(const bool visible)
|
|||||||
}
|
}
|
||||||
setFlags(Qt::FramelessWindowHint|m_flags);
|
setFlags(Qt::FramelessWindowHint|m_flags);
|
||||||
}
|
}
|
||||||
emit visibleChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint DialogProxy::popupPosition(QQuickItem *item, Qt::AlignmentFlag alignment)
|
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)
|
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
|
* Window flags of the Dialog window
|
||||||
*/
|
*/
|
||||||
@ -115,9 +110,6 @@ public:
|
|||||||
QQuickItem *visualParent() const;
|
QQuickItem *visualParent() const;
|
||||||
void setVisualParent(QQuickItem *visualParent);
|
void setVisualParent(QQuickItem *visualParent);
|
||||||
|
|
||||||
bool isVisible() const;
|
|
||||||
void setVisible(const bool visible);
|
|
||||||
|
|
||||||
bool isActiveWindow() const;
|
bool isActiveWindow() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,7 +141,6 @@ public:
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void mainItemChanged();
|
void mainItemChanged();
|
||||||
void visibleChanged();
|
|
||||||
void activeWindowChanged();
|
void activeWindowChanged();
|
||||||
void locationChanged();
|
void locationChanged();
|
||||||
void visualParentChanged();
|
void visualParentChanged();
|
||||||
@ -176,6 +167,8 @@ protected:
|
|||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void syncBorders();
|
void syncBorders();
|
||||||
|
|
||||||
|
void onVisibleChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt::WindowFlags m_flags;
|
Qt::WindowFlags m_flags;
|
||||||
bool m_activeWindow;
|
bool m_activeWindow;
|
||||||
|
Loading…
Reference in New Issue
Block a user