File: qsearchabletreewidget.md

package info (click to toggle)
superqt 0.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,328 kB
  • sloc: python: 9,162; makefile: 16; sh: 12
file content (37 lines) | stat: -rw-r--r-- 840 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# QSearchableTreeWidget

`QSearchableTreeWidget` combines a
[`QTreeWidget`](https://doc.qt.io/qt-6/qtreewidget.html) 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`.


```python
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') }}