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

QContextMenu issue with QPlainTextEdit item delegat in QTableView

I have a QTableView with delegates for certain columns. The default editor for indices is QLineEdit, for the 'comment' column delegate however I chose a QPlainTextEdit. Getting that to expand and adjust to contents was a PITA on its own (see…
0
votes
1 answer

Tree view with a progress bar delegate shows an extra line at the bottom

Whenever I add a progress bar delegate to my tree view, an extra line is shown in the UI under the QTreeView. #include #include #include #include class…
0
votes
0 answers

How does the native QStyledItemDelegate.draw() works during rendering an QListView with an QStandardItemModel?

The question comes from a simple demand while making an selection window: As you guys can see its a QListView showing a list of files, then select files needed by user, confirm & close. The native QListView only shows one line of data, which in…
0
votes
1 answer

QStyledItemDelegate::paint - Why do the passed QStyleOptionViewItem have a rect property of size 0x0?

I have a QListView where I set the model to a custom QAbstractItemModel, as well as a custom QStyledItemDelegate. ui->listView->setModel(model); ui->listView->setItemDelegate(new Delegate(ui->listView)); I followed this great answer on how to set…
seht97
  • 67
  • 6
0
votes
0 answers

QPaint crashed in subclassed QStyledItemDelegate

I subclassed a QStyledItemDelegate to change the highlight color of the selections, and if there is a QColor in ForegroundRole and BackgroundRole I will try to blend two colors. However, when I'm trying to select a row in the tableview, following…
nochenon
  • 326
  • 2
  • 12
0
votes
0 answers

Custom dialogbox (QWidget) as item delegate in QTreeView

I'm trying to add custom widget (image below) as item delegate in QTreeview. I do see the size of the treeItem getting bigger but my widget does not show up. Not sure what am I missing here. Thanks in advance for all your suggestions. Custom…
0
votes
1 answer

Why is my QStyledItemDelegate not visible?

I'm trying to create a custom item delegate for a list of objects, but when I run my app the list view is blank. I know my model is populated, and it displays as expected with the standard default delegate. I can also tell that my custom delegate is…
0
votes
1 answer

PyQt5 : State_MouseOver in QStyledItemDelegate just inside QtableView

Sorry, I couldn't think of a better title. I have a QStyledItemDelegate that sets the MousePointer to QtCore.Qt.PointingHandCursor when I hover over column 8. The problem is that when I exit column 8 above the table header, the cursor remains…
Robert
  • 159
  • 1
  • 9
0
votes
1 answer

Applying QStyledItemDelegate to a cell in QTreeView

I'm developping an application that allows to read and edit json files on pyqt5; the aplication lets the user make changes to the data, by default it lets the user edit by hand the fields, however I prefer them to select the information from the a…
Juan
  • 1,520
  • 2
  • 19
  • 31
0
votes
0 answers

My listView + QStyledItemDelegate don't show to me any info

I'm training use listView and qStyledItemDelegate. I try this ( my code dropmefiles.com.ua/ru/6KBSWD), but I don't understand what is wrong. It shows me just empty list // cpp file #include "WidgetDelegate.h" #include…
Xepobopa
  • 3
  • 3
0
votes
1 answer

QStyledItemDelegate / QAbstractItemDelegate for QListView

My aim is to create something like contact app, where I can list contacts and choose it to see information about person. I figure out that one of the possible solution is to use QListView + QStyledItemDelegate / QAbstractItemDelegate. The…
Xepobopa
  • 3
  • 3
0
votes
0 answers

QStyledItemDelegate crashes my application when I print something on console on paint event

Main Question: Is there a known threading problem when trying to print something inside a paint event of a QStyledItemDelegate? Script Files: style.css: QTableWidget { border: 1px solid #ddd; } QTableWidget::item { background-color:…
Carl HR
  • 776
  • 5
  • 12
0
votes
0 answers

Qt model/view: how to use foreground item color from model instead of from style sheet

I have custom model that return necessary foreground color for the ForegroundRole: QVariant AlertTreeModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) { return {}; } const auto item =…
Vladimir Bershov
  • 2,701
  • 2
  • 21
  • 51
0
votes
1 answer

Changing the font size of a QTableView after reimplementing the QStyledItemDelegate paint function in PyQt5

I have implemented a multiline text editor for a QTableView as seen here: Make row of QTableView expand as editor grows in height One issue I have not yet been able to solve is getting full control over the styling of the painted text. A solution…
M D
  • 19
  • 1
  • 6
0
votes
1 answer

Changing the font color of a QTableView after replacing the default editor with an ItemDelegate QTextEdit in PyQt5

I am currently trying to add a multiline text editor to the PandasGUI application and have implemented the solution found here: Make row of QTableView expand as editor grows in height I am using the qtstylish.dark() stylesheet for the application so…
M D
  • 19
  • 1
  • 6