Questions tagged [qstyleditemdelegate]

The QStyledItemDelegate class, part of the Qt framework, provides display and editing facilities for data items from a model.

When displaying data from models in Qt item views, e.g., a QTableView, the individual items are drawn by a delegate. Also, when an item is edited, it provides an editor widget, which is placed on top of the item view while editing takes place. QStyledItemDelegate is the default delegate for all Qt item views, and is installed upon them when they are created.

The QStyledItemDelegate class is one of the Model/View Classes and is part of Qt's model/view framework. The delegate allows the display and editing of items to be developed independently from the model and view.

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

143 questions
16
votes
1 answer

What is the difference between QItemDelegate and QStyledItemDelegate?

Both classes provide display and editing facilities for data items from a model. QStyledItemDelegate is newer and the Qt documentation about QItemDelegate states that : Note that QStyledItemDelegate has taken over the job of drawing Qt's item…
Nejat
  • 31,784
  • 12
  • 106
  • 138
13
votes
3 answers

Render QWidget in paint() method of QWidgetDelegate for a QListView

i'm having difficulties implementing custom widget rendering in a QListView. I currently have a QListView displaying my custom model called PlayQueue based on QAbstractListModel. This is working fine with simple text, but now I would like to display…
Adrien Rey-Jarthon
  • 1,015
  • 2
  • 9
  • 22
6
votes
2 answers

How to paint correct text color in QStyledItemDelegate

I'd like to draw a custom item delegate, which follows the current style. But there are differences between "WindowsVista/7" style and "WindowsClassic" for text color. Im using the following code for drawing the background (working): void…
Schlumpf
  • 311
  • 4
  • 12
5
votes
1 answer

QStyledItemDelegate drawing custom widget failed

In one of my projects I'm using a QTableWidget in order to display some complex computational results. In order to increase the readability of the table I'm in need to display two aligned values inside of a single table cell. Later on I want to…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
4
votes
1 answer

QStyledItemDelegate to display QComboBox in QTableView

I'm new to Python and PyQt5. I'm using QStyledItemDelegate to make one of the QTableView column consisting of only ComboBox. I managed to display the ComboBox but and I'm having trouble with its behavior. Problem 1: The ComboBox doesn't seems to…
malco
  • 43
  • 1
  • 5
4
votes
1 answer

How to connect to a column delegate's signal

I have created a working PushButton Delegate for a QTableView. When the button is pressed, it will emit a buttonClicked signal (and also print to show that it is working. I have set the pushbutton delegate as the item delegate for the column 1 (see…
Drew
  • 517
  • 5
  • 16
4
votes
1 answer

How do I set item delegates for multiple columns in a model that is processed by a proxy model?

I set my item delegates like so: COMBOBOX_ITEMS_FRUITS = ['Apple', 'Banana'] COMBOBOX_ITEMS_COLORS = ['Red', 'Green', 'Blue'] self.treeview.setItemDelegateForColumn(COLUMN_A,…
FatHippo
  • 177
  • 3
  • 12
4
votes
3 answers

QStyledItemDelegate: how to make checkbox button to change its state on click

I have a delegate MyDelegate which is used for QListWidget. The delegate is derived from QStyledItemDelegate. One of the goals of MyDelegate is to place a checkbox button on each row of ListWidget. It is done within the paint() event of MyDelegate:…
vicrucann
  • 1,703
  • 1
  • 24
  • 34
4
votes
1 answer

How to update a TableView with progress data for multiple ProgressBars?

I've started to extend the qGet DownloadManager to emit the progress of a TransferItem, so that i can connect to it. I'm inserting the progress data into a cell of a TableView model for display with an Delegate, finally the delegate paints the…
Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
4
votes
2 answers

How to add different types of delegates in QTreeView

I want to create same kind of QTreeView (not QTreeWidget) structure as shown in attached figure.. This is Property Editor of QT. I am using QT-4.6 On 2nd column, depending on different condition, I can have either a spin box, or a drop down or a…
Nishant Sharma
  • 341
  • 2
  • 5
  • 17
4
votes
1 answer

How to make item view render rich (html) text in PyQt?

I'm trying to translate code from this thread in python: import sys from PyQt4.QtCore import * from PyQt4.QtGui import * __data__ = [ "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et…
Giorgio Gelardi
  • 993
  • 4
  • 13
  • 29
4
votes
1 answer

setItemDelegateForColunm() crasches application without stacktrace

Problem: When setting a QtstyledItemDelegate per row or column on a TreeView my application crashes without any further information. Nonetheless setting a QStyledItemDelegate for the whole TreeView works which seems to be strange in my opinion. Does…
Stefan Reinhardt
  • 622
  • 8
  • 17
4
votes
1 answer

How to close QComboBox editor in delegate when user chooses item

I have QStyledDelegate which creates QComboBox editor in createEditor() method. The editor closes only when user chooses an item in the list and the presses Enter key. I want the editor to be closed only when user chooses the item. How to do…
Alexander_KH
  • 189
  • 12
4
votes
1 answer

Height of editor in QItemDelegate

I have QListView with custom implementation of QItemDelegate. MyItemDelegate reimplements createEditor() to show custom widget. Size of widget is dependant on content. By default, each row height is about 20px (one row), but my editor has bigger…
developer
  • 319
  • 2
  • 13
3
votes
1 answer

Custom delegate item editor widget appearing in the wrong place

I am trying to use a custom delegate to popup custom date and time editors for use inside of a qtreeview. Everything I read says that to get the editor widget to show up in the correct spot, over the current index, you reimpliment the…
Sean O
  • 177
  • 9
1
2 3
9 10