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

Use QItemDelegate to show image thumbnails

What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)? Can anyone link to some example…
Thomi
  • 11,647
  • 13
  • 72
  • 110
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
1 answer

How do I determine if the item is selected or not in the paint() function of QItemDelegate?

I am making a table using QItemDelegate. I use the paint(..) method to draw delegated items to look the same when they go out of edit mode but I also need to draw the items differently when they are selected or not and the paint method is also…
yan bellavance
  • 4,710
  • 20
  • 62
  • 93
3
votes
1 answer

Should I use Delegate Classes if I want items to be edited using a dialog in Qt?

All examples in Qt show that one should use delegate classes to provide editors that reside within QTreeView (QListView, etc). I want to have a separate non-modal dialog to edit item's attributes. Should I use delegate classes to do so? That is, no…
Andrew T
  • 5,549
  • 7
  • 43
  • 55
2
votes
2 answers

Using QItemDelegate with QAbstractTableModel

I have a QAbstractItemModel and a QItemDelegate and here is my problem. The Delegate does nothing. Its subroutines are being called but nothing happens. Here is what I would like to see in my table. Text : QComboBox : Text : Text :…
jecjackal
  • 1,407
  • 2
  • 20
  • 35
2
votes
1 answer

custom delegate doesn't follow when reordering QTableView

I'm using a custom delegate to display a column of comboBoxes in my QTableView. In addition to the default selection issue (enter link description here) I have a problem when I reorder the data of my QTableView (per column, or by applying filters).…
Johanna
  • 1,343
  • 4
  • 25
  • 44
2
votes
1 answer

selected item of comboBox in custom Delegate from QTableView

I use a custom delegate to display a column of comboBoxes in my QTableView. The values are the same for all the comboBoxes so it's not really the population part that gives me trouble. I want them to show as the selected item, some value that I can…
Johanna
  • 1,343
  • 4
  • 25
  • 44
2
votes
1 answer

QML ItemDelegate highlighted property not work

I want to customize highlight color in ItemDelegate. If I use default ItemDelegate with Material theme then all ok and color change when i hover over this item, but when I redefine background it breaks down and colors not change…
ChabErch
  • 35
  • 1
  • 5
2
votes
1 answer

QStyledItemDelegate: commit QComboBox value to model on click

I am setting a QStyledItemDelegate on my model for a particular field, and returning a QComboBox from QStyledItemDelegate::createEditor QComboBox* createEditor(QWidget* parent) { QComboBox* cb = new QComboBox(parent); …
Steve Lorimer
  • 27,059
  • 17
  • 118
  • 213
2
votes
1 answer

QPushButton is not showing on QTableView (QItemDelegate procedure used)

I have a QTableView of 4 rows and 4 columns. I am trying to add a QPushButton to all cells of the last column only, with the exception of the first row. When I run my code I am able to see the table but when I click on each cell of the 4 column I…
user9174145
2
votes
0 answers

Drag and Drop in QML TreeView

In QML i have a TreeView with (properly working) multiselection: TreeView { id: treeview anchors.fill: parent model: myTestModel selectionMode: SelectionMode.ExtendedSelection selection: ItemSelectionModel { model:…
ToeBee
  • 241
  • 4
  • 10
2
votes
1 answer

How to use QWidget with QItemDelegate and QTableView

Doble-clicking the item in QTableView brings up the QWidget which is created by QItemDelegates createEditor() method. The problem is that the QWidget is offset from the QTableView window and it is floating somewhere on a desktop (at the corner of…
alphanumeric
  • 17,967
  • 64
  • 244
  • 392
2
votes
1 answer

QItemDelegate, how to provide my own EndEditHint in closeEditor() signal?

I have my own table model subclassed from QAbstractTableModel. It is installed on my view (subclassed from QTableView). Inside the view, I'm using a delegate class (subclassed from QItemDelegate) for editing items. I want to set up the following…
DKurulyuk
  • 71
  • 4
2
votes
2 answers

HowTo combine QAbstractTableModel and QItemDelegate to one working source?

I have a QTableView defines in UI file. Here is the figure: I'd like to make month change (where the red array points) with QComboBox widget, dealing with delegates, but for me, for my custom delegate and model it's a too complex problem, and I…
mosg
  • 12,041
  • 12
  • 65
  • 87
2
votes
1 answer

Qt QAbstractItemModel function data() called with undefined role

I want to create a custom list using QListView and so I had to extend QListView, QItemDelegate and QAbstractListModel and then implement the specific methods, along with QAbstractItemModel::data(const QModelIndex & index, int role = Qt::DisplayRole)…
Ispas Claudiu
  • 1,890
  • 2
  • 28
  • 54
1 2
3
9 10