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

PyQt crashes when QtItemDelegate subclass has two or more instances

I'm implementing a delegate for a QTableView where two columns should be dropdowns where the user selects a value from an enum. Below is an example: from PyQt4 import QtGui, QtCore import enum Color = enum.Enum("Color", ("RED", "BLUE")) Shape =…
Kaia
  • 862
  • 5
  • 21
0
votes
1 answer

Is there a way to put negative floats in a QSpinBox?

I am trying to find a way to put negative numbers in a QDoubleSpinBox. I read the documentation but haven't found the solution yet. Here is the class I made to customize my QDoubleSpinBox : class ComboBoxDelegate(QStyledItemDelegate): """A…
Thomas.C
  • 7
  • 5
0
votes
2 answers

PYQT QTableView Delegate can not show createEditor when applied with Proxy

I'm having problem to show the Editor Widget when Delegate is applied with the Proxy situation. -> self.table.setModel(self.proxy) If the Delegate is applied to the View/Model structure, then there is no problem at all. ->…
0
votes
1 answer

The QItemDelegate is not rendered in the same way across columns QCalendarWidget

I try to make a corner in the cells of my QCalendarWidget. So I made a QItemDelegate in which I draw my triangle. As the screenshot shows, the delegate works fine on the first column, but is completely broken on the others. I don't understand where…
Pixidream
  • 13
  • 3
0
votes
1 answer

Update QAbstractTableModel when combobox changed

I am trying to update my model when a combo box is changed. I have a function connected to the combobox that updates the model but from this question - "the delegates should use the base functions of the model whenever they provide standard behavior…
0
votes
1 answer

Adding row to QTableView with model and and delegate widgets

I am trying to add a row to QTableView with a QAbstractTableModel and QItemDelegate where the widgets appear in the added row. From what I've read I need to call .edit(index) on each item of the added row to call createEditor where the widgets are…
Zoes
  • 29
  • 4
0
votes
1 answer

Can't PaintCell after using QItemDelegate to change date position for a QCalendarWidget

I am trying to override QCalendarWidget's paintCell() method to paint a red outline on today's date cell and draw events that will be defined by the user. For my calendar, I used a QItemDelegate to change the alignment of the date flags so I would…
Streeter
  • 23
  • 5
0
votes
1 answer

qml TableView itemdelegate not firing (using a QAbstractTableModel)

Im trying to get my first QML TableView to work in Qt 5.2 (since we are stuck on that version right now at work) using a QAbstractTableModel on the backend. My main issue is that for some reason the itemDelegate is never firing so I never see…
Tim
  • 647
  • 1
  • 10
  • 21
0
votes
1 answer

Why does a QSize height set in sizeHint return a QRect with double the height?

I feel like I miss something extremely obvious, but couldn't find anything on it. I have a custom item delegate for which I set the sizeHint height to 50, but the print statement returns a rectangle that is double the height. def sizeHint(self,…
Vortek
  • 13
  • 5
0
votes
0 answers

QT Decorationrole gets overwritten by decorationrole child

I have made a treewidget within a navigation panel. The top item consist of the following three "subitems" ActorColor | DeviceName | DeviceStatus (LED) One layer lower, the child of this top item consists of the following subitems Actorcolor |…
0
votes
1 answer

QTableWidget ItemDelegate breaks selection style

In the following Python 2.7, PyQt4 example, I generate 2 QTableWidgets. Table1 has no ItemDelegate and the table2 has HTMLDelegate. Selected background color works if the table has focus, but when the table loses focus, the blue selection turns…
panofish
  • 7,578
  • 13
  • 55
  • 96
0
votes
1 answer

How to use QitemDelegate with multiple proxy models stacked?

This question is related to this previous question: how to use QSortFilterProxyModel for filter a 2d array? i have been trying to stack several proxy model to display a 2d array of data into a qtableview. @eyllanesc provided a really cool solution…
nicosalto
  • 33
  • 1
  • 6
0
votes
1 answer

PyQt - QCombobox in QTableview

I am displaying data from an SQLite database in a QTableView using a QSqlTableModel. Letting the user edit this data works fine. However, for some columns I want to use QComboboxes instead of free text cells, to restrict the list of possible…
CodingCat
  • 4,999
  • 10
  • 37
  • 59
0
votes
1 answer

How to locate the row number of my button in QTableview in Qt

I have a function that adds a QStyleOptionButton to certain column in QTableview, I want to be able to get the row number of each of the button when clicked and store the value in a variable. This is my code…
0
votes
1 answer

PyQt5 allow selection of QListView items while editing

I am trying to get click events (ultimately left, right and double click) to "pass through" an editor widget to the underlying QListView so that selections can happen. Figured Event Filters were probably the way to go, but I am a little confused as…