I'm new to PyQt and I'm trying to do some specyfic stuff but without luck :(
I'm trying to create a expandable tree of items (treeview) with pyqt, but I want, that on the left of each name there will be a non-exclusive checkbox.
I found some codes but for now the best result was tree with only checkboxes :(
Does somebody have some minimal example how to achive this effect?
Thank you very much!
Qt's ItemViews draw checkboxes next to the text, if the ItemIsUserCheckable flag is set for the item in the model. If you write your own model you must implement QAbstractItemModel::flags, if you use QTreeWidget you can set the flags for each QTreeWidgetItem.
Related
I am working on a small project using PyQt5 (Python 3) and I want a widget where a user can select/modify a file, somewhat akin to the left-hand side of file explorer on Windows:
This cannot be done with QFileDialog as I want to display files that are not on the user's drive.
I have tried writing my own, however I am a beginner and I lack the skills to do it correctly (hence the reason why I'm trying to learn). I can provide the code if that would be useful.
Is there such a thing built in to pyqt? Has anyone created one before, with source code available?
Thanks in advance.
EDIT: More specifically I don't want a way to access remote files, just a widget that displays entries (along with icons, preferably) and subentries in a sort of drop-down menu, like the section of file explorer mentioned above. It doesn't necessarily have to be to do with files, consider it a drop-down menu if that helps.
I know this is old but for anyone looking for an answer it's the QTreeView widget.
so I am using PyQt and the Qt Designer to create a little tool that is loading up data from a file.
I would like to have three buttons above a table (does not have to be a QTableWidget if there is a better solution), the table is displaying things like a small image, name, and other related stuff.
I would like to toggle between the design of the table, like button 1 displays only a list, button 2 the same list but with images in column0 and button3 should show huge images instead of tiny list entries, is there a Widget to use or how should I try to accomplish this?
Thanks
I wanted to set multiple icons in a single item in my QcomboBox. I think this can be implemented using the QAbstractItemDelegate, but I need some PyQt examples. The following link does give me an idea but I couldn't get in running with Python :
How to custome QCombobox with multiple comlumns
Thank you for the help.
I gave my CustomTreeCtrl the TR_HAS_VARIABLE_ROW_HEIGHT style. But I am not sure where to go from there to change the height of the items inside the tree.
I cant really find anything on the API or online.
I think all you have to do is change the font size of the item. That's what it looks like in the wxPython demo anyway. You could ask on the wxPython users group though. The author of that widget is on there most of the time and is very helpful.
I have an app written in python that presents some of its data in a tree view. By default, the tree view is a floaty white affair with little floaty triangles to expand the nodes.
Is it possible to change this style to be more like a Windows explorer tree view? Specifically, I'd like to have vertical lines indicating parentage of the nodes.
If this is possible, how would it be done?
For lines linking the arrows there is a method in gtk.TreeView for that, see http://library.gnome.org/devel/pygtk/stable/class-gtktreeview.html#method-gtktreeview--set-enable-tree-lines
you need to create a custom CellRenderers for this. the below links might help.
http://www.pygtk.org/pygtk2tutorial/ch-TreeViewWidget.html
http://www.pygtk.org/pygtk2tutorial/sec-CellRenderers.html