From ba32473f06da05f88168ce4579aa98a39534b5d2 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Fri, 13 Dec 2024 12:45:42 +0000 Subject: [PATCH] Fix header row heights too large --- app/playlistmodel.py | 2 +- app/playlists.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/playlistmodel.py b/app/playlistmodel.py index b98bf8b..71cb907 100644 --- a/app/playlistmodel.py +++ b/app/playlistmodel.py @@ -377,7 +377,7 @@ class PlaylistModel(QAbstractTableModel): else: return QVariant(self.header_text(rat)) else: - return QVariant() + return QVariant("") if column == Col.START_TIME.value: start_time = rat.forecast_start_time diff --git a/app/playlists.py b/app/playlists.py index 3505a0e..ed85d39 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -214,6 +214,24 @@ class PlaylistDelegate(QStyledItemDelegate): doc.setDefaultFont(option.font) doc.setDocumentMargin(0) doc.setHtml(option.text) + + # For debugging +++ + # Calculate sizes + # document_size = doc.documentLayout().documentSize() + # ideal_width = doc.idealWidth() + # height = document_size.height() + # rect_width = option.rect.width() + # text = option.text + + # # Debug output + # print(f"Index: {index.row()}, {index.column()}") + # print(f"Text: {text}") + # print(f"Option.rect width: {rect_width}") + # print(f"Document idealWidth: {ideal_width}") + # print(f"Document height: {height}") + # print(f"---") + # --- For debugging + return QSize(int(doc.idealWidth()), int(doc.size().height())) def setEditorData(self, editor, index):