diff --git a/gui/CustomerTables.qml b/gui/CustomerTables.qml index 27d6064..128aa65 100644 --- a/gui/CustomerTables.qml +++ b/gui/CustomerTables.qml @@ -5,9 +5,8 @@ import Qt.labs.qmlmodels Item { - - property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"] + SearchBar { id:searchBar @@ -16,11 +15,6 @@ Item { ColumnLayout { - // SearchBar - // { - // id:searchBar - // anchors.margins: 9 - // } anchors { @@ -30,6 +24,7 @@ Item { right: parent.right } + RowLayout { // Layout.fillHeight: true @@ -59,6 +54,7 @@ Item { } } + HorizontalHeaderView { id: horizontalHeader @@ -67,44 +63,43 @@ Item { syncView: testTable } + TableView { id: testTable Layout.fillHeight: true Layout.fillWidth: true - columnSpacing: 1 rowSpacing: 2 - - model: dbm + delegate:Item { implicitWidth: 200 implicitHeight: 25 - Text - { - Layout.fillWidth: true - text: model.display - - } - MouseArea - { - anchors.fill: parent - onClicked: dbm.onRowClicked(row) - } - } + Text + { + Layout.fillWidth: true + text: model.display + } + MouseArea + { + anchors.fill: parent + onClicked: dbm.onRowClicked(row) + } + } } - Item { + Item + { Layout.fillHeight: true Layout.fillWidth: true } -} + } } diff --git a/gui/SearchBar.qml b/gui/SearchBar.qml index b4e8c76..e3e5ee4 100644 --- a/gui/SearchBar.qml +++ b/gui/SearchBar.qml @@ -7,6 +7,7 @@ Item { id: searchBar height: 30 + TextField { id: searchField @@ -15,7 +16,6 @@ Item rightPadding: 3 width: 300 - Button { icon.source: "../images/search.svg" @@ -23,9 +23,9 @@ Item anchors.right: parent.right height: parent.height flat: true - } } + Button { id: filterBtn @@ -38,6 +38,7 @@ Item } + Popup { id: filterPopup @@ -50,7 +51,6 @@ Item closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent contentItem: Item { - ColumnLayout { anchors.fill: parent @@ -59,6 +59,7 @@ Item Repeater { model: availableFilters + CheckBox { text: model.modelData @@ -72,13 +73,11 @@ Item } } } + function setFilter(filter,activated) { console.log(filter) console.log(activated) } - - - } diff --git a/gui/TopBar.qml b/gui/TopBar.qml index 970affa..2336fc5 100644 --- a/gui/TopBar.qml +++ b/gui/TopBar.qml @@ -2,99 +2,85 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts - - - - - - RowLayout +RowLayout +{ + id: topBar + spacing: 0 + height: 35 + width: parent.width + anchors { - id: topBar - spacing: 0 - height: 35 - width: parent.width + top: parent.top + left: parent.left + } - - anchors + Button + { + id: dashBoard + flat: true + text: qsTr("Dashboard") + implicitWidth: dashBoard.implicitContentWidth + 10 + onClicked: { - top: parent.top - left: parent.left - - - } - - Button - { - id: dashBoard - flat: true - text: qsTr("Dashboard") - implicitWidth: dashBoard.implicitContentWidth + 10 - onClicked: - { - appLoader.source = "Dashboard.qml" - } - - } - - Button - { - id: kunden - flat: true - text: qsTr("Kunden") - implicitWidth: kunden.implicitContentWidth + 10 - onClicked: - { - appLoader.source = "CustomerTables.qml" - } - } - - Button - { - id: objekt - flat: true - text: qsTr("Objekt") - implicitWidth: objekt.implicitContentWidth + 10 - } - - Button - { - id: mitarbeiter - flat: true - text: qsTr("Mitarbeiter") - implicitWidth: mitarbeiter.implicitContentWidth + 10 - } - - Button - { - id: abrechnung - flat: true - text: qsTr("Abrechnung") - implicitWidth: abrechnung.implicitContentWidth + 10 - } - - Item - { - id: hspacer - Layout.fillWidth: true - } - - Button - { - id: atajos - icon.source: "../images/menu.svg" - icon.color: "red" - flat: true - Layout.rightMargin: 9 - - + appLoader.source = "Dashboard.qml" } } + Button + { + id: kunden + flat: true + text: qsTr("Kunden") + implicitWidth: kunden.implicitContentWidth + 10 + onClicked: + { + appLoader.source = "CustomerTables.qml" + } + } + + Button + { + id: objekt + flat: true + text: qsTr("Objekt") + implicitWidth: objekt.implicitContentWidth + 10 + } + + Button + { + id: mitarbeiter + flat: true + text: qsTr("Mitarbeiter") + implicitWidth: mitarbeiter.implicitContentWidth + 10 + } + + Button + { + id: abrechnung + flat: true + text: qsTr("Abrechnung") + implicitWidth: abrechnung.implicitContentWidth + 10 + } + + Item + { + id: hspacer + Layout.fillWidth: true + } + + Button + { + id: atajos + icon.source: "../images/menu.svg" + icon.color: "red" + flat: true + Layout.rightMargin: 9 + } - +} diff --git a/gui/firststart.qml b/gui/firststart.qml index 4b946c6..823c1da 100644 --- a/gui/firststart.qml +++ b/gui/firststart.qml @@ -29,6 +29,7 @@ Item { id: bar Layout.fillWidth: true + TabButton { text: qsTr("Benutzer erstellen") @@ -41,6 +42,7 @@ Item text: qsTr("Datenbank einrichten") } + onCurrentIndexChanged: { submitBtn.text = currentIndex === 0? "Weiter" : "Speichern" @@ -69,6 +71,7 @@ Item anchors.fill: parent Layout.margins: 9 property string name: "pyqcrm" + Label { text: qsTr("Benutzername:") diff --git a/gui/main.qml b/gui/main.qml index 1cf3ae3..b635056 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -9,9 +9,8 @@ ApplicationWindow width: Screen.width * .6 height: Screen.height * .6 visible: true - - title: "PYQCRM" + TopBar { @@ -24,10 +23,12 @@ ApplicationWindow visible: bad_config? false: true } + Item { id: mainView } + Loader { id: appLoader @@ -40,11 +41,9 @@ ApplicationWindow topMargin: 0 rightMargin: 9 leftMargin: 9 - - } + source: bad_config? "firststart.qml": "Dashboard.qml" property alias window: appWindow } - } diff --git a/gui/test.qml b/gui/test.qml index 3d97b7c..810c6eb 100644 --- a/gui/test.qml +++ b/gui/test.qml @@ -4,116 +4,135 @@ import Qt.labs.qmlmodels - TableView { - id: testTable - anchors.fill: parent - columnSpacing: 10 - rowSpacing: 2 - //boundsBehavior: Flickable.StopAtBounds +TableView +{ + id: testTable + anchors.fill: parent + columnSpacing: 10 + rowSpacing: 2 + //boundsBehavior: Flickable.StopAtBounds - model: TableModel { - TableModelColumn { display: "checked" } - TableModelColumn { display: "amount" } - TableModelColumn { display: "fruitType" } - TableModelColumn { display: "fruitName" } - TableModelColumn { display: "fruitPrice" } + model: TableModel + { + TableModelColumn { display: "checked" } + TableModelColumn { display: "amount" } + TableModelColumn { display: "fruitType" } + TableModelColumn { display: "fruitName" } + TableModelColumn { display: "fruitPrice" } - rows: [ - { - checked: "checked", - amount: "amount", - fruitType: "Fruittype", - fruitName: "fruitName", - fruitPrice: "Price" - }, - { - checked: true, - amount: 2, - fruitType: "Fruittype", - fruitName: "blabla", - fruitPrice: 1.50 - }, + rows: + [ + { + checked: "checked", + amount: "amount", + fruitType: "Fruittype", + fruitName: "fruitName", + fruitPrice: "Price" + }, - { + { + checked: true, + amount: 2, + fruitType: "Fruittype", + fruitName: "blabla", + fruitPrice: 1.50 + }, - checked: true, - amount: 1, - fruitType: "Apple", - fruitName: "Granny Smith", - fruitPrice: 1.50 - }, - { - checked: "true", - amount: 4, - fruitType: "Orange", - fruitName: "Navel", - fruitPrice: 2.50 - }, - { - checked: "false", - amount: 1, - fruitType: "Banana", - fruitName: "Cavendish", - fruitPrice: 3.50 - } - ] + { + checked: true, + amount: 1, + fruitType: "Apple", + fruitName: "Granny Smith", + fruitPrice: 1.50 + }, + + { + checked: "true", + amount: 4, + fruitType: "Orange", + fruitName: "Navel", + fruitPrice: 2.50 + }, + + { + checked: "false", + amount: 1, + fruitType: "Banana", + fruitName: "Cavendish", + fruitPrice: 3.50 + } + ] + + } + + delegate: DelegateChooser + { + DelegateChoice + { + column: 0 + delegate: Text + { + + text: model.display + //selectByMouse: true + //implicitWidth: 140 + //onVisibleChanged: model.display = "checked" + } } - delegate: DelegateChooser { + DelegateChoice + { + column: 1 + delegate: Text + { - DelegateChoice { - column: 0 - delegate: Text { - - text: model.display - //selectByMouse: true - //implicitWidth: 140 - //onVisibleChanged: model.display = "checked" - } + text: model.display + //selectByMouse: true + //implicitWidth: 140 + //onVisibleChanged: model.display = "amount" + //onLinkHovered: model.display = checked } - DelegateChoice { - column: 1 - delegate: Text { + } - text: model.display - //selectByMouse: true - //implicitWidth: 140 - //onVisibleChanged: model.display = "amount" - //onLinkHovered: model.display = checked - } + DelegateChoice + { + column: 2 + delegate: Text + { + + text: model.display + //selectByMouse: true + //implicitWidth: 140 + //model.display : "fruitType" } - DelegateChoice { - column: 2 - delegate: Text { + } - text: model.display - //selectByMouse: true - //implicitWidth: 140 - //model.display : "fruitType" - } + DelegateChoice + { + column: 3 + delegate: Text + { + + text: model.display + //selectByMouse: true + //implicitWidth: 140 + //onVisibleChanged: model.display = "fruitName" } - DelegateChoice { - column: 3 - delegate: Text { + } - text: model.display - //selectByMouse: true - //implicitWidth: 140 - //onVisibleChanged: model.display = "fruitName" - } - } - DelegateChoice { - column: 4 - delegate: Text { - - text: model.display - //selectByMouse: true - //implicitWidth: 140 - //onVisibleChanged: model.display = "fruitPrice" - } + DelegateChoice + { + column: 4 + delegate: Text + { + text: model.display + //selectByMouse: true + //implicitWidth: 140 + //onVisibleChanged: model.display = "fruitPrice" } } } +} diff --git a/lib/DataBase.py b/lib/DataBase.py index 1063482..e7769dc 100644 --- a/lib/DataBase.py +++ b/lib/DataBase.py @@ -1,7 +1,4 @@ # This Python file uses the following encoding: utf-8 -import sys -import os -import sqlite3 from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot diff --git a/lib/Vermasseln.py b/lib/Vermasseln.py index c261f67..8cf5648 100644 --- a/lib/Vermasseln.py +++ b/lib/Vermasseln.py @@ -1,5 +1,4 @@ # This Python file uses the following encoding: utf-8 -from Crypto import Random from Crypto.Cipher import AES from base64 import b64encode, b64decode import platform diff --git a/main.py b/main.py index be59c81..163bc50 100644 --- a/main.py +++ b/main.py @@ -25,7 +25,7 @@ def testConnection(): cur.execute(""" INSERT INTO test VALUES (1, 'Gruva', 'Dusseldorf'), - (2, 'Teroteroterotero', 'Krefeld'), + (2, 'Tero', 'Krefeld'), (3, 'Blabla','Paris') """) connection.commit()