mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Preferences->Add your own columns: Add buttons to show/hide all columns. Fixes #2031570 [have every column be ticked or unticked instead of doing them all manually](https://bugs.launchpad.net/calibre/+bug/2031570)
This commit is contained in:
parent
a69604b519
commit
8f405d4476
@ -44,6 +44,8 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
for signal in ('Activated', 'Changed', 'DoubleClicked', 'Clicked'):
|
||||
signal = getattr(self.opt_columns, 'item'+signal)
|
||||
signal.connect(self.columns_changed)
|
||||
self.show_all_button.clicked.connect(self.show_all)
|
||||
self.hide_all_button.clicked.connect(self.hide_all)
|
||||
|
||||
def initialize(self):
|
||||
ConfigWidgetBase.initialize(self)
|
||||
@ -137,6 +139,20 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
return
|
||||
self.opt_columns.resizeColumnsToContents()
|
||||
|
||||
def hide_all(self):
|
||||
for row in range(self.opt_columns.rowCount()):
|
||||
item = self.opt_columns.item(row, 0)
|
||||
if item.checkState() != Qt.CheckState.PartiallyChecked:
|
||||
item.setCheckState(Qt.CheckState.Unchecked)
|
||||
self.changed_signal.emit()
|
||||
|
||||
def show_all(self):
|
||||
for row in range(self.opt_columns.rowCount()):
|
||||
item = self.opt_columns.item(row, 0)
|
||||
if item.checkState() != Qt.CheckState.PartiallyChecked:
|
||||
item.setCheckState(Qt.CheckState.Checked)
|
||||
self.changed_signal.emit()
|
||||
|
||||
def setup_row(self, row, key, order, force_checked_to=None):
|
||||
flags = Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>504</width>
|
||||
<height>399</height>
|
||||
<width>611</width>
|
||||
<height>482</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -191,15 +191,46 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPushButton" name="add_col_button">
|
||||
<property name="text">
|
||||
<string>Add &custom column</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/plus.png</normaloff>:/images/plus.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="add_col_button">
|
||||
<property name="text">
|
||||
<string>Add &custom column</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/plus.png</normaloff>:/images/plus.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="show_all_button">
|
||||
<property name="text">
|
||||
<string>&Show all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hide_all_button">
|
||||
<property name="text">
|
||||
<string>&Hide all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user