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'):
|
for signal in ('Activated', 'Changed', 'DoubleClicked', 'Clicked'):
|
||||||
signal = getattr(self.opt_columns, 'item'+signal)
|
signal = getattr(self.opt_columns, 'item'+signal)
|
||||||
signal.connect(self.columns_changed)
|
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):
|
def initialize(self):
|
||||||
ConfigWidgetBase.initialize(self)
|
ConfigWidgetBase.initialize(self)
|
||||||
@ -137,6 +139,20 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
|||||||
return
|
return
|
||||||
self.opt_columns.resizeColumnsToContents()
|
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):
|
def setup_row(self, row, key, order, force_checked_to=None):
|
||||||
flags = Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable
|
flags = Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>504</width>
|
<width>611</width>
|
||||||
<height>399</height>
|
<height>482</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -191,6 +191,8 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="add_col_button">
|
<widget class="QPushButton" name="add_col_button">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add &custom column</string>
|
<string>Add &custom column</string>
|
||||||
@ -201,6 +203,35 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user