bind the dialog's window flags
This commit is contained in:
parent
19ad72af78
commit
d7d08c46ef
|
@ -81,6 +81,7 @@ DialogProxy::DialogProxy(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
m_dialog = new Plasma::Dialog();
|
m_dialog = new Plasma::Dialog();
|
||||||
|
m_flags = m_dialog->windowFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogProxy::~DialogProxy()
|
DialogProxy::~DialogProxy()
|
||||||
|
@ -160,6 +161,10 @@ void DialogProxy::setVisible(const bool visible)
|
||||||
{
|
{
|
||||||
if (m_dialog->isVisible() != visible) {
|
if (m_dialog->isVisible() != visible) {
|
||||||
m_dialog->setVisible(visible);
|
m_dialog->setVisible(visible);
|
||||||
|
if (visible) {kWarning()<<"AAAAAAAAA"<<m_flags;
|
||||||
|
m_dialog->setWindowFlags(m_flags);
|
||||||
|
m_dialog->raise();
|
||||||
|
}
|
||||||
emit visibleChanged();
|
emit visibleChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -195,6 +200,17 @@ void DialogProxy::setY(int y)
|
||||||
m_dialog->move(m_dialog->pos().x(), 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)
|
bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
|
||||||
{
|
{
|
||||||
if (watched == m_dialog && event->type() == QEvent::Move) {
|
if (watched == m_dialog && event->type() == QEvent::Move) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ class DialogProxy : public QObject
|
||||||
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
||||||
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
|
Q_PROPERTY(int x READ x WRITE setX NOTIFY positionChanged)
|
||||||
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
|
Q_PROPERTY(int y READ y WRITE setY NOTIFY positionChanged)
|
||||||
|
Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum WidgetAttribute {
|
enum WidgetAttribute {
|
||||||
|
@ -61,6 +62,10 @@ public:
|
||||||
int y() const;
|
int y() const;
|
||||||
void setY(int y);
|
void setY(int y);
|
||||||
|
|
||||||
|
//FIXME: passing an int is ugly
|
||||||
|
int windowFlags() const;
|
||||||
|
void setWindowFlags(const int);
|
||||||
|
|
||||||
Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
|
Q_INVOKABLE QPoint popupPosition(QGraphicsObject *item) const;
|
||||||
//FIXME:: Qt::WidgetAttribute should be already
|
//FIXME:: Qt::WidgetAttribute should be already
|
||||||
Q_INVOKABLE void setAttribute(int attribute, bool on);
|
Q_INVOKABLE void setAttribute(int attribute, bool on);
|
||||||
|
@ -78,6 +83,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Plasma::Dialog *m_dialog;
|
Plasma::Dialog *m_dialog;
|
||||||
|
Qt::WindowFlags m_flags;
|
||||||
DeclarativeItemContainer *m_declarativeItemContainer;
|
DeclarativeItemContainer *m_declarativeItemContainer;
|
||||||
QWeakPointer<QGraphicsObject> m_mainItem;
|
QWeakPointer<QGraphicsObject> m_mainItem;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user