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,17 +63,16 @@ 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
@@ -89,22 +84,22 @@ Item {
text: model.display text: model.display
} }
MouseArea MouseArea
{ {
anchors.fill: parent anchors.fill: parent
onClicked: dbm.onRowClicked(row) 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,21 +2,12 @@ import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
RowLayout
{
RowLayout
{
id: topBar id: topBar
spacing: 0 spacing: 0
height: 35 height: 35
width: parent.width width: parent.width
anchors anchors
{ {
top: parent.top top: parent.top
@@ -91,10 +82,5 @@ import QtQuick.Layouts
} }
} }

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,14 +4,16 @@ import Qt.labs.qmlmodels
TableView { TableView
{
id: testTable id: testTable
anchors.fill: parent anchors.fill: parent
columnSpacing: 10 columnSpacing: 10
rowSpacing: 2 rowSpacing: 2
//boundsBehavior: Flickable.StopAtBounds //boundsBehavior: Flickable.StopAtBounds
model: TableModel { model: TableModel
{
TableModelColumn { display: "checked" } TableModelColumn { display: "checked" }
TableModelColumn { display: "amount" } TableModelColumn { display: "amount" }
TableModelColumn { display: "fruitType" } TableModelColumn { display: "fruitType" }
@@ -19,7 +21,8 @@ import Qt.labs.qmlmodels
TableModelColumn { display: "fruitPrice" } TableModelColumn { display: "fruitPrice" }
rows: [ rows:
[
{ {
checked: "checked", checked: "checked",
amount: "amount", amount: "amount",
@@ -27,6 +30,7 @@ import Qt.labs.qmlmodels
fruitName: "fruitName", fruitName: "fruitName",
fruitPrice: "Price" fruitPrice: "Price"
}, },
{ {
checked: true, checked: true,
amount: 2, amount: 2,
@@ -43,6 +47,7 @@ import Qt.labs.qmlmodels
fruitName: "Granny Smith", fruitName: "Granny Smith",
fruitPrice: 1.50 fruitPrice: 1.50
}, },
{ {
checked: "true", checked: "true",
amount: 4, amount: 4,
@@ -50,6 +55,7 @@ import Qt.labs.qmlmodels
fruitName: "Navel", fruitName: "Navel",
fruitPrice: 2.50 fruitPrice: 2.50
}, },
{ {
checked: "false", checked: "false",
amount: 1, amount: 1,
@@ -61,11 +67,13 @@ import Qt.labs.qmlmodels
} }
delegate: DelegateChooser { delegate: DelegateChooser
{
DelegateChoice { DelegateChoice
{
column: 0 column: 0
delegate: Text { delegate: Text
{
text: model.display text: model.display
//selectByMouse: true //selectByMouse: true
@@ -73,9 +81,12 @@ import Qt.labs.qmlmodels
//onVisibleChanged: model.display = "checked" //onVisibleChanged: model.display = "checked"
} }
} }
DelegateChoice {
DelegateChoice
{
column: 1 column: 1
delegate: Text { delegate: Text
{
text: model.display text: model.display
//selectByMouse: true //selectByMouse: true
@@ -84,9 +95,12 @@ import Qt.labs.qmlmodels
//onLinkHovered: model.display = checked //onLinkHovered: model.display = checked
} }
} }
DelegateChoice {
DelegateChoice
{
column: 2 column: 2
delegate: Text { delegate: Text
{
text: model.display text: model.display
//selectByMouse: true //selectByMouse: true
@@ -94,9 +108,12 @@ import Qt.labs.qmlmodels
//model.display : "fruitType" //model.display : "fruitType"
} }
} }
DelegateChoice {
DelegateChoice
{
column: 3 column: 3
delegate: Text { delegate: Text
{
text: model.display text: model.display
//selectByMouse: true //selectByMouse: true
@@ -104,10 +121,12 @@ import Qt.labs.qmlmodels
//onVisibleChanged: model.display = "fruitName" //onVisibleChanged: model.display = "fruitName"
} }
} }
DelegateChoice {
column: 4
delegate: Text {
DelegateChoice
{
column: 4
delegate: Text
{
text: model.display text: model.display
//selectByMouse: true //selectByMouse: true
//implicitWidth: 140 //implicitWidth: 140
@@ -115,5 +134,5 @@ import Qt.labs.qmlmodels
} }
} }
} }
} }

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()