diff --git a/src/declarativeimports/core/dialog.cpp b/src/declarativeimports/core/dialog.cpp index 7d77f5b32..0e7497b82 100644 --- a/src/declarativeimports/core/dialog.cpp +++ b/src/declarativeimports/core/dialog.cpp @@ -106,9 +106,7 @@ DialogProxy::DialogProxy(QQuickItem *parent) setColor(QColor(Qt::transparent)); setFlags(Qt::FramelessWindowHint); - //m_dialog = new QQuickWindow(); - m_margins = new DialogMargins(m_dialog, this); - //m_dialog->installEventFilter(this); + m_margins = new DialogMargins(this, this); m_flags = flags(); } @@ -155,13 +153,15 @@ void DialogProxy::setVisible(const bool visible) const QSize s = QSize(m_mainItem.data()->width(), m_mainItem.data()->height()); //resize(0,0); resize(s); + emit widthChanged(s.width()); + emit heightChanged(s.height()); + const QRect workArea(KWindowSystem::workArea()); if (!workArea.contains(geometry())) { - //FIXME -// m_dialog->move(qBound(workArea.left(), m_dialog->x(), workArea.right() - m_dialog->width()), -// qBound(workArea.top(), m_dialog->y(), workArea.bottom() - m_dialog->height()) -// ); + setPosition(qBound(workArea.left(), x(), workArea.right() - width()), + qBound(workArea.top(), y(), workArea.bottom() - height()) + ); } QQuickWindow::setVisible(visible); @@ -272,36 +272,6 @@ QPoint DialogProxy::popupPosition(QQuickItem *item, int alignment) } -// int DialogProxy::x() const -// { -// return geometry().topLeft().x(); -// } -// -// void DialogProxy::setX(int x) -// { -// //m_dialog->move(x, m_dialog->geometry().topLeft().y()); -// } -// -// int DialogProxy::y() const -// { -// return geometry().topLeft().y(); -// } -// -// void DialogProxy::setY(int y) -// { -// //m_dialog->move(m_dialog->geometry().topLeft().x(), y); -// } -// -// int DialogProxy::width() const -// { -// return size().width(); -// } -// -// int DialogProxy::height() const -// { -// return size().height(); -// } - bool DialogProxy::isActiveWindow() const { return m_activeWindow; diff --git a/src/declarativeimports/core/dialog.h b/src/declarativeimports/core/dialog.h index bac05d330..0e78d873e 100644 --- a/src/declarativeimports/core/dialog.h +++ b/src/declarativeimports/core/dialog.h @@ -105,27 +105,6 @@ class DialogProxy : public QQuickWindow */ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) - /** - * X position of the dialog window in screen coordinates. - */ - // Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) - - /** - * X position of the dialog window in screen coordinates. - */ - // Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) - //to set the size try to force doing so from the inner item - - /** - * Read only width of the dialog window. It depends from the width of the mainItem - */ - //Q_PROPERTY(int width READ width NOTIFY widthChanged) - - /** - * Read only height of the dialog window. It depends from the height of the mainItem - */ - //Q_PROPERTY(int height READ height NOTIFY heightChanged) - /** * Window flags of the Dialog window */ @@ -168,15 +147,6 @@ public: bool isVisible() const; void setVisible(const bool visible); -// int x() const; -// void setX(int x); -// -// int y() const; -// void setY(int y); -// -// int width() const; -// int height() const; - bool isActiveWindow() const; /** @@ -231,7 +201,6 @@ protected: void resizeEvent(QResizeEvent *re); private: - QQuickWindow *m_dialog; Qt::WindowFlags m_flags; QQuickItem *m_declarativeItemContainer; QWeakPointer m_mainItem;