qtreeview

Developing pyqt4 tree widget

非 Y 不嫁゛ 提交于 2019-12-11 05:21:51
问题 i need to write a tree?, in pyqt. It looks like this: Clients(this is text) Type A (this is a Clients child and has a checkbox) Type B (this is a Clients child and has a checkbox) Vendors(this is text) Mary (this is a Vendors child and has a checkbox) Arnold (this is a Vendors child and has a checkbox) Time Period Init(this is a Time Period child, and would be a calendarWidget for date selection) End (this is a Time Period child, and would be a calendarWidget for date selection) What would

dynamic qtreeview with custom delegates

南楼画角 提交于 2019-12-11 05:18:23
问题 I'm using Qt 5.6 and my goal is to develop a dynamic tree using QTreeView that needs to populate items such as combo boxes, edit box, checkbox, buttons..etc depending on the settings loaded and the tree data can change as new data is loaded. There will be many nodes to populate in the tree with parent and child nodes. I've read about different options to implement this type of treeview such as populating a QTreeView and implementing my own delegate by inheriting from QITemDelegate or

How to refresh a QFileSystemModel in a QTreeView after files change through another process?

霸气de小男生 提交于 2019-12-11 02:33:46
问题 I have a QTreeView with a QFileSystemModel as the model. Files and directories load correctly. In my application workflow, a different process copies and overwrites files on the file system. However, my QTreeView does not update the item/row for the overwritten file (eg: the size and lastModified values for the file do not update to the new values). Using the file path, I'm able to get a FileInfo that DOES have the updated lastModified value. However, using that same path to grab the

QTreeView vs setIndexWidget

你离开我真会死。 提交于 2019-12-11 02:02:47
问题 I am using QStandardItemModel with QStandardItem's. I don't want to write my own model and any delegates. I just want to have tree of checkboxes with QComboBox'es in second column... m_model->setColumnCount(2); for (int i = 0; i < sectionCount; i++) { QStandardItem * section = new QStandardItem(tr("Section %1").arg(i+1)); section->setCheckable(true); section->setCheckState(Qt::Checked); for (int j = 0; j < itemsCount; j++) { QStandardItem * item = new QStandardItem(tr("Item %1").arg(j+1));

How to display sub-rows of QAbstractItemModel in QTableView

大兔子大兔子 提交于 2019-12-10 10:38:14
问题 I have my own class that inherits from QAbstractItemModel which has tree structure. I use a couple of views, that display filtered data of this model, using classes derived from QSortFilterProxyModel. My model structure looks like this: root | -- A | |-A1 | |-A2 | |-A3 | -- B | |-B1 | |-B2 | ... and so on... Where A, B .... are "main rows" (children of the root), and A1, A2, ... B1, B2... are "children rows" - node rows appended to "main rows". Now, what I need to do is a QTableView that

Display an icon before text in a QTreeView

▼魔方 西西 提交于 2019-12-10 09:42:49
问题 I'm using QtRuby with Qt 4.8.6 and trying to create a tree view where each item has a custom icon between the tree controls and the name. The end result should be like this: I am getting space allocated for where the icon should go, but I'm not seeing any icons. What do I have to do to get them to show up? Here's my code (simplified slightly to remove the no-data edge cases): class MyModel < Qt::AbstractItemModel # ... def data(index, role) case role when Qt::DisplayRole case index.column

PyQt: removing unnecessary columns

冷暖自知 提交于 2019-12-10 03:32:15
问题 I am using QTreeView with QFileSystemModel. It displays columns like Size, Type, Modification Date, which I don't need. How can I remove them from the view? I can't find any removeColumn in model or in view. 回答1: Get the QHeaderView of your TreeView by calling header() on it, the headerview knows about the columns and can hide them via hideSection 回答2: I believe, this post is a duplicate of: How can I remove columns from a QTreeView (using QDirModel)? The only difference is that here we are

PySide: QTreeView to nested dictionary

此生再无相见时 提交于 2019-12-09 23:08:08
问题 I need help to build a hierarchical nested dict from a QTreeView structure to get something like this: {"A": {"B": {"H": {}, "I": {"M": {}, "N": {}}}, "D": {}, "E": {}, "F": {}, "G": {"L": {}}, "C": {"J": {}, "K": {}}}} { "A": { "B": { "H": {}, "I": { "M": {}, "N": {} } }, "D": {}, "E": {}, "F": {}, "G": { "L": {} }, "C": { "J": {}, "K": {} } } } I am not using columns in this case and the QTreeView represents a directory structure (i actually extracted it from a dict like tho one above and

PyQt: How Can I set row heights of QTreeView

喜你入骨 提交于 2019-12-08 22:14:45
问题 In PyQt, I am looking for a way to set the height of rows in a QTreeView (similarly to QTableView.setRowHeight(row, row_height) , but QTreeView does not have this function). QAbstractItemModel is used to set the tree model. I read some suggestions here using and sub-classing QAbstractItemDelegate.sizeHint(option, index) but I don't know exactly how to call them correctly within my tree model. Any minimal code or suggestion would be greatly appreciated. Thanks. 回答1: The QTreeView works out a

QTreeWidget (Applying Styles for items)

大兔子大兔子 提交于 2019-12-08 09:08:39
问题 I have a tree widget and there are three levels in the tree as follows Example Tree ============================ LEVEL1 LEVEL2 LEVEL2 LEVEL3 LEVEL3 LEVEL2 LEVEL2 LEVEL1 I want to apply different styles for items, depending their levels so that I can style, LEVEL1, LEVEL2 & LEVEL3 differently. I can do this with a two level tree. Please help. I want to achieve this at CSS level (without touching the code) I went through following documenation. I guess distinguishing between LEVEL1 & LEVEL2 is