Fix editable QAbstractView items.

Removes the padding on QLineEdit in QAbstractView items to prevent padding from concealing item text. Closes #69.
main
Alex Huszagh 2022-11-18 17:41:30 -06:00
parent 39949cbdff
commit 8d8fc68f63
No known key found for this signature in database
GPG Key ID: 2F7B9B3C8E245750
8 changed files with 7049 additions and 6857 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1838,6 +1838,16 @@ QTreeView::item:!selected:hover
padding: 0.13em;
}
QAbstractItemView::item QLineEdit
{
border: 0em transparent black;
/*
* The top/bottom padding causes the editable widget to conceal text.
* https://github.com/Alexhuszagh/BreezeStyleSheets/issues/69
*/
padding: 0em;
}
QSlider::handle:horizontal,
QSlider::handle:vertical
{

View File

@ -1838,6 +1838,16 @@ QTreeView::item:!selected:hover
padding: 0.13em;
}
QAbstractItemView::item QLineEdit
{
border: 0em transparent black;
/*
* The top/bottom padding causes the editable widget to conceal text.
* https://github.com/Alexhuszagh/BreezeStyleSheets/issues/69
*/
padding: 0em;
}
QSlider::handle:horizontal,
QSlider::handle:vertical
{

View File

@ -1838,6 +1838,16 @@ QTreeView::item:!selected:hover
padding: 0.13em;
}
QAbstractItemView::item QLineEdit
{
border: 0em transparent black;
/*
* The top/bottom padding causes the editable widget to conceal text.
* https://github.com/Alexhuszagh/BreezeStyleSheets/issues/69
*/
padding: 0em;
}
QSlider::handle:horizontal,
QSlider::handle:vertical
{

View File

@ -1838,6 +1838,16 @@ QTreeView::item:!selected:hover
padding: 0.13em;
}
QAbstractItemView::item QLineEdit
{
border: 0em transparent black;
/*
* The top/bottom padding causes the editable widget to conceal text.
* https://github.com/Alexhuszagh/BreezeStyleSheets/issues/69
*/
padding: 0em;
}
QSlider::handle:horizontal,
QSlider::handle:vertical
{

View File

@ -208,6 +208,7 @@ def get_compat_definitions(args):
ns.Sunken = ns.FrameShadow.Sunken
ns.InstantPopup = ns.ToolButtonPopupMode.InstantPopup
ns.MenuButtonPopup = ns.ToolButtonPopupMode.MenuButtonPopup
ns.ItemIsEditable = ns.ItemFlag.ItemIsEditable
ns.ItemIsUserCheckable = ns.ItemFlag.ItemIsUserCheckable
ns.ItemIsUserTristate = ns.ItemFlag.ItemIsUserTristate
ns.Checked = ns.CheckState.Checked
@ -497,6 +498,7 @@ def get_compat_definitions(args):
ns.AlignHCenter = QtCore.Qt.AlignHCenter
ns.AlignVCenter = QtCore.Qt.AlignVCenter
ns.AlignCenter = QtCore.Qt.AlignCenter
ns.ItemIsEditable = QtCore.Qt.ItemIsEditable
ns.ItemIsUserCheckable = QtCore.Qt.ItemIsUserCheckable
ns.ItemIsUserTristate = QtCore.Qt.ItemIsUserTristate
ns.Checked = QtCore.Qt.Checked

View File

@ -1838,6 +1838,16 @@ QTreeView::item:!selected:hover
padding: 0.13em;
}
QAbstractItemView::item QLineEdit
{
border: 0em transparent black;
/*
* The top/bottom padding causes the editable widget to conceal text.
* https://github.com/Alexhuszagh/BreezeStyleSheets/issues/69
*/
padding: 0em;
}
QSlider::handle:horizontal,
QSlider::handle:vertical
{

View File

@ -815,6 +815,16 @@ def test_sortable_list(widget, *_):
return child
def test_editable_list(widget, *_):
child = QtWidgets.QListWidget(widget)
child.setSortingEnabled(True)
for index in range(10):
item = QtWidgets.QListWidgetItem(f'Item {index + 1}')
item.setFlags(item.flags() | compat.ItemIsEditable)
child.addItem(item)
return child
def test_key_sequence_edit(widget, *_):
return QtWidgets.QKeySequenceEdit(widget)
@ -1161,6 +1171,41 @@ def test_sortable_tree(widget, *_):
return tree
def test_editable_tree(widget, *_):
def new_item(widget, columns):
item = QtWidgets.QTreeWidgetItem(widget, columns)
item.setFlags(item.flags() | compat.ItemIsEditable)
return item
child = []
tree1 = QtWidgets.QTreeWidget(widget)
tree1.setHeaderLabel('Tree 1')
item1 = new_item(tree1, ['Row 1'])
item2 = new_item(tree1, ['Row 2'])
item3 = new_item(item2, ['Row 2.1'])
item3.setFlags(item3.flags() | compat.ItemIsUserCheckable)
item3.setCheckState(0, compat.Unchecked)
item4 = new_item(item2, ['Row 2.2'])
item5 = new_item(item4, ['Row 2.2.1'])
item6 = new_item(item5, ['Row 2.2.1.1'])
item7 = new_item(item5, ['Row 2.2.1.2'])
item7.setFlags(item7.flags() | compat.ItemIsUserCheckable)
item7.setCheckState(0, compat.Checked)
item8 = new_item(item2, ['Row 2.3'])
item8.setFlags(item8.flags() | compat.ItemIsUserTristate)
item8.setCheckState(0, compat.PartiallyChecked)
item9 = new_item(tree1, ['Row 3'])
item10 = new_item(item9, ['Row 3.1'])
item11 = new_item(tree1, ['Row 4'])
child.append(tree1)
tree2 = QtWidgets.QTreeWidget(widget)
tree2.setHeaderLabel('Tree 2')
tree2.header().setSectionsClickable(True)
item12 = new_item(tree2, ['Row 1', 'Column 2', 'Column 3'])
child.append(tree2)
return child
def test_hidden_header_tree(widget, *_):
tree = QtWidgets.QTreeWidget(widget)
tree.setHeaderLabel('Tree 1')