Questions tagged [qabstractitemmodel]
QAbstractItemModel is a class in the Qt framework. It provides the abstract interface for item model classes.
qabstractitemmodel
351
questions
-1
votes
1
answer
26
views
Set QTableView cell size when using fetch more?
I can set the size of my table rows using the following code:
table = QTableView()
table.setModel(CustomModel(dataFrame))
table.resizeRowsToContents()
My CustomModel.data() function ...
1
vote
1
answer
59
views
Why is this QAbstractItemModel based model not working?
I create a simple QMainWindow app as follows:
The header file:
//mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QAbstractItemModel>
#include <QTreeView>
#include <...
0
votes
1
answer
54
views
Python Qt6 Updating Model Based on View Edits
I am attempting to create a mvc app that can take a JSON file, make a TreeView from it, allow the user to make edits, then save the edits to a JSON file. I am having trouble understanding how to ...
0
votes
1
answer
52
views
How to get rid of unwanted rounded squares (checkboxes) in QTableView items? [duplicate]
I have a QTableView with some data (numbers), but each cell contains an unwanted rounded square (maybe a non-functional checkbox). They look bad, occupy space, and can obscure my data.
Why do they ...
0
votes
0
answers
68
views
QML GridLayout analogue to show table model content
It is possible to use GridLayout to show list models content in QML. I need a layout that can show content of table models that return data for row & column (QAbstractTableModel - derived classes),...
0
votes
1
answer
115
views
How do I get Qlistview to include all the search details for pdf hits in QPdfSearchModel Class for python like it does in the documentation
When I do a pdf search using the QPdfsearchmodel class my model only seems to include the word I searched for and context before/context after:
However, in the documentation there is also a listing ...
1
vote
0
answers
42
views
Does QAbstractItemModel's sort notify the view?
I have implemented a custom QAbstractItemModel subclass, and from my understanding, the QAbstractItemModel::sort() method can be overridden in a derived class to implement custom sorting logic, which ...
2
votes
1
answer
67
views
With QAbstractListModel, is it necessary to implement insertRows and removeRows if the model is resizable?
I'm implementing a QAbstractListModel-derived class (though this question can apply to QAbstractItemModel as well) that will be a QListView's model. The list view is intended to be a log with a ...
1
vote
1
answer
76
views
The top-level item of an QAbstractItemModel is not shown in a QTreeView
Why is only the heading displayed in a QTreeView, but not the item (with string-data "Item1") itself?
The model is set correctly via setModel() on the QTreeView and no other properties are ...
0
votes
1
answer
65
views
UI crashes when deleting the last child of an item in my QTreeView
my UI crashes without returning any error message when I try to delete the last child of an Item in my QTreeView. I saw this post that gave a solution but it dosn't work for me, even if I add those ...
2
votes
1
answer
1k
views
Update a QTableView entirely when data has changed
I have a QTableView using a custom QAbstractTableModel, and I would like to update the entire table view when the underlying data has change.
Note that a data change can be anything:
rows inserted
...
-1
votes
1
answer
63
views
Tree selection clears when data model refresh
I have a treeview in which I have applied sorting/filtering using QSortFilterProxyModel.
When I perform some action on tree item(ex. RMB action), I refresh my data model(QAbstractItemModel).
I am ...
0
votes
1
answer
337
views
QAbstractListModel example with MVVM pattern
I am trying to display the list of items that comes from QAbstractListModel on a QML List View using the MVVM pattern. To keep it simple my reading/accessing architecture will be something like this-...
0
votes
0
answers
118
views
Displaying Qt tree through QAbstractItemModel and QModelIndex
I'm trying to display a user defined tree Family_tree through a TreeModel class derived from QAbstractItemModel containing a Family_tree ft_ member and the overrides for the index, parent, data etc ...
0
votes
0
answers
214
views
How to override parent in QSortFilterProxyModel?
I have an ObjectTreeModel class that inherits from QAbstractItemModel. The model stores ObjectTreeItem elements that have the _placement property, which is the uuid of another ObjectTreeItem element. ...