restore isactivewindow
This commit is contained in:
parent
7ce2d0f7d6
commit
a1507092a0
@ -36,8 +36,6 @@
|
|||||||
//#include <Plasma/WindowEffects>
|
//#include <Plasma/WindowEffects>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
int DialogProxy::offscreenX = 0;
|
|
||||||
int DialogProxy::offscreenY = 0;
|
|
||||||
|
|
||||||
DialogMargins::DialogMargins(QQuickWindow *dialog, QObject *parent)
|
DialogMargins::DialogMargins(QQuickWindow *dialog, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
@ -175,10 +173,9 @@ bool DialogProxy::isVisible() const
|
|||||||
|
|
||||||
void DialogProxy::setVisible(const bool visible)
|
void DialogProxy::setVisible(const bool visible)
|
||||||
{
|
{
|
||||||
if (isVisible() != visible) {
|
if (visible) {
|
||||||
syncToMainItemSize();
|
syncToMainItemSize();
|
||||||
|
|
||||||
|
|
||||||
const QRect workArea(KWindowSystem::workArea());
|
const QRect workArea(KWindowSystem::workArea());
|
||||||
if (!workArea.contains(geometry())) {
|
if (!workArea.contains(geometry())) {
|
||||||
setPosition(qBound(workArea.left(), x(), workArea.right() - width()),
|
setPosition(qBound(workArea.left(), x(), workArea.right() - width()),
|
||||||
@ -186,11 +183,9 @@ void DialogProxy::setVisible(const bool visible)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
QQuickWindow::setVisible(visible);
|
|
||||||
if (visible) {
|
|
||||||
raise();
|
raise();
|
||||||
}
|
}
|
||||||
}
|
QQuickWindow::setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint DialogProxy::popupPosition(QQuickItem *item, int alignment)
|
QPoint DialogProxy::popupPosition(QQuickItem *item, int alignment)
|
||||||
@ -424,5 +419,19 @@ void DialogProxy::setAttribute(int attribute, bool on)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialogProxy::focusInEvent(QFocusEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev)
|
||||||
|
m_activeWindow = true;
|
||||||
|
emit activeWindowChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DialogProxy::focusOutEvent(QFocusEvent *ev)
|
||||||
|
{
|
||||||
|
Q_UNUSED(ev)
|
||||||
|
m_activeWindow = false;
|
||||||
|
emit activeWindowChanged();
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_dialog.cpp"
|
#include "moc_dialog.cpp"
|
||||||
|
|
||||||
|
@ -190,10 +190,6 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void mainItemChanged();
|
void mainItemChanged();
|
||||||
void visibleChanged();
|
void visibleChanged();
|
||||||
// void xChanged();
|
|
||||||
// void yChanged();
|
|
||||||
// void widthChanged();
|
|
||||||
// void heightChanged();
|
|
||||||
void activeWindowChanged();
|
void activeWindowChanged();
|
||||||
void locationChanged();
|
void locationChanged();
|
||||||
|
|
||||||
@ -203,17 +199,16 @@ private Q_SLOTS:
|
|||||||
protected:
|
protected:
|
||||||
// bool eventFilter(QObject *watched, QEvent *event);
|
// bool eventFilter(QObject *watched, QEvent *event);
|
||||||
void resizeEvent(QResizeEvent *re);
|
void resizeEvent(QResizeEvent *re);
|
||||||
|
void focusInEvent(QFocusEvent *ev);
|
||||||
|
void focusOutEvent(QFocusEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Qt::WindowFlags m_flags;
|
Qt::WindowFlags m_flags;
|
||||||
QQuickItem *m_declarativeItemContainer;
|
|
||||||
QTimer *m_syncTimer;
|
QTimer *m_syncTimer;
|
||||||
QWeakPointer<QQuickItem> m_mainItem;
|
QWeakPointer<QQuickItem> m_mainItem;
|
||||||
DialogMargins *m_margins;
|
DialogMargins *m_margins;
|
||||||
bool m_activeWindow;
|
bool m_activeWindow;
|
||||||
Plasma::Location m_location;
|
Plasma::Location m_location;
|
||||||
static int offscreenX;
|
|
||||||
static int offscreenY;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user