Source

thg-qt-mq / repoview-header.diff

# HG changeset patch
# Parent a8d27ba47d50aebe2e7191c9d72f6007eb4050ca
repoview: add option to hide column header

Also removed horizontalHeader().setHighlightSections(False), which is set by
default.

TODO: logcolumns dialog?
TODO: apply dynamically
TODO: bad handling of QSettings

diff --git a/tortoisehg/hgqt/logcolumns.py b/tortoisehg/hgqt/logcolumns.py
--- a/tortoisehg/hgqt/logcolumns.py
+++ b/tortoisehg/hgqt/logcolumns.py
@@ -65,6 +65,12 @@ class ColumnSelectDialog(QDialog):
 
         layout.addWidget(QLabel(_('Drag to change order')))
 
+        self.columnheader_check = QCheckBox(_('Show column header'))
+        layout.addWidget(self.columnheader_check)
+        s = QSettings()
+        self.columnheader_check.setChecked(
+            s.value('repowidget/columnheader', True).toBool())
+
         # dialog buttons
         BB = QDialogButtonBox
         bb = QDialogButtonBox(BB.Ok|BB.Cancel)
@@ -82,6 +88,8 @@ class ColumnSelectDialog(QDialog):
             if item.checkState() == Qt.Checked:
                 cols.append(item.columnid)
         s.setValue('workbench/columns', cols)
+        s.setValue('repowidget/columnheader',
+                   self.columnheader_check.isChecked())
         QDialog.accept(self)
 
     def reject(self):
diff --git a/tortoisehg/hgqt/repoview.py b/tortoisehg/hgqt/repoview.py
--- a/tortoisehg/hgqt/repoview.py
+++ b/tortoisehg/hgqt/repoview.py
@@ -44,7 +44,10 @@ class HgRepoView(QTableView):
         vh.hide()
         vh.setDefaultSectionSize(20)
 
-        self.horizontalHeader().setHighlightSections(False)
+        s = QSettings()
+        s.beginGroup(cfgname)
+        hh = self.horizontalHeader()
+        hh.setVisible(s.value('columnheader', True).toBool())
 
         self.standardDelegate = self.itemDelegate()
         self.htmlDelegate = htmldelegate.HTMLDelegate(self)