From 3462f5a26ac034ece862ba41012dcf081159d8d1 Mon Sep 17 00:00:00 2001 From: Joshua Cantara <1975723+joshuacant@users.noreply.github.com> Date: Mon, 1 Sep 2025 15:34:29 -0400 Subject: [PATCH] set column widths dynamically based on window width --- tidal_dl_ng/gui.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py index 2747f83..aebb135 100644 --- a/tidal_dl_ng/gui.py +++ b/tidal_dl_ng/gui.py @@ -360,9 +360,15 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): ## Styling tree.sortByColumn(0, QtCore.Qt.SortOrder.AscendingOrder) tree.setColumnHidden(1, True) - tree.setColumnWidth(2, 150) - tree.setColumnWidth(3, 150) - tree.setColumnWidth(4, 150) + normal_width = max(150, (self.width() * 0.13)) # 12% for normal fields + narrow_width = max(90, (self.width() * 0.06)) # 6% for shorter fields + skinny_width = max(60, (self.width() * 0.03)) # 3% for very short fields + tree.setColumnWidth(2, normal_width) # artist + tree.setColumnWidth(3, normal_width) # title + tree.setColumnWidth(4, normal_width) # album + tree.setColumnWidth(5, skinny_width) # duration + tree.setColumnWidth(6, narrow_width) # quality + tree.setColumnWidth(7, narrow_width) # date header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) # Connect the contextmenu tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)