Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yjg30737/pyqt-editable-treewidget-example
PyQt example of QTreeWidget which is editable (intuitive enough to use)
https://github.com/yjg30737/pyqt-editable-treewidget-example
pyqt pyqt-tutorial pyqt5 pyqt5-examples qevent qkeyevent qt qt5 qtreeview qtreewidget
Last synced: 9 days ago
JSON representation
PyQt example of QTreeWidget which is editable (intuitive enough to use)
- Host: GitHub
- URL: https://github.com/yjg30737/pyqt-editable-treewidget-example
- Owner: yjg30737
- License: mit
- Created: 2022-06-12T07:10:44.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-14T11:31:35.000Z (7 months ago)
- Last Synced: 2024-04-15T10:41:41.586Z (7 months ago)
- Topics: pyqt, pyqt-tutorial, pyqt5, pyqt5-examples, qevent, qkeyevent, qt, qt5, qtreeview, qtreewidget
- Language: Python
- Homepage:
- Size: 72.3 KB
- Stars: 12
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyqt-editable-treewidget-example
PyQt example of QTreeWidget which is editableIntuitive enough to use, but this is for example only
## Requirements
* PyQt5 >= 5.8## Setup
* git clone ~## Feature
* Show the exmaple of adding & deleting the tree widget item in convinient way
* Support multiple options:
* make it unable to edit the parent item's name which has the child
* user can make the certain item not editable
* Convert QTreeWidget hierarchy into JSON format
* convert the QTreeWidget hierarchy into JSON format (in Python, array of Python dictionary) to save in "tree.json"
* Load the saved JSON content from "tree.json" and convert it into QTreeWidget when user executes the window again
The each object of tree.json contains multiple properties - name of the item(name), editable flag(editable), childs of the item(data)## Usage
Key command
* Enter/Return - Add new child
* F2 - Rename attribute
* Delete - Remove attribute
* Up/Down - Previous/next attribute
* Shift+Up/Down - Go parent/child attributeContext Menu
* Add parent attribute
* Add child attribute
* Rename - rename the item
* Editable - check to make the item editable or not## Example
Code Sample
```python
from PyQt5.QtWidgets import QApplication
from pyqt_editable_treewidget_example import MainWindowif __name__ == "__main__":
import sysapp = QApplication(sys.argv)
example = MainWindow()
example.show()
app.exec_()
```Result
Basic control of the treewidget
https://user-images.githubusercontent.com/55078043/173221882-37766b10-d38a-4953-bc12-fb2b8bd7171b.mp4
Whole window (v0.0.161)
![image](https://user-images.githubusercontent.com/55078043/222945406-34ff5410-d8f5-4ba7-8511-79e7e947fc6d.png)