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

QAbstractItemModel Lazy Loading locks application

I have implemented canFetchMore, hasChildren and fetchMore in order to allow my model to be lazy loaded. It's very simple and based on QT's: http://doc.qt.io/archives/qt-4.7/itemviews-simpletreemodel.html My problem is that in my application…
dpwr
  • 2,732
  • 1
  • 23
  • 38
0
votes
1 answer

Qt Ignore Right Click in QItemSelectionModel

Is there anyway to detect which mouse button was clicked from inside a QItemSelectionModel? I want to block a right mouse click from changing the selection. I am using this was a QTreeWidget, so if there is a way to mask the whole thing, that would…
Rafe
  • 1,937
  • 22
  • 31
0
votes
2 answers

How to hide the expand/collapse control in QTreeView?

When using QTreeView to display a multi-column list, where the rows have no children and the underlying model is QAbstractTableModel, how does one hide the expand/collapse control?
glennr
  • 2,069
  • 2
  • 26
  • 37
0
votes
1 answer

Auto expand QTreeView Items

I am trying to change QTreeView with a auto update and I am able to set path with this code tree->setCurrentIndex(fsModel->index(QDir::currentPath())); // or any path## Heading ## Got from this link But my question is how I can expand once…
Achayan
  • 5,720
  • 2
  • 39
  • 61
0
votes
1 answer

How to assign different Url to my TreeView Items

I am new to Qt. I had created a Qtree View using QStandard item model. Now I want to set Url to my items. How can I assign url for tree view items.
New Moon
  • 787
  • 6
  • 21
  • 35
-1
votes
0 answers

Qt Designer + PyQt5 File Browser dosen't works

I'm trying to make a File Browser with Qt Designer and PyQt5 but it dosen't work well, I think it mitght be the self.ui import sys from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QFileDialog, QTreeWidget, QTreeView,…
-1
votes
1 answer

How to use a proxy-model to make tree-model from source model in qt?

I have a source model source_model = TokenModel(QAbstractListModel), which I use with several views at once. It contains a list of tokens _tokens: list[TokenClass]. I also want to use it in QTreeView. To do this, I create a…
Ferrus
  • 1
  • 2
-1
votes
1 answer

Position two QTreeView in QHBoxLayout

i want to display two QTreeViews inside one window and i cant figure out why my testing code doesn't show the red widget (future 2nd TreeView). Any ideas why it doesn't appear? I am new to PyQt5 and ive followed a tutorial on youtube and a written…
Tom
  • 37
  • 8
-1
votes
1 answer

How to open multiple persistent windows in PyQt?

I am trying to display JSON metadata in PyQt6/PySide6 QTreeView. I want to generalize for the case where multiple persistent windows (QtWidgets) pop up if my JSON metadata list has a length greater than 1. for example: def openTreeWidget(app, jmd): …
Ady
  • 9
  • 2
-1
votes
1 answer

PyQt5 QTreeView.clear() AttributeError: 'QTreeView' object has no attribute 'clear'

File "/.../.../........./app.py", line 64, in textchanged self.treeView.clear() AttributeError: 'QTreeView' object has no attribute 'clear' Any idea how to clear a QTreeView Widget? Google was no help tried…
pippo1980
  • 2,181
  • 3
  • 14
  • 30
-1
votes
1 answer

Easiest way for sorting a QTreeView

I'm trying to do some basic Qt file manager app in Python 3.6 with PySide2. Code is like this: class MainWidget(QWidget): startDir = "." def __init__(self): super().__init__() isDirselectDone = self.selectContentDir() …
-1
votes
1 answer

Creating a tree structure with dict and lists in Python for QTreeView

First of all Im out of practice and Im trying to create a tree structure in Python 3.8 to feed my QTreeView. I read the output of zfs (subprocess.check_output) and split the whole stuff to have a list with pool names: Example list: pools =…
PyCoder
  • 3
  • 2
-1
votes
1 answer

How to get value of current selection in QTreeView i am using StandardItemModel()

I am using QTreeView to display data with parent child relationship. child tree-view can in turn have another set of child as well. Here i am using strip() method inside "load_os_compartment_bucket()" to expand parent and show its child contents…
vinodh
  • 167
  • 2
  • 8
-1
votes
1 answer

How to get identation width of QTreeView from QStyle

I have pre-existing code which has a tree view like appearance but doesn't actually use QTreeView (uses QListWidget with custom paint). I am tasked to add the indentation between the parent and child objects, but I can't able to find how to…
unknown.prince
  • 710
  • 6
  • 19
-1
votes
1 answer

How to make a QTreeView display more than 10 lines

Using Python 3.7 with pyqt5 on Win10 I am working on getting a QTreeView that uses a QStandardItemModel to display more than 10 lines. I want it to show the maximum number of lines the area can actually handle but it stops short at 10 for some…
Dennis Jensen
  • 214
  • 1
  • 14
1 2 3
54
55