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
7
votes
1 answer

QTreeView memory consumption

I'm testing QTreeView functionality right now, and i was amazed by one thing. It seems that QTreeView memory consumption depends on items count O_O. This is highly unusual, since model-view containers of such type only keeps track for items being…
grigoryvp
  • 40,413
  • 64
  • 174
  • 277
7
votes
2 answers

Remove blue selection from QTreeView in "fusion" style

I have a QTreeView with a stylesheet defining the selection. However, when I use the "fusion" style, there is an additional blue selection rectangle over the decoration: I've tried using show-decoration-selected: 0; in the style sheet, as well as…
Nicolas Holthaus
  • 7,763
  • 4
  • 42
  • 97
7
votes
1 answer

DoubleClick events on Qtreeview items

I am working on QTreeView to explore the hard drive partition.In my Qtreeview, on Double click event on its items of treeview single click event also generates.…
Ashish
  • 219
  • 2
  • 6
  • 22
6
votes
1 answer

QTreeView & QAbstractItemModel & insertRow

I'm trying to implement QAbstractItemModel for QTreeView. I have problem with inserting rows. I noticed that if I insert at the beginning of my application all works fine. But If I insert rows later - after some other operations (like selections…
Lukasz Spas
  • 595
  • 2
  • 9
  • 23
6
votes
3 answers

How to remove QTreeView indentation

I want to have a QTreeView without an indentation on the left side increasing at each nesting level. I tried setting QTreeView::setIndentation(0). It removes the indentations just as I want, however it also hides the tree arrows. Default…
John Doe
  • 555
  • 6
  • 17
6
votes
1 answer

How to flag rows to be hidden in QAbstractItemModel-derived model

I'm implementing a Qt based tree view, where the view is a QTreeView-based class and the model is a QAbstractItemModel-based class. The tree is supposed to have millions of nodes in it. I'm implementing a filtering mechanism, in which filtered out…
susiriss
  • 83
  • 1
  • 5
6
votes
2 answers

QTreeview change icon on row Icon click

How can I trigger the changing of an icon when the user clicks the Icon only for the items/rows in the list which are of type File. Each row in the treeview contains an object in the UserRole called TreeItem which stores if the item is marked as a…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
6
votes
2 answers

PyQt QTreeView: Trying to connect to the selectionChanged signal

I am trying to connect to the selectionChanged signal of a QTreeView using PyQt. I have done this in the past (for a QTableView) and was successful. But now I cannot get similar code to work. In the following code example, I successfully connect to…
bvz
  • 869
  • 3
  • 13
  • 25
6
votes
1 answer

prevent QTreeView item from auto collapsing after filtering out

I'm implementing an incremental search field for a QTreeView using QSortFilterProxyModel. The search field is a QLineEdit as follows: self.ui_search_lineedit.textEdited[unicode].connect(self._onSearchEdited) and my _onSearchEdited function looks…
user110
  • 315
  • 1
  • 11
6
votes
2 answers

PySide (PyQt) QAbstractItemModel

I am trying to implement a simple model for a treeview and I can't figure out why it isn't working.. It seems that all my nodes are children of my root node although three of them should be children of it's first child. Also I can see that my…
Stamoulohta
  • 649
  • 1
  • 7
  • 21
5
votes
3 answers

Get and set the active row in QTreeview programmatically (PyQt)

Is there a way to get and change the active row in a QTreeView (not QTreeWidget)? By active, I mean the row with the focus highlight, not the selected row. In the paint event, I can use QStyle.State_HasFocus to get the active row, but this doesn't…
D K
  • 5,530
  • 7
  • 31
  • 45
5
votes
1 answer

Qt error "persistent model indexes corrupted" why?

I've a problem with my Qt/interview application. I use QTreeView to display tree data. I implemented my own model based on QAbstractItemModel. I get a following error prior to application crash. It happens often after I add new record. Could You…
user666491
5
votes
1 answer

How to simulate a drag and drop action using QTest

In order to create a test case for a drag and drop bug in the QTreeView widget I tried to simulate a drag and drop mouse movement behavior. I basically select the first element in the QTreeView and want it to drag and drop on the third element. I…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
5
votes
2 answers

Get the text and index of the current selected QTreeView item

I was wondering how I can return the text value, and index of a selected item in a QTreeView. I tried using: self.TreeView.selectedIndexes() but that returns a QModelIndex. I'm not exactly sure how to convert that to an integer value. Googling…
artomason
  • 3,625
  • 5
  • 20
  • 43
5
votes
2 answers

QTreeView disable showing of root node

In my project I'm using a QTreeView in order to display a plot configuration. On top I have a root node called PlotConfig containing several plot windows. Each plot window contains several simple xy plots. So basically, I have something like…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
1 2
3
54 55