feat: use custom window without titlebar

This commit is contained in:
B.Melnik 2021-05-19 17:03:14 +03:00 committed by Iuri Matias
parent 97464a2303
commit 7b62dbbc33
1 changed files with 48 additions and 42 deletions

View File

@ -9,13 +9,15 @@ import QtQml 2.13
import QtQuick.Window 2.0
import QtQuick.Controls.Universal 2.12
import DotherSide 0.1
import "./onboarding"
import "./app"
import "./sounds"
import "./shared"
import "./imports"
ApplicationWindow {
StatusWindow {
property bool hasAccounts: !!loginModel.rowCount()
property bool removeMnemonicAfterLogin: false
property alias dragAndDrop: dragTarget
@ -85,6 +87,9 @@ ApplicationWindow {
}
}
//! Workaround for custom QQuickWindow
Connections {
target: applicationWindow
onClosing: {
if (loader.sourceComponent == login) {
applicationWindow.visible = false;
@ -100,6 +105,16 @@ ApplicationWindow {
}
}
onActiveChanged: {
if (active && currentlyHasANotification) {
currentlyHasANotification = false
// QML doesn't have a function to hide notifications, but this does the trick
systemTray.hide()
systemTray.show()
}
}
}
Component.onCompleted: {
Style.changeTheme(globalSettings.theme)
setX(Qt.application.screens[0].width / 2 - width / 2);
@ -110,15 +125,6 @@ ApplicationWindow {
property bool currentlyHasANotification: false
onActiveChanged: {
if (active && currentlyHasANotification) {
currentlyHasANotification = false
// QML doesn't have a function to hide notifications, but this does the trick
systemTray.hide()
systemTray.show()
}
}
SystemTrayIcon {
id: systemTray
visible: true