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

Maintaining checkedstatus inheritance in a QTreeView

I'm trying to do something basic : you have a QTreeView. 1st depth are folders only, 2nd depth are files only. I want to have a check box with the checked status next to each item. Files are either checked or unchecked, folders can also be…
Sam
  • 117
  • 11
3
votes
2 answers

Sort QStandardItemModel in c++ Qt

I have a model of type QStandardItemModel which looks like this: QHash roleNames; roleNames[Car2goVehicle::NameRole] = "plate_number"; roleNames[Car2goVehicle::DescriptionRole] = "address"; …
Temirlan
  • 63
  • 1
  • 6
3
votes
3 answers

Finding / removing a row from a QStandardItemModel by item data

I have a QStandardItemModel with a single column (represents a list). Each item in the list has a unique integer ID stored as the QStandardItem's data (via QStandardItem::setData which I guess is into Qt::UserRole+1 by default). Given one of these…
Jason C
  • 38,729
  • 14
  • 126
  • 182
3
votes
1 answer

store and retrieve data on items/rows in a QTreeView()-Object via QStardItemModel()

I am populating data from a SQLite-Database into a PyQt5 TreeView-control (QTreeView). The data is written via the QStandardItemModel(). Problem: I want to remember the row_id per row, without displaying it. I used to select it in the query but hide…
ProfP30
  • 358
  • 3
  • 18
3
votes
1 answer

QML Treeview: How to get QModelIndex of childs

I have a QML TreeView with a QStandardItemModel and use a ItemSelectionModel to manage the selection. The ItemSelectionModel wants a QModelIndex for its select function. How can I obtain the QModelIndex of children in my view? The tree looks like…
maxwell
  • 357
  • 4
  • 14
3
votes
2 answers

ItemIsAutoTristate flag not working as expected

Consider this little snippet: import sys from PyQt5 import QtWidgets from PyQt5 import QtWidgets from PyQt5.QtGui import QStandardItemModel from PyQt5.QtGui import QStandardItem from PyQt5.QtCore import Qt from PyQt5.QtWidgets import…
BPL
  • 9,632
  • 9
  • 59
  • 117
3
votes
1 answer

Proper display of custom QItemDelegates

I am trying to use simple example code I've found in Google. Everything works except as soon as I set the delegate for the column, it's displaying gets buggy. Here are the line where I set the "Bank" string as a value for both rows and…
mekkanizer
  • 722
  • 2
  • 9
  • 28
3
votes
2 answers

How to Copy - Paste Multiple Items form QTableView created by QStandardItemModel to a text/excel file?

How can I copy and paste multiple items/values of a QTableView to a text/ excel file? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, self.File_Name) self.tableView =…
learncode
  • 1,105
  • 4
  • 18
  • 36
3
votes
1 answer

Get Item from QStandardItemModel for QTableView

I have a QTreeView in which each node represents a data object. I managed to pack a pointer to this data objects into a QVariant so that I know which is selected in the Tree. I can access the nodes by the currentIndex() function. The root of the…
3
votes
0 answers

Qt Drag and Drop Mime Data rejection

I have a subclass of QStandardItemModel in which I have drag and drop working quite nicely. I store my data (pointers to classes) in a subclass of QStandardItem. The classes stored in my standarditem all inherit from the same class, and I wish to…
mike
  • 1,192
  • 9
  • 32
3
votes
1 answer

Display a large csv file in PyQt Table View

Im trying to display the Master File Table of an NTFS Volume ,in a PyQt Application . I have extracted the MFT and converted into a csv file , now i wish to display the data in a tabular form using PyQt Table View. The program runs perfectly without…
thecreator232
  • 2,145
  • 1
  • 36
  • 51
3
votes
1 answer

Hyperlink with image in one QTableView cell

I have a QTableView with custom model and delegate. Task is to create cell which will contain image and hyperlink. By clicking on image user will copy hyperlink to clipboard, and by clicking of hyperlink user should open link in browser. Is it a…
developer
  • 319
  • 2
  • 13
3
votes
5 answers

How to Move Up a Selected Row in Qt

I have a QTableView with 3 rows and 2 columns. (Here I am using a QStandardItemModel). I want to move up/move down a single row when a QPushButton is clicked. How can I move up/down a row in QTableView? Thanks for your reply vahancho. I have already…
New Moon
  • 787
  • 6
  • 21
  • 35
3
votes
1 answer

Changing QIcon size in QStandardItemModel

I am trying to make QTableView/QStandardItemModel with arbitrary sized qIcons. In the MWE below, I have successfully changed the height of a row using a delegate. I can't figure out how to make it use a larger icon size in the larger row. Any…
user2064766
  • 31
  • 1
  • 2
3
votes
1 answer

Filter items in QStandardItemModel or QTreeView

I represent same data in QTreeView with QStandardItemModel. Data is table - I have rows and columns, I get it from DB with QSqlQuery. How can I filter rows based on some column value? For example I have third column some integer value, and by…
Alecs
  • 2,256
  • 8
  • 32
  • 45
1
2
3
15 16