loader eingefügt
This commit is contained in:
@@ -19,12 +19,12 @@ import QtQuick.Controls.Material
|
||||
|
||||
// }
|
||||
|
||||
ApplicationWindow
|
||||
Item
|
||||
{
|
||||
width: 640
|
||||
height: 480
|
||||
visible: true
|
||||
title: qsTr("PYQCRM - Einstellungen")
|
||||
|
||||
Material.theme: Material.Dark
|
||||
Material.accent: Material.BlueGrey
|
||||
|
||||
22
gui/main.qml
22
gui/main.qml
@@ -1,9 +1,25 @@
|
||||
import QtQuick
|
||||
import QtQuick.Window
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
|
||||
Window {
|
||||
|
||||
ApplicationWindow
|
||||
{
|
||||
id: window
|
||||
width: 640
|
||||
height: 480
|
||||
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
|
||||
|
||||
|
||||
}
|
||||
27
main.py
27
main.py
@@ -24,22 +24,29 @@ from lib.ConfigLoader import ConfigLoader
|
||||
if __name__ == "__main__":
|
||||
app = QGuiApplication(sys.argv)
|
||||
engine = QQmlApplicationEngine()
|
||||
bad_config = False
|
||||
|
||||
|
||||
|
||||
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
||||
|
||||
config = ConfigLoader()
|
||||
|
||||
|
||||
# if config.getConfig():
|
||||
try:
|
||||
print (config.getConfig()['database']['server'])
|
||||
qml_file = Path(__file__).resolve().parent / "gui/main.qml"
|
||||
engine.load(qml_file)
|
||||
except:
|
||||
print("Ausnahme")
|
||||
qml_file = Path(__file__).resolve().parent / "gui/Programmeinstellungen.qml"
|
||||
if not config.getConfig():
|
||||
|
||||
bad_config = False
|
||||
# try:
|
||||
# app_config = config.getConfig()
|
||||
# if not app_config:
|
||||
|
||||
|
||||
# except Exception as i:
|
||||
|
||||
engine.rootContext().setContextProperty("bad_config", bad_config) # print(f"Fehler: {i}")
|
||||
engine.rootContext().setContextProperty("config", config)
|
||||
engine.load(qml_file)
|
||||
# else:
|
||||
# config.createConfig()
|
||||
|
||||
|
||||
if not engine.rootObjects():
|
||||
sys.exit(-1)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
{
|
||||
"files": [
|
||||
"gui/Programmeinstellungen.qml",
|
||||
"gui/firststart.qml",
|
||||
"lib/ConfigLoader.py",
|
||||
"lib/__init__.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