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

41 lines
815 B
C++
Raw Normal View History

2022-01-06 19:29:19 +00:00
#include "StatusWindow.h"
StatusWindow::StatusWindow(QWindow* parent)
: QQuickWindow(parent)
, m_isFullScreen(false)
2022-01-06 19:29:19 +00:00
{
removeTitleBar();
connect(this, &QQuickWindow::windowStateChanged, [&](Qt::WindowState windowState) {
if(windowState == Qt::WindowNoState)
{
2022-01-06 19:29:19 +00:00
removeTitleBar();
m_isFullScreen = false;
emit isFullScreenChanged();
}
else if(windowState == Qt::WindowFullScreen)
{
2022-01-06 19:29:19 +00:00
m_isFullScreen = true;
emit isFullScreenChanged();
showTitleBar();
}
});
}
void StatusWindow::toggleFullScreen()
{
if(m_isFullScreen)
{
2022-01-06 19:29:19 +00:00
showNormal();
}
else
{
2022-01-06 19:29:19 +00:00
showFullScreen();
}
}
bool StatusWindow::isFullScreen() const
{
return m_isFullScreen;
2022-01-06 19:29:19 +00:00
}