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

QTableWidget - combobox delegate how do I allow different options per cell

Aloha I have a QTableWidget with two columns that are currently using a ComboboxDelegate (my subclass of QItemDelegate) to present options to the user. I'd like the choice in the first column to effect the options available in the second, for the…
mike
  • 1,192
  • 9
  • 32
1
vote
0 answers

Modal dialog edition in a QListView

I'm a beginner with QT/PyQt4, and I'm trying to make a QListView display custom objects. It should : Have custom row widgets that display more than one line of text, possibly images Trigger a modal dialog instead of the inline edit field whenever I…
F.X.
  • 6,809
  • 3
  • 49
  • 71
1
vote
1 answer

Custom ItemDelegate for QListView State_Selected

I created CustomItemDelegate from QStyledItemDelegate and i'm using the paint() method to give a better look to my QListView. If I click on an item, option.state never has State_Selected, why is that? I have a selection model, single, row, and the…
Zui
  • 147
  • 1
  • 12
1
vote
0 answers

Reediting a QTableView cell when the given value is not acceptable

I have a QTableView that obtains the data from a custom model and it's edited using a custom delegate. //... view->setModel(stockModel); view->setItemDelegateForColumn(0, nameDelegate); When the user edits a specific cell it types some text (name…
1
vote
0 answers

How to programatically change value of QItemDelegate in QT

I already checked a lot of the topics that seemed similar but they didn't help so I am asking this question. If you know of any duplicate question that is already present please direct me to it. My Situation: I have a (QCombobox) QItemDelegate for 1…
Jiju Paul
  • 13
  • 5
1
vote
1 answer

QTableWidget, allow to type numbers only

I have a QTableWidget with four columns. I want the user to be able to insert only integers in the first three and a double in the fourth. I believe that this can be done with delegate, but I have not found relevant examples (only some with…
Giuseppe
  • 625
  • 1
  • 9
  • 15
1
vote
1 answer

Qt Item Delegate

I am new to Qt and am slowly finding my way around. My goal is to have a QListView of a QFileSytemModel where the names of the files in the icons wraps, similar to the behavior found on any OS where the text gets split if the name is too long. From…
Black Dynamite
  • 4,067
  • 5
  • 40
  • 75
1
vote
1 answer

QAbstractItemModel -- being reset? QItemDelegate::paint() being called too often

This is driving me crazy. I have a QAbstractItemModel, QSortFilterProxyModel, and a QStyledItemDelegate. All are subclassed. After emitting the following dataChanged(), QStyledItemDelegate::paint() should be called for just those two indexes…
1
vote
1 answer

PyQt4 setItemDelegateForRow causing segmentation fault

I'm attempting to set an editor delegate on my QTableView specific to each row of data by using the QTableView.setItemDelegateForRow() method. When I set a delegate on multiple rows it causes PyQt4 to segmentation fault. It seems at least partially…
freakinhippie
  • 91
  • 1
  • 6
1
vote
1 answer

How to add items in QComboBox inside QTableView

I'm having problems adding items in my QComboBox. if possible can anyone tell me how to add items using the code below? class ComboBoxDelegate(QtGui.QItemDelegate): def __init__(self, owner, itemslist): …
Angelica Lim
  • 61
  • 1
  • 6
1
vote
1 answer

PyQt: checkbox delegate inside tableview

I have been able to make my checkbox editable in my tableview. They appear in my tableview but I can't do anything with them. It's like the flags are not properly set up. class CheckBox(QtGui.QStyledItemDelegate): def __init__(self, parent =…
user1028826
  • 71
  • 1
  • 8
1
vote
0 answers

QItemDelegate using different itemRoles at the same time

I'm currently working on a combobox widget inside a QTableview. Which works fine and does what I want! Except of ONE thing: the combobox uses the space which is associated with the Qt::DisplayRole only. But my item consists of a Qt::DecorationRole…
Donny
  • 549
  • 2
  • 10
  • 24
0
votes
7 answers

What is the best way to make a QTableView's cells have up and down button pushed states in Qt?

I'm trying to make the cells of a QTableView look like 3D clickable buttons. So that when you click on a cell, the button looks pushed. Everyone seems to think I merely want to change the colour, I need to show images of a normal button, and a…
Neil
  • 24,551
  • 15
  • 60
  • 81
0
votes
1 answer

Qt: Create a QItemDelegate to have a custom editor (Combo Boxes) in a QTableView with QStandardItemModel

I need to implement a table in Qt that shows a Combo Box on each row on a particular column. So far based on this example: http://doc.qt.nokia.com/4.7-snapshot/itemviews-spinboxdelegate.html and on this question: QStandardItem + QComboBox I…
Fracu
  • 835
  • 1
  • 13
  • 28
0
votes
1 answer

Painting on a QPixmap which is in QListWidget

I've a list of QListWidgetItem in QListWidget(Hor scroll bar is there as num of items is huge). Each QListWidgetItem contains a QPixmap as a data(scaled down to some random value). My requirement is when a QPixmap is clicked that should be…