Questions tagged [qitemdelegate]

QItemDelegate is a Qt class which provides display and editing facilities for data items from a model.

The QItemDelegate class is one of the Model/View Classes and is part of Qt's model/view framework.

QItemDelegate can be used to provide custom display features and editor widgets for item views based on QAbstractItemView subclasses. Using a delegate for this purpose allows the display and editing mechanisms to be customized and developed independently from the model and view.

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

145 questions
1
vote
1 answer

PyQt5 Highlighting a selected TreeWidget cell

In short, my tree table works with floating points and I wanted to restrict the number of decimal places shown in the table, but I didn't want to lose the data because I perform calculations with it. I subclassed ItemDelegate and overrode the paint…
Jacob Rodal
  • 620
  • 1
  • 6
  • 12
1
vote
2 answers

QAbstractItemDelegate painting while dragging problem

I'm overloading the paint() function in QAbstractItemDelegate (my own Item delegate class). When dragging, it paints the contents of the entire cell, which I don't want. I'm assuming that the paint() function is called with something specific while…
rickb
  • 601
  • 5
  • 19
1
vote
1 answer

How to make a custom QItemDelegate for a particular row in a QTreeView?

How to make a custom QItemDelegate like on the attached picture. This is a QTreeView. The last element I want to customize and add a QItemDelegate For now I have only green separator line and would like to add a QCheckBox below the separator. How…
Bob
  • 1,433
  • 1
  • 16
  • 36
1
vote
1 answer

Using QItemDelegate to show icons in place of text in a table in PyQt5

With PyQt5 I am trying to use QItemDelegate to show an icon instead of a text string in a cell in a table. Essentially I construct a subclass of the QItemDelegate using: de = MyDelegate(self.attribute_table_view) Here dself.attribute_table_view is…
Philip Whitten
  • 293
  • 2
  • 16
1
vote
1 answer

How to set text color QTableView with QFileSystemModel in Qt?

I use Qtableview to show file and folder (only show icon, filename, size). I want to paint text color(all text in row) for a few specific files. Eg: file starts with 'ABC' is gray; 'XYZ' is red,...
kien bui
  • 1,760
  • 2
  • 17
  • 33
1
vote
1 answer

Force QItemDelegate to repaint

I am currently trying to get custom delegate to change a color it is painting with via an external button. I currently have it working in the sense of the button will change the color the delegate draws with but the delegate does not update upon the…
1
vote
1 answer

Setting a particular cell with a color (red/green /yellow) on Qtableview

I been searching for how to set a color on a specific cell on a qtableview. Currently ,I am using the qt example frozen column to see how to set a color on a particular cell. I search on the forums about how to tell to use qitemdelegate or…
1
vote
0 answers

QStyledItemDelegate with QComboBox with QTableView control (how to pass signal)

I wonder if someone can put me in the right direction, with his/her wisdom and skill of Qt programming as I have following logic issue with my project: I am using three different controls of delegate with QtableView i. ProdIdDelegate public…
shylock
  • 41
  • 5
1
vote
2 answers

Resizing QTableView section with custom editor

I have an application with a QTableView and a model derived from QAbstractItemModel: the first column of the table contains a text (a label for each row), while the second column shows a value that can be selected using a QComboBox created from a…
cbuchart
  • 10,847
  • 9
  • 53
  • 93
1
vote
2 answers

Using custom QItemDelegate with a QSortFilterProxyModel

I have a custom QSortFilterProxyModel to only show certain rows and columns in a table. I also have a custom QItemDelegate to control how certain values in the table are drawn. I'm only applying the delegate to the columns that need it and the…
Moohasha
  • 245
  • 1
  • 13
1
vote
1 answer

Qt QItemDelegate Commit data and close Editor on mouse leave the view widget (listView)

I had a problem with calling off the editor of my listView, when mouse left it. I have managed to solve my problem. It was not obvious to me, so I've decided to post my solution: In delegate header file Ive created a editor widget pointer, and in…
Szpaqn
  • 545
  • 5
  • 17
1
vote
2 answers

Call QFileDialog when trying to edit cell in QTableView

Is there a way of doing this without using a QItemDelegate? I've been having a lot of trouble with it. For example, if I use a Delegate: Won't have a native dialog. I'll have to implement my own image preview, For some reason I can't resize the…
Alberto Toglia
  • 381
  • 1
  • 5
  • 17
1
vote
2 answers

Formatting data in a QTableView

I'm using a custom delegate to display QDoubleSpinBoxes in a QTableView. Those spinboxes display their contents with two decimals. My problem is that I would like the QTableView to also display those numbers with two decimals while they are not…
Etienne de Martel
  • 34,692
  • 8
  • 91
  • 111
1
vote
1 answer

How to stop Item Delegate from blocking mousePressEvent

The QTableView was assigned QAbstractTableModel as a model. And ItemDelegate(QItemDelegate) was assigned with tableView.openPersistentEditor. Now when tableView is clicked the event does not propagate all the way to the tableView (does it get…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
1
vote
1 answer

How to get delegate item when QTableView is clicked

The code below creates the single QTableView. There is a QItemDelegate is assigned as a PersistentEditor. There are two kind of editors created: QLineEdit is created for the column 0 and the 'QComboBox` is created for the column 1. When the…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392