Code style
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
152
gui/TopBar.qml
152
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
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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:")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
207
gui/test.qml
207
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user