From b50b69e9b890f0133c21e3bb617c9413f8ec1c72 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Wed, 23 Dec 2020 22:19:30 +0800 Subject: [PATCH] property-dialog: hide a section if it's empty --- app/metadatadialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/metadatadialog.cpp b/app/metadatadialog.cpp index 4e6c3cb..349011f 100644 --- a/app/metadatadialog.cpp +++ b/app/metadatadialog.cpp @@ -20,9 +20,13 @@ protected: { QTreeView::rowsInserted(parent, start, end); if (!parent.isValid()) { + // we are inserting a section group for (int row = start; row <= end; ++row) { setupSection(row); } + } else { + // we are inserting a property + setRowHidden(parent.row(), QModelIndex(), false); } } @@ -41,6 +45,7 @@ private: { expand(model()->index(row, 0)); setFirstColumnSpanned(row, QModelIndex(), true); + setRowHidden(row, QModelIndex(), !model()->hasChildren(model()->index(row, 0))); } };