From 7e2272017f435bc054452e0fafdfda51bc9c2ac5 Mon Sep 17 00:00:00 2001 From: Paul S Date: Thu, 1 Jul 2021 18:33:19 +0200 Subject: [PATCH] rows sortable + columns rearrangable + horizontalHeaderStretchLastSection -> True --- changelog.md | 6 ++++++ src/clsTableWidget.py | 4 ++++ src/main.py | 2 +- ui/main.ui | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index c9b13fc..7a4d7e0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog GarageCalc1 +## [0.4.2] - 2021-07-01 +## Added +- Tabelle "Gegenstände": Zeilen sind sortierbar (-> Klick auf Spaltenköpfe) +- Tabelle "Gegenstände": Spalten sind anordenbar +- Beide Tabellen: Rechte Spalte wächst dynamisch ans Ende + ## [0.4.1] - 2021-07-01 ## Added - Dynamisches Layout diff --git a/src/clsTableWidget.py b/src/clsTableWidget.py index 98c5bb4..9d9b686 100644 --- a/src/clsTableWidget.py +++ b/src/clsTableWidget.py @@ -55,6 +55,9 @@ class TableWidget(QTableWidget): self.setSelectionBehavior(QTableWidget.SelectItems) #self.setSelectionBehavior(QTableWidget.SelectRows) self.setAlternatingRowColors(True) + self.setSortingEnabled(True) + self.horizontalHeader().setSectionsMovable(True) + self.horizontalHeader().setStretchLastSection(True) # Context-menu self.setContextMenuPolicy(Qt.CustomContextMenu) @@ -67,6 +70,7 @@ class TableWidget(QTableWidget): self.headers.customContextMenuRequested.connect(self.on_rowheadercontext_menu) self.headers.setSelectionMode(QAbstractItemView.SingleSelection) self.headers.sectionClicked.connect(self.select_row) + self.headers.setSectionsMovable(True) self.row_selected = False diff --git a/src/main.py b/src/main.py index a5ff8db..0f22d8f 100644 --- a/src/main.py +++ b/src/main.py @@ -28,7 +28,7 @@ from utils import show_about, resource_path from clsTableWidget import TableWidget # Local globals -APP_VERSION = "v0.4.1" +APP_VERSION = "v0.4.2" DIR_APPDATA = os.getenv('LOCALAPPDATA') diff --git a/ui/main.ui b/ui/main.ui index b7f95e2..60cf484 100644 --- a/ui/main.ui +++ b/ui/main.ui @@ -55,6 +55,9 @@ 58 + + true + Garage