feat: initiale Projektstruktur nach Framework 1.7
This commit is contained in:
+127
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* UNIVERSELLER QML Haupt-Template für Ubuntu Touch Apps
|
||||
* Basierend auf metime und Referenz-App (Version 1.7)
|
||||
*
|
||||
* VERWENDUNG:
|
||||
* 1. Kopiere diese Datei nach qml/Main.qml
|
||||
* 2. Ersetze '<app-name>' mit deinem App-Namen
|
||||
* 3. Passe Titel und UI-Elemente an
|
||||
* 4. Füge deine Python-Modul-Imports hinzu
|
||||
*
|
||||
* WICHTIG (1.7):
|
||||
* - Immer QtQuick 2.7 und Lomiri.Components 1.3 verwenden
|
||||
* - QtQuick.Layouts 1.3 für Layouts importieren
|
||||
* - fontSize als STRING verwenden ("large", "x-large", "medium")
|
||||
* - PageFooter existiert NICHT → als Label implementieren
|
||||
* - PyOtherSide mit Qt.resolvedUrl("../src") einbinden
|
||||
*/
|
||||
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Layouts 1.3 // ✅ NEU 1.7: Notwendig für ColumnLayout!
|
||||
import Lomiri.Components 1.3
|
||||
import Lomiri.Components.Popups 1.3
|
||||
import io.thp.pyotherside 1.4
|
||||
|
||||
MainView {
|
||||
id: root
|
||||
objectName: 'mainView'
|
||||
|
||||
// APP META-DATEN (Anpassen!)
|
||||
applicationName: '<app-name>.darklithium'
|
||||
width: units.gu(45)
|
||||
height: units.gu(75)
|
||||
theme.name: "Lomiri.Components.Themes.SuruDark"
|
||||
|
||||
// ====================================================================
|
||||
// PYTHON-MODUL (STANDARD 1.7)
|
||||
// ====================================================================
|
||||
|
||||
Python {
|
||||
id: py
|
||||
Component.onCompleted: {
|
||||
// ✅ STANDARD 1.7: Qt.resolvedUrl funktioniert!
|
||||
addImportPath(Qt.resolvedUrl("../src"));
|
||||
|
||||
importModule('<app-name>', function() {
|
||||
console.log("Python-Modul <app-name> geladen");
|
||||
// Initialisierung nach erfolgreicher Modul-Ladung
|
||||
statusLabel.text = py.call_sync("<app-name>.get_status_text", []);
|
||||
footerLabel.text = py.call_sync("<app-name>.get_platform", []);
|
||||
});
|
||||
}
|
||||
onError: {
|
||||
console.log('Python Fehler: ' + traceback);
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// HAUPTSSeITE (Anpassen nach Bedarf)
|
||||
// ====================================================================
|
||||
|
||||
Page {
|
||||
id: mainPage
|
||||
anchors.fill: parent
|
||||
|
||||
// Header
|
||||
header: PageHeader {
|
||||
title: "<App-Name>" // App-Name anpassen
|
||||
}
|
||||
|
||||
// Hauptinhalt (ColumnLayout für vertikale Anordnung)
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
spacing: units.gu(2) // 2 GU Abstand zwischen Elementen
|
||||
|
||||
// Status-Label (optional)
|
||||
Label {
|
||||
id: statusLabel
|
||||
text: "Lade..."
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
fontSize: "large" // ✅ NEU 1.7: String-Wert!
|
||||
}
|
||||
|
||||
// Hauptinhalt hier einfügen
|
||||
// Beispiel: Textfeld
|
||||
Label {
|
||||
id: contentLabel
|
||||
text: "Hier steht Beispieltext"
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
fontSize: "x-large" // ✅ NEU 1.7: String-Wert!
|
||||
}
|
||||
|
||||
// Beispiel: Button
|
||||
Button {
|
||||
id: testButton
|
||||
text: "Test Button"
|
||||
Layout.fillWidth: false
|
||||
Layout.preferredWidth: units.gu(20) // 200 DP (Touch-optimiert!)
|
||||
Layout.preferredHeight: units.gu(8) // 80 DP
|
||||
|
||||
onClicked: {
|
||||
if (py) {
|
||||
py.call("<app-name>.on_button_click", [], function() {
|
||||
contentLabel.text = py.call_sync("<app-name>.get_content_text", []);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================================
|
||||
// FOOTER (Workaround für Lomiri.Components 1.3)
|
||||
// ================================================================
|
||||
// ⚠️ WICHTIG: PageFooter existiert NICHT in Lomiri.Components 1.3!
|
||||
Label {
|
||||
id: footerLabel
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.bottomMargin: units.gu(2)
|
||||
text: "Plattform: ?"
|
||||
fontSize: "medium" // ✅ NEU 1.7: String-Wert!
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user