loader eingefügt
This commit is contained in:
@@ -19,12 +19,12 @@ import QtQuick.Controls.Material
|
|||||||
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
ApplicationWindow
|
Item
|
||||||
{
|
{
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("PYQCRM - Einstellungen")
|
|
||||||
Material.theme: Material.Dark
|
Material.theme: Material.Dark
|
||||||
Material.accent: Material.BlueGrey
|
Material.accent: Material.BlueGrey
|
||||||
|
|
||||||
22
gui/main.qml
22
gui/main.qml
@@ -1,9 +1,25 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Window
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Controls.Material
|
||||||
|
|
||||||
Window {
|
|
||||||
|
ApplicationWindow
|
||||||
|
{
|
||||||
|
id: window
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
visible: true
|
visible: true
|
||||||
title: qsTr("Hello World")
|
Material.theme: Material.Dark
|
||||||
|
Material.accent: Material.BlueGrey
|
||||||
|
title: bad_config? "Pyqcrm Einstellungen":"Pyqcrm"
|
||||||
|
Loader
|
||||||
|
{
|
||||||
|
id: mainWindow
|
||||||
|
|
||||||
|
|
||||||
|
source: bad_config? "firststart.qml":"start.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
13
gui/start.qml
Normal file
13
gui/start.qml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
window.width: 1080
|
||||||
|
parent.height: 1920
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
31
main.py
31
main.py
@@ -24,22 +24,29 @@ from lib.ConfigLoader import ConfigLoader
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QGuiApplication(sys.argv)
|
app = QGuiApplication(sys.argv)
|
||||||
engine = QQmlApplicationEngine()
|
engine = QQmlApplicationEngine()
|
||||||
|
bad_config = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
||||||
|
|
||||||
config = ConfigLoader()
|
config = ConfigLoader()
|
||||||
|
|
||||||
|
|
||||||
# if config.getConfig():
|
if not config.getConfig():
|
||||||
try:
|
|
||||||
print (config.getConfig()['database']['server'])
|
bad_config = False
|
||||||
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
# try:
|
||||||
engine.load(qml_file)
|
# app_config = config.getConfig()
|
||||||
except:
|
# if not app_config:
|
||||||
print("Ausnahme")
|
|
||||||
qml_file = Path(__file__).resolve().parent / "gui/Programmeinstellungen.qml"
|
|
||||||
engine.rootContext().setContextProperty("config", config)
|
# except Exception as i:
|
||||||
engine.load(qml_file)
|
|
||||||
# else:
|
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||||
# config.createConfig()
|
engine.rootContext().setContextProperty("config", config)
|
||||||
|
engine.load(qml_file)
|
||||||
|
|
||||||
|
|
||||||
if not engine.rootObjects():
|
if not engine.rootObjects():
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"gui/Programmeinstellungen.qml",
|
"gui/firststart.qml",
|
||||||
"lib/ConfigLoader.py",
|
"lib/ConfigLoader.py",
|
||||||
"lib/__init__.py",
|
"lib/__init__.py",
|
||||||
"main.py",
|
"main.py",
|
||||||
"gui/main.qml"
|
"gui/main.qml",
|
||||||
|
"gui/start.qml"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
2
qtlogging.ini
Normal file
2
qtlogging.ini
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[Rules]
|
||||||
|
*.debug=true
|
||||||
Reference in New Issue
Block a user