diff --git a/sandbox/sandbox.pro b/sandbox/sandbox.pro index 45d95690..f9823b5c 100644 --- a/sandbox/sandbox.pro +++ b/sandbox/sandbox.pro @@ -11,6 +11,9 @@ SOURCES += \ main.cpp \ sandboxapp.cpp +OBJECTIVE_SOURCES += \ + sandboxapp_mac.mm + RESOURCES += qml.qrc DESTDIR = $$PWD/bin diff --git a/sandbox/sandboxapp.cpp b/sandbox/sandboxapp.cpp index 43db4827..cc4eeeed 100644 --- a/sandbox/sandboxapp.cpp +++ b/sandbox/sandboxapp.cpp @@ -1,7 +1,7 @@ #include "sandboxapp.h" #include - +#include #include SandboxApp::SandboxApp(int &argc, char **argv) @@ -25,12 +25,23 @@ void SandboxApp::startEngine() QCoreApplication::exit(-1); }, Qt::QueuedConnection); m_engine.load(url); + + QWindow *rootWindow = qobject_cast(m_engine.rootObjects().at(0)); + if (rootWindow) { + removeTitleBar(rootWindow->winId()); + } else { + qDebug() << "Window doesn't exist"; + } } void SandboxApp::restartEngine() { const QUrl url(applicationDirPath() + "/../main.qml"); - m_engine.rootObjects().at(0)->deleteLater(); + QWindow *rootWindow = qobject_cast(m_engine.rootObjects().at(0)); + if (rootWindow) { + + rootWindow->close(); + } m_engine.clearComponentCache(); m_engine.load(url); } diff --git a/sandbox/sandboxapp.h b/sandbox/sandboxapp.h index 8589baab..834d7045 100644 --- a/sandbox/sandboxapp.h +++ b/sandbox/sandboxapp.h @@ -13,6 +13,8 @@ public: void startEngine(); + void removeTitleBar(WId wid); + public slots: void restartEngine(); diff --git a/sandbox/sandboxapp_mac.mm b/sandbox/sandboxapp_mac.mm new file mode 100644 index 00000000..f4b5c608 --- /dev/null +++ b/sandbox/sandboxapp_mac.mm @@ -0,0 +1,18 @@ +#include "sandboxapp.h" + +#include + +#include +#include +#include +#include + +void SandboxApp::removeTitleBar(WId wid) +{ + NSView *nsView = reinterpret_cast(wid); + NSWindow *window = [nsView window]; + + window.titlebarAppearsTransparent = true; + window.titleVisibility = NSWindowTitleHidden; + window.styleMask |= NSWindowStyleMaskFullSizeContentView; +} diff --git a/src/StatusQ/Core/Theme/Theme.qml b/src/StatusQ/Core/Theme/Theme.qml index cb7f3fa3..1b142cad 100644 --- a/src/StatusQ/Core/Theme/Theme.qml +++ b/src/StatusQ/Core/Theme/Theme.qml @@ -4,6 +4,9 @@ import QtQuick 2.13 QtObject { id: appTheme + // Replace it with: + // property QtObject palette: StatusLightTheme {} + // for reloading property ThemePalette palette: StatusLightTheme {} function setTheme(theme) {