Questions tagged [qstandarditemmodel]

The QStandardItemModel class provides a generic model for storing custom data.

The QStandardItemModel class provides a generic model for storing custom data.

QStandardItemModel can be used as a repository for standard Qt data types. It is one of the Model/View Classes and is part of Qt's model/view framework.

QStandardItemModel provides a classic item-based approach to working with the model. The items in a QStandardItemModel are provided by QStandardItem.

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

233 questions
0
votes
0 answers

what parameters to be passes to beginInsertRows() when implementing tree.

I have a doubt with canFetch() and fetchMore() functions. i am implementing tree structure, when i scroll till the end canfetch() will be call and if returns true fetchMore() will be called where we have to fetch the data and insert items into…
NDestiny
  • 1,133
  • 1
  • 12
  • 28
0
votes
1 answer

Populating QTreeView from list of file paths

This question has been asked before at: https://stackoverflow.com/questions/26538667/pyqt-populate-qtreeview-from-txt-file-that-contains-file-paths But didn't seem to get a response. I have a dataset of file paths that are formatted, like…
sonictk
  • 178
  • 2
  • 10
0
votes
1 answer

StandardItemModel Qt

QStandardItemModel::​QStandardItemModel(QObject * parent = 0) Constructs a new item model with the given parent. I thought models can share multiple views then why we are passing a widget to QStandardItemModel Constructor?
Freiza
  • 77
  • 1
  • 9
0
votes
1 answer

Qt Re-factoring QStandardItemModel

I think I have made a big mistake. QtCreater does not recognize QStandardItemModel anymore, I highlighted QStandardItemModel, and hit "Refactor" -> "rename Symbol under cursor" and renamed it QAbstractItemModel. With the intention of refacting…
user4217633
  • 71
  • 3
  • 10
0
votes
2 answers

Get QStandardItem for the custom context menu of a QTreeView

I have a subclass of QTreeView. I need a custom context menu for specific items in it. To get this I set the context menu policy and connect the signal "customContextMenuRequested" in the constructor of the subclass of…
bogdan
  • 201
  • 1
  • 2
  • 6
0
votes
2 answers

Storing custom objects in QStandardItemModel

I'd like to store custom objects (let's say instances of MyDataClass) in a tree structure, and linked with a view. So I used QStandardItemModel. I think that MyDataClass should inherit from QStandardItem : class MyDataClass : public…
0
votes
1 answer

how to append a QStandardItem into two rows

What I want to have is: Root ------ item1 | --- newItem |_____ item 2 | --- newItem |_____ item 3 Here is the code: QStandardItem *item1 = new QStandardItem(QString("item1")); QStandardItem *item2 = new…
sven
  • 1,101
  • 7
  • 21
  • 44
0
votes
1 answer

setData raises exit code -1073741819

I have a subclass of QtGui.QStandardItemModel with setData as follow: def setData(self, index, value, role): if role == QtCore.Qt.EditRole: old = self.itemFromIndex(index).text() new = value …
f.rodrigues
  • 3,499
  • 6
  • 26
  • 62
0
votes
1 answer

How do I get a whole row from a Multi-Column PyQT Qtreeview?

I am relatively new to PyQT and I have been researching long and hard and I just cannot find an answer to this question. Basically what I have is a QTreeView which is populated with data from a QStandardItemModel. This data has 2 columns and there…
HawksFan21
  • 103
  • 1
  • 6
0
votes
1 answer

QT - QTableView removeRow() crashing

This function should remove a row from my QStandardItemModel attached to a QTable View. void ModManager::delete_Addin(int index) { QString addinId; int i; addinId = tableModel->item(index,0)->text(); for(i=0;isize();i++) …
movildima
  • 37
  • 1
  • 9
0
votes
1 answer

Inserting empty rows into table due to 'duplicate items'

I have a table view that requires the same information on multiple rows however these rows keep appearing empty and the same log message appears 'Ignoring duplicate insertion of item' Basically I iterate over a model setup to contain all…
0
votes
0 answers

QStandardItemModel: any efficient way to add a batch of items?

Is there any efficient way to add a batch of QStandardItems to a model? The model is being cleared and then I'm adding a lot of items. QtreeWidget has addTopLevelItems ( const QList & items ) for just this, how to optimize such…
Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
0
votes
0 answers

Comparing check state of table items

I have setup a QStandardItemModel and populated it with data from another model which querys the database. The model is used in a table view where I display the information to the user. The first column is a 'check box' field which the user can…
0
votes
0 answers

rowCount() always return 0 if current item is folded

I have a QSortProxyFilterModel which is the model of a QTreeView. And a QStandardItemModel serves as the source model of the QSortProxyFilterModel. Now I'm trying to get the child count of the current model: // my_filterModel is the…
daisy
  • 22,498
  • 29
  • 129
  • 265
0
votes
1 answer

Qt5 Is it possible to retrieve an item's checkstate from a combobox without having a pointer to the model?

I know you can do it when you have access to the QStandardItemModel but using combobox->model() returns a QAbstractItemModel which doesn't have the item(int row, int col) accessor. I've tried working with QAbstractItemModel::itemData(QModelIndex)…
Jarrod Cabalzar
  • 408
  • 1
  • 5
  • 24