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

How to iterate through a QStandardItemModel completely?

I have a QStandardItemModel, which I display in q QTreeView. Works fine. To highlight relevant rows I want to highlight some of them: Therefore I have a QStringList with the names of the QStandItem* s to be highlighted. QStringList…
Ralf Wickum
  • 2,850
  • 9
  • 55
  • 103
13
votes
1 answer

How to remove the vertical header in QStandardItemModel?

I have created a table using QTableView and a QStandardItem widget. How to remove the vertical header from QStandardItemModel?
Masthan
  • 727
  • 1
  • 8
  • 29
10
votes
1 answer

PyQT -- How can you make a QTreeview uneditable but also selectable?

I just switched from wxPython to PyQT and I am having some trouble with the QTreeview. I have a QTreeview that will display data categorized into sections that are expandable, but the data in this TreeView should not be editable, but I need to be…
9
votes
1 answer

Temporarily disable UI update of a QTableView

I have a QStandardItemModel that provides data for a QTableView and a thread that inserts data into the model. Is it possible to temporarily stop the model from updating the table view, and enable it later?
daisy
  • 22,498
  • 29
  • 129
  • 265
6
votes
1 answer

Add items to columns in QStandardItemModel

I am currently adding rows to my QTableView as such QStandardItem* itm; QStandardItemModel* model = new QStandardItemModel(this); model->setColumnCount(2); model->appendRow(new QStandardItem("Some Text in Column1"); How do I add items to column 2…
James Franco
  • 4,516
  • 10
  • 38
  • 80
6
votes
2 answers

How to serialize a QAbstractItemModel into QDataStream?

I've set up a QAbstractItemModel and filled that with data. My QTreeView widget displays every data in that model properly. Now, I would like to store that model serialized in a binary file (and later of cource load that binary file back into a…
6
votes
2 answers

Copy QStandardItemModel to another

Is there some way to Copy a QStandardItemModel to another QStandardItemModel? Or must I iterate over each tem and append it to the other Model?
Matthias
  • 461
  • 7
  • 24
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

How do I delete all items from a QStandardItemModel

I am having some trouble with my QStandardItemModel. What I want to do is add a list to my model, and when the list is updated, I pass the new list in the parameter, clear the old model and add the new list. This sounds simple enough but i'm coming…
Simpsons
  • 476
  • 1
  • 7
  • 17
5
votes
1 answer

QComboBox with checkboxes

I'm creating QComboBox with checkboxes. How I can prevent collapsing of view on mouse clicking? I want to be able to set up checkboxes, but each time I click on item - drop-down of QComboBox is collapsed. Note: currently I'm debugging Qt sources and…
Dmitry Sazonov
  • 8,801
  • 1
  • 35
  • 61
4
votes
2 answers

QTableView, QStandardItemModel and Signals

I have a QTableView, populated with a QStandardItemModel. I update the model frequently over network and the model is also updated by user directly via the QTableView. Now I like to call a method when the user is changing some data, so i…
nfo
  • 637
  • 2
  • 6
  • 19
4
votes
1 answer

PyQt5: How to generate a QTreeView from a list of dictionary items?

I have a dataset like this: [{'level': 0, 'dbID': 77, 'parent_ID': 6, 'short_name': '0:0:0: to 6', 'long_name': '', 'order': 1, 'pos': 0} , {'level': 1, 'dbID': 88, 'parent_ID': 77, 'short_name': '1:1:1:Store13', 'long_name': '', 'order': 2,…
4
votes
0 answers

adding row to the QStandardItemModel

I have QStandardItemModel and the data are represented as lists model = QtGui.QStandardItemModel(0, 2) myrow = [1, "B"] My first solution how to add the row was with function setData() model.insertRow(0) for i,item in enumerate(myrow): …
Meloun
  • 13,601
  • 17
  • 64
  • 93
4
votes
1 answer

Custom QStandardItemModel with custom data method

what i am trying to do is , i want to make a listView with checkable items. I was able to do it using QStandardItemModel as my model. Now what i need to do is add some features that require a custom data method . So as we would do, i sub-classed…
thecreator232
  • 2,145
  • 1
  • 36
  • 51
4
votes
1 answer

QStandardItemModel -- delete a row

I am using QStandardItemModel inside QTableView. Here I have two button & QTableView inside my mainwindow. Rows will vary inside the model. Two Buttons are there to add/delete a row (test case). Adding row to the model is working, slot for the ADD…
Katoch
  • 2,709
  • 9
  • 51
  • 84
1
2 3
15 16