Code style

This commit is contained in:
2024-11-07 16:39:56 +01:00
parent 33782aa785
commit 29228cf65d
9 changed files with 214 additions and 217 deletions

View File

@@ -5,9 +5,8 @@ import Qt.labs.qmlmodels
Item { Item {
property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"] property var availableFilters: ["Name", "Adresse", "PLZ", "Ort"]
SearchBar SearchBar
{ {
id:searchBar id:searchBar
@@ -16,11 +15,6 @@ Item {
ColumnLayout ColumnLayout
{ {
// SearchBar
// {
// id:searchBar
// anchors.margins: 9
// }
anchors anchors
{ {
@@ -30,6 +24,7 @@ Item {
right: parent.right right: parent.right
} }
RowLayout RowLayout
{ {
// Layout.fillHeight: true // Layout.fillHeight: true
@@ -59,6 +54,7 @@ Item {
} }
} }
HorizontalHeaderView HorizontalHeaderView
{ {
id: horizontalHeader id: horizontalHeader
@@ -67,44 +63,43 @@ Item {
syncView: testTable syncView: testTable
} }
TableView TableView
{ {
id: testTable id: testTable
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
columnSpacing: 1 columnSpacing: 1
rowSpacing: 2 rowSpacing: 2
model: dbm model: dbm
delegate:Item delegate:Item
{ {
implicitWidth: 200 implicitWidth: 200
implicitHeight: 25 implicitHeight: 25
Text Text
{ {
Layout.fillWidth: true Layout.fillWidth: true
text: model.display text: model.display
}
MouseArea
{
anchors.fill: parent
onClicked: dbm.onRowClicked(row)
}
}
}
MouseArea
{
anchors.fill: parent
onClicked: dbm.onRowClicked(row)
}
}
} }
Item { Item
{
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
} }

View File

@@ -7,6 +7,7 @@ Item
{ {
id: searchBar id: searchBar
height: 30 height: 30
TextField TextField
{ {
id: searchField id: searchField
@@ -15,7 +16,6 @@ Item
rightPadding: 3 rightPadding: 3
width: 300 width: 300
Button Button
{ {
icon.source: "../images/search.svg" icon.source: "../images/search.svg"
@@ -23,9 +23,9 @@ Item
anchors.right: parent.right anchors.right: parent.right
height: parent.height height: parent.height
flat: true flat: true
} }
} }
Button Button
{ {
id: filterBtn id: filterBtn
@@ -38,6 +38,7 @@ Item
} }
Popup Popup
{ {
id: filterPopup id: filterPopup
@@ -50,7 +51,6 @@ Item
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
contentItem: Item contentItem: Item
{ {
ColumnLayout ColumnLayout
{ {
anchors.fill: parent anchors.fill: parent
@@ -59,6 +59,7 @@ Item
Repeater Repeater
{ {
model: availableFilters model: availableFilters
CheckBox CheckBox
{ {
text: model.modelData text: model.modelData
@@ -72,13 +73,11 @@ Item
} }
} }
} }
function setFilter(filter,activated) function setFilter(filter,activated)
{ {
console.log(filter) console.log(filter)
console.log(activated) console.log(activated)
} }
} }

View File

@@ -2,99 +2,85 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
RowLayout
{
id: topBar
spacing: 0
height: 35
RowLayout width: parent.width
anchors
{ {
id: topBar top: parent.top
spacing: 0 left: parent.left
height: 35
width: parent.width
}
Button
anchors {
id: dashBoard
flat: true
text: qsTr("Dashboard")
implicitWidth: dashBoard.implicitContentWidth + 10
onClicked:
{ {
top: parent.top appLoader.source = "Dashboard.qml"
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
} }
} }
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
}
}

View File

@@ -29,6 +29,7 @@ Item
{ {
id: bar id: bar
Layout.fillWidth: true Layout.fillWidth: true
TabButton TabButton
{ {
text: qsTr("Benutzer erstellen") text: qsTr("Benutzer erstellen")
@@ -41,6 +42,7 @@ Item
text: qsTr("Datenbank einrichten") text: qsTr("Datenbank einrichten")
} }
onCurrentIndexChanged: onCurrentIndexChanged:
{ {
submitBtn.text = currentIndex === 0? "Weiter" : "Speichern" submitBtn.text = currentIndex === 0? "Weiter" : "Speichern"
@@ -69,6 +71,7 @@ Item
anchors.fill: parent anchors.fill: parent
Layout.margins: 9 Layout.margins: 9
property string name: "pyqcrm" property string name: "pyqcrm"
Label Label
{ {
text: qsTr("Benutzername:") text: qsTr("Benutzername:")

View File

@@ -9,9 +9,8 @@ ApplicationWindow
width: Screen.width * .6 width: Screen.width * .6
height: Screen.height * .6 height: Screen.height * .6
visible: true visible: true
title: "PYQCRM" title: "PYQCRM"
TopBar TopBar
{ {
@@ -24,10 +23,12 @@ ApplicationWindow
visible: bad_config? false: true visible: bad_config? false: true
} }
Item Item
{ {
id: mainView id: mainView
} }
Loader Loader
{ {
id: appLoader id: appLoader
@@ -40,11 +41,9 @@ ApplicationWindow
topMargin: 0 topMargin: 0
rightMargin: 9 rightMargin: 9
leftMargin: 9 leftMargin: 9
} }
source: bad_config? "firststart.qml": "Dashboard.qml" source: bad_config? "firststart.qml": "Dashboard.qml"
property alias window: appWindow property alias window: appWindow
} }
} }

View File

@@ -4,116 +4,135 @@ import Qt.labs.qmlmodels
TableView { TableView
id: testTable {
anchors.fill: parent id: testTable
columnSpacing: 10 anchors.fill: parent
rowSpacing: 2 columnSpacing: 10
//boundsBehavior: Flickable.StopAtBounds rowSpacing: 2
//boundsBehavior: Flickable.StopAtBounds
model: TableModel { model: TableModel
TableModelColumn { display: "checked" } {
TableModelColumn { display: "amount" } TableModelColumn { display: "checked" }
TableModelColumn { display: "fruitType" } TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitName" } TableModelColumn { display: "fruitType" }
TableModelColumn { display: "fruitPrice" } TableModelColumn { display: "fruitName" }
TableModelColumn { display: "fruitPrice" }
rows: [ rows:
{ [
checked: "checked", {
amount: "amount", checked: "checked",
fruitType: "Fruittype", amount: "amount",
fruitName: "fruitName", fruitType: "Fruittype",
fruitPrice: "Price" fruitName: "fruitName",
}, fruitPrice: "Price"
{ },
checked: true,
amount: 2,
fruitType: "Fruittype",
fruitName: "blabla",
fruitPrice: 1.50
},
{ {
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 { text: model.display
column: 0 //selectByMouse: true
delegate: Text { //implicitWidth: 140
//onVisibleChanged: model.display = "amount"
text: model.display //onLinkHovered: model.display = checked
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "checked"
}
} }
DelegateChoice { }
column: 1
delegate: Text {
text: model.display DelegateChoice
//selectByMouse: true {
//implicitWidth: 140 column: 2
//onVisibleChanged: model.display = "amount" delegate: Text
//onLinkHovered: model.display = checked {
}
text: model.display
//selectByMouse: true
//implicitWidth: 140
//model.display : "fruitType"
} }
DelegateChoice { }
column: 2
delegate: Text {
text: model.display DelegateChoice
//selectByMouse: true {
//implicitWidth: 140 column: 3
//model.display : "fruitType" delegate: Text
} {
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "fruitName"
} }
DelegateChoice { }
column: 3
delegate: Text {
text: model.display DelegateChoice
//selectByMouse: true {
//implicitWidth: 140 column: 4
//onVisibleChanged: model.display = "fruitName" delegate: Text
} {
} text: model.display
DelegateChoice { //selectByMouse: true
column: 4 //implicitWidth: 140
delegate: Text { //onVisibleChanged: model.display = "fruitPrice"
text: model.display
//selectByMouse: true
//implicitWidth: 140
//onVisibleChanged: model.display = "fruitPrice"
}
} }
} }
} }
}

View File

@@ -1,7 +1,4 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import sys
import os
import sqlite3
from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot from PySide6.QtCore import QAbstractTableModel, QModelIndex, Qt, Slot

View File

@@ -1,5 +1,4 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
from Crypto import Random
from Crypto.Cipher import AES from Crypto.Cipher import AES
from base64 import b64encode, b64decode from base64 import b64encode, b64decode
import platform import platform

View File

@@ -25,7 +25,7 @@ def testConnection():
cur.execute(""" cur.execute("""
INSERT INTO test VALUES INSERT INTO test VALUES
(1, 'Gruva', 'Dusseldorf'), (1, 'Gruva', 'Dusseldorf'),
(2, 'Teroteroterotero', 'Krefeld'), (2, 'Tero', 'Krefeld'),
(3, 'Blabla','Paris') (3, 'Blabla','Paris')
""") """)
connection.commit() connection.commit()