Questions tagged [qstandarditem]

The QStandardItem class provides an item for use with the QStandardItemModel class. Items usually contain text, icons, or checkboxes.

The QStandardItem class provides an item for use with the QStandardItemModel class. Items usually contain text, icons, or checkboxes.

Each item can have its own background brush which is set with the setBackground() function. The current background brush can be found with background(). The text label for each item can be rendered with its own font and brush. These are specified with the setFont() and setForeground() functions, and read with font() and foreground().

By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target. Each item's flags can be changed by calling setFlags(). Checkable items can be checked and unchecked with the setCheckState() function. The corresponding checkState() function indicates whether the item is currently checked.

Documentation for Qt 4.8 and for Qt 5.

67 questions
2
votes
1 answer

QStandardItem checkbox changes reflected on object in Pyside

How can I sync the checkboxes in the UI with the properties they are representing? So when I change the checkbox state in the UI it properly sets the value of the property on the class object to match the checkbox state? For example if i click the…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
2
votes
1 answer

setData for second column of QstandardItem

How can i set the data for the second column of a QStandardItem which i then add to a QTreeview? In my case I just want to place a checkbox or text for the sake of example. import sys from PySide import QtGui, QtCore class…
JokerMartini
  • 5,674
  • 9
  • 83
  • 193
2
votes
0 answers

EventFilter capturing events from Different Objects on Mac and Windows

I am working on an application for Windows and Mac. I am noticing different behavior for Mac and Windows. When I set a QLIstView for a QComboBox and try to capture the Enter/Return press events from the PopUp of the comboBox, the eventFilter gets…
Sadaab
  • 83
  • 1
  • 1
  • 7
2
votes
2 answers

how to get the pyqt qtreeview item child using double click event?

I'm using PyQt4 and python 2.7.9. I have a QTreeView that contains data from Oracle database. the code is this: model = QStandardItemModel(0,1) self.treeMedia.setModel(model) for rowalb in self.SELECT_TREE_ALBUM(codus): nodeItem =…
2
votes
1 answer

what is the proper way to keep track objects on a QTreeView/QStandardItem

I have a QTreeView that has three branches under a rootnode QTreeView treeView_4 = new QTreeView(tab_10); QStandardItemModel standardModel = new QStandardItemModel ; QStandardItem *rootNode = standardModel->invisibleRootItem(); QStandardItem…
Angs
  • 1,605
  • 2
  • 23
  • 47
1
vote
1 answer

QTreeView StandardItem.insertRow(0, new_item) inserts itself instead of new_item?

I want to insert an new item to my treeview at row 0 of a child item. The code seemed pretty straight forward but I think I have run into a bug? I simplified the problem in order to avoid tons of unneeded code. Is there something I am doing…
Flip Vernooij
  • 889
  • 6
  • 15
1
vote
1 answer

Set minimum row-height of QComboBox

I am trying to set the minimum height of the rows in the QComboBox dropdown menu without changing their width or the size of the QComboBox itself. By default the width and height of the row items are calculated by its data. To make the dropdown…
Daniel
  • 3,383
  • 4
  • 30
  • 61
1
vote
1 answer

Implementation of clone in QStandardItem subclass

I am using a QStandardItemModel with a QTreeView to display custom Items. The items come in three different types FILTER_TYPE, MODIFIER_TYPE and GROUP_TYPE. I would like to be able to reorder items within the model using drag and drop in the view…
Alex
  • 95
  • 1
  • 10
1
vote
1 answer

QStandardItem doesn't add children on first row

Apparently, setting an item on the same row but on a new column, always adds a new row. from PySide2 import QtCore, QtWidgets, QtGui # Items for the first row my_item = QtGui.QStandardItem('Row 0, Col 0') sub_item = QtGui.QStandardItem('Row 0, Col…
Kos
  • 11
  • 2
1
vote
1 answer

Creating item with a integer, QStandardItem doesn't provide QSpinBox

I use PySide2 and QTableView with QStandardItemModel (object called resourcesModel) in my program. When I use the following code to create, fill and put an item into the table: item = QStandardItem() item.setData(123123,…
kunek
  • 91
  • 5
1
vote
1 answer

How to show description of item selected in column view?

I'm unfamiliar with PyQt and QColumnView, how do I make it so that we get a "description" of whatever the user selects and not another row of items that I can click on extending the column view? class Ui_MainWindow(object): def setupUi(self,…
reyear
  • 15
  • 3
1
vote
1 answer

QStandardItemModel & binding to custom object

I tried to use the cities-standarditem of the Qt exemple and adapt it to my exemple. I have a strange result: Here is my User class: class User{ public: User(); QString getFirstname() const; void setFirstname(const QString &value); QString…
user3178486
  • 321
  • 6
  • 17
1
vote
2 answers

QTreeView with 2 columns for each entry

I want to create a QTreeview with 2 columns. That is no problem so far. I made this with the following code: QStandardItemModel *model = new QStandardItemModel(0,2); ui->treeView->setModel(model); Now I want to fill this TreeView. To do that I…
NelDav
  • 785
  • 2
  • 11
  • 30
1
vote
1 answer

PyQt: How to connect a QStandardItem in a QStandardItemModel to a function

I am creating an application in PyQt in which I have a a list of check boxes which I have created using QStandardItemModel and QStandardItem and it works perfectly. I want to connect the first item in the list which is a 'Select all' check box to a…
Sarah
  • 161
  • 1
  • 3
  • 11
1
vote
1 answer

QT, Python, QTreeView, custom widget, setData - lose reference after drag and drop

This question is similar to the one in this this topic Preserve QStandardItem subclasses in drag and drop but with issue that I cant find a good solution for. That topic partially helps but fail on more complex task. When I create an item in…
Dariusz
  • 960
  • 13
  • 36