Questions tagged [qtreeview]

QTreeView is a class in Qt framework. It provides a default model/view implementation of a tree view.

A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that were previously provided by the QListView class, but using the more flexible approach provided by Qt's model/view architecture.

The official Qt documentation can be found here for Qt 4.8 and here for Qt 5.

823 questions
4
votes
1 answer

Qtreeview, resizing a line when it's been selected

I'm using Qt 4.7.0, a Qtreeview with multiple columns. What I want to do is "simple" : I want a line to increase its height, when it's selected. Will delegates be enough to do this ? I've been through some stuff with a QTableView…
Andy M
  • 5,945
  • 7
  • 51
  • 96
4
votes
2 answers

Qt itemChanged signal with QTreeView model works only on first level items

I don't know if I do something wrong in my qt code. I just need that itemChanged signal is emitted every time when item data changed. I use following code to make the model: QStandardItemModel* model = new QStandardItemModel; QStandardItem…
Meteo ir3
  • 449
  • 8
  • 21
4
votes
2 answers

How to add different types of delegates in QTreeView

I want to create same kind of QTreeView (not QTreeWidget) structure as shown in attached figure.. This is Property Editor of QT. I am using QT-4.6 On 2nd column, depending on different condition, I can have either a spin box, or a drop down or a…
Nishant Sharma
  • 341
  • 2
  • 5
  • 17
4
votes
2 answers

QTreeView with QFileSystemModel: How can I remove all columns except "Name"?

while I'm working on something in Qt5 that closely resembles a file manager, I try to implement a very basic tree view, showing only the directory names without any other information. However, (it seems that) QTreeView doesn't let me decide which…
r4ndom n00b
  • 89
  • 2
  • 8
4
votes
1 answer

QTreeView: hierarchical context for multi-level columns

I'm looking for a better way to display multi-level hierarchical data in a tree where the meaning of each column changes depending on the level in the tree. I am using QTreeView and QAbstractItemModel to display my model data. Each model row has a…
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213
4
votes
2 answers

Qt5 QTreeView with custom model and large data very slow scrolling

I have custom data that I need to display in a QTreeView. I have derived my model from QAbstractTableModel, and made my own implementations of rowCount(), columnCount(), data(), and headerData(). The model has a local QList> to support it, and the…
bmahf
  • 965
  • 2
  • 11
  • 27
4
votes
1 answer

PySide Qt insert row at leaf item and update view

I have this mostly working code that enables the user to add items to a tree structure. This is working fine as long as you are not adding items to a leaf item (item with no children). If the item has no children then on the first time adding a…
Mark
  • 672
  • 1
  • 6
  • 19
4
votes
1 answer

PyQt QFileDialog - Multiple Directory Selection

I am trying to create a QFileDialog that allows the user to select multiple directories. Following the discussion here and the faq here, but I'm not sure what I'm doing wrong. I get a file dialog, but it still only lets me select a single directory…
dan_g
  • 2,712
  • 5
  • 25
  • 44
4
votes
1 answer

setItemDelegateForColunm() crasches application without stacktrace

Problem: When setting a QtstyledItemDelegate per row or column on a TreeView my application crashes without any further information. Nonetheless setting a QStyledItemDelegate for the whole TreeView works which seems to be strange in my opinion. Does…
Stefan Reinhardt
  • 622
  • 8
  • 17
4
votes
2 answers

Set bold rows in a QTreeView

I have a custom subclass of a QTreeView in a pyqt application. I'm trying to give the user the ability to highlight and "lowlight" (for lack of a better term) rows. Highlighted rows should have bold text and (optionally) a different background…
taynaron
  • 704
  • 1
  • 10
  • 23
4
votes
2 answers

How to span the Columns of a QTreeView in C++/Qt?

I Want to have some long text in one of my columns of the qtreeview (not the first column). This text has to be shown completely but it does not expand. There is a method called SetFirstColumnSpanned. But it only works for the first column. Any…
Cocomico
  • 878
  • 7
  • 18
4
votes
1 answer

QTreeView doesn't scale - is there a workaround to fetch fewer ModelIndexes?

I'm working on an app that uses Qt's QTreeView to display hierarchical data. In some cases a single leaf in the hierarchy will contain 100,000's of child nodes. I've discovered that QTreeView can't handle too many child nodes. This is because when…
Cedric
  • 41
  • 1
4
votes
1 answer

Traverse upto leaf node iOS in Tree Structure TableView

I am stuck at the point where I want to delete the particular Row Object from table but It is dynamic tree structure means object can be created, deleted, reordered, etc at any time using all the Table methods. Tree Structure is dynamic so How to…
krunal
  • 452
  • 3
  • 11
4
votes
2 answers

Customizing QT QTreeView with custom widgets

In my raster drawing program I need to create a layers interface like in Photoshop or Sketchbook Pro. I read the documentation and figured out that I have to use QTreeView. But I didn't find a lot of information in the documentation about creating…
user2487382
4
votes
2 answers

How to get the selected item in a QTreeView

I have a tree like this: |-Parent | |-Child-Child |-Parent | |-Child-Child ... Only the Parents are selectable. How can I get the data from the selected Parent? I tried ui->treeView->selectedIndexes()[0]; but it says that selectedIndexes() is…
gartenriese
  • 4,131
  • 6
  • 36
  • 60