Need help inserting something in Qt tree view with python
-
Hi
I want to get a Tree View running with PySide for that i used Qt Designer to get the window.
To compile my GUI code into Python code i used the pyuic compiler and i got a form.py
which is a module containing my dialog as a Python class and looks like this:@class Ui_SleuthGUI(object):
def setupUi(self, SleuthGUI):
SleuthGUI.setObjectName("SleuthGUI")
...
self.tvDirTree = QtGui.QTreeView(self.centralwidget)
self.tvDirTree.setGeometry(QtCore.QRect(20, 120, 311, 451))
self.tvDirTree.setObjectName("tvDirTree")
...@Now i didn't know how to write the python code to insert something in my treeview.
I tried plenty of things wich i found on the internet but nothing worked.
PyQt4 and PySide are installed.@from PySide import QtGui, QtCore
from sleuthGUI_ui import Ui_SleuthGUIself.ui.tvDirTree.itemDelegateForColumn(1)
items = []
for i in range(10):
items.append(QtGui.QTreeWidgetItem(None, QStringList(QString('item: %1').arg(i))))
self.ui.tvDirTree.insertTopLevelItems(None, items)
self.ui.tvDirTree.insertAction(None, items)
@
Another Problem is that PySide does not know QStringList or QString so i tried it with PyQt4.
But i could not insert anything.Could anybody help me please?