bind the dialog's window flags

This commit is contained in:
Marco Martin 2011-03-21 21:38:48 +01:00
parent 19ad72af78
commit d7d08c46ef
2 changed files with 22 additions and 0 deletions

View File

@ -81,6 +81,7 @@ DialogProxy::DialogProxy(QObject *parent)
: QObject(parent)
{
m_dialog = new Plasma::Dialog();
m_flags = m_dialog->windowFlags();
}
DialogProxy::~DialogProxy()
@ -160,6 +161,10 @@ void DialogProxy::setVisible(const bool visible)
{
if (m_dialog->isVisible() != visible) {
m_dialog->setVisible(visible);
if (visible) {kWarning()<<"AAAAAAAAA"<<m_flags;
m_dialog->setWindowFlags(m_flags);
m_dialog->raise();
}
emit visibleChanged();
}
}
@ -195,6 +200,17 @@ void DialogProxy::setY(int y)
m_dialog->move(m_dialog->pos().x(), y);
}
int DialogProxy::windowFlags() const
{
return (int)m_dialog->windowFlags();
}
void DialogProxy::setWindowFlags(const int flags)
{
m_flags = (Qt::WindowFlags)flags;
m_dialog->setWindowFlags((Qt::WindowFlags)flags);
}
bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
{
if (watched == m_dialog && event->type() == QEvent::Move) {

View File

@ -40,6 +40,7 @@ class DialogProxy : public QObject
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
public:
enum WidgetAttribute {
@ -61,6 +62,10 @@ public:
int y() const;
void setY(int y);
//FIXME: passing an int is ugly
int windowFlags() const;
void setWindowFlags(const int);
Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
//FIXME:: Qt::WidgetAttribute should be already
Q_INVOKABLE void setAttribute(int attribute, bool on);
@ -78,6 +83,7 @@ protected:
private:
Plasma::Dialog *m_dialog;
Qt::WindowFlags m_flags;
DeclarativeItemContainer *m_declarativeItemContainer;
QWeakPointer<QGraphicsObject> m_mainItem;
};