status-desktop/src-cpp/dotherside/StatusWindow.h

41 lines
859 B
C
Raw Normal View History

2022-01-06 19:29:19 +00:00
#pragma once
#include <QQuickWindow>
#include <QScreen>
class StatusWindow : public QQuickWindow
2022-01-06 19:29:19 +00:00
{
Q_OBJECT
Q_PROPERTY(bool isFullScreen READ isFullScreen NOTIFY isFullScreenChanged)
public:
explicit StatusWindow(QWindow* parent = nullptr);
2022-01-06 19:29:19 +00:00
Q_INVOKABLE void toggleFullScreen();
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())
{
2022-01-06 19:29:19 +00:00
this->setPosition(point);
}
}
signals:
void isFullScreenChanged();
void secondInstanceDetected();
private:
void removeTitleBar();
void showTitleBar();
void initCallbacks();
private:
bool m_isFullScreen;
};