Files
superqt/docs/widgets/qsearchabletreewidget.md
2023-09-12 13:47:15 -04:00

840 B

QSearchableTreeWidget

QSearchableTreeWidget combines a QTreeWidget and a QLineEdit for showing a mapping that can be searched by key.

This is intended to be used with a read-only mapping and be conveniently created using QSearchableTreeWidget.fromData(data). If the mapping changes, the easiest way to update this is by calling setData.

from qtpy.QtWidgets import QApplication

from superqt import QSearchableTreeWidget

app = QApplication([])

data = {
    "none": None,
    "str": "test",
    "int": 42,
    "list": [2, 3, 5],
    "dict": {
        "float": 0.5,
        "tuple": (22, 99),
        "bool": False,
    },
}
tree = QSearchableTreeWidget.fromData(data)
tree.show()

app.exec_()

{{ show_widget() }}

{{ show_members('superqt.QSearchableTreeWidget') }}