read only property: activeWindow
This commit is contained in:
parent
3475f99f96
commit
86d4283ff9
@ -82,7 +82,8 @@ int DialogMargins::bottom() const
|
||||
|
||||
DialogProxy::DialogProxy(QObject *parent)
|
||||
: QObject(parent),
|
||||
m_declarativeItemContainer(0)
|
||||
m_declarativeItemContainer(0),
|
||||
m_activeWindow(false)
|
||||
{
|
||||
m_dialog = new Plasma::Dialog();
|
||||
m_margins = new DialogMargins(m_dialog, this);
|
||||
@ -225,6 +226,11 @@ int DialogProxy::height() const
|
||||
return m_dialog->size().height();
|
||||
}
|
||||
|
||||
bool DialogProxy::isActiveWindow() const
|
||||
{
|
||||
return m_activeWindow;
|
||||
}
|
||||
|
||||
int DialogProxy::windowFlags() const
|
||||
{
|
||||
return (int)m_dialog->windowFlags();
|
||||
@ -262,6 +268,12 @@ bool DialogProxy::eventFilter(QObject *watched, QEvent *event)
|
||||
if (re->oldSize().height() != re->size().height()) {
|
||||
emit heightChanged();
|
||||
}
|
||||
} else if (watched == m_dialog && event->type() == QEvent::WindowActivate) {
|
||||
m_activeWindow = true;
|
||||
emit activeWindowChanged();
|
||||
} else if (watched == m_dialog && event->type() == QEvent::WindowDeactivate) {
|
||||
m_activeWindow = false;
|
||||
emit activeWindowChanged();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ class DialogProxy : public QObject
|
||||
Q_PROPERTY(int height READ height NOTIFY heightChanged)
|
||||
Q_PROPERTY(int windowFlags READ windowFlags WRITE setWindowFlags)
|
||||
Q_PROPERTY(QObject *margins READ margins CONSTANT)
|
||||
Q_PROPERTY(bool activeWindow READ isActiveWindow NOTIFY activeWindowChanged)
|
||||
|
||||
public:
|
||||
enum WidgetAttribute {
|
||||
@ -104,6 +105,8 @@ public:
|
||||
int width() const;
|
||||
int height() const;
|
||||
|
||||
bool isActiveWindow() const;
|
||||
|
||||
//FIXME: passing an int is ugly
|
||||
int windowFlags() const;
|
||||
void setWindowFlags(const int);
|
||||
@ -122,6 +125,7 @@ Q_SIGNALS:
|
||||
void yChanged();
|
||||
void widthChanged();
|
||||
void heightChanged();
|
||||
void activeWindowChanged();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void syncMainItem();
|
||||
@ -135,6 +139,7 @@ private:
|
||||
DeclarativeItemContainer *m_declarativeItemContainer;
|
||||
QWeakPointer<QGraphicsObject> m_mainItem;
|
||||
DialogMargins *m_margins;
|
||||
bool m_activeWindow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user