fix: show status window in center
This commit is contained in:
parent
d62b8ee921
commit
0d4916d033
|
@ -2,6 +2,7 @@
|
||||||
#define STATUSWINDOW_H
|
#define STATUSWINDOW_H
|
||||||
|
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
class StatusWindow: public QQuickWindow
|
class StatusWindow: public QQuickWindow
|
||||||
{
|
{
|
||||||
|
@ -17,6 +18,13 @@ public:
|
||||||
|
|
||||||
bool isFullScreen() const;
|
bool isFullScreen() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void updatePosition() {
|
||||||
|
auto point = QPoint(screen()->geometry().center().x() - geometry().width() / 2, screen()->geometry().center().y() - geometry().height() / 2);
|
||||||
|
if (point != this->position()) {
|
||||||
|
this->setPosition(point);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void isFullScreenChanged();
|
void isFullScreenChanged();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue