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
1
vote
1 answer

Why does my QStyleItemDelegate pop up in a new window instead of in my TableView?

I'm trying to create a pretty simple app with Pyside2 that displays some data in a table that the user can edit. I want the cells of the table to autocomplete based on other values in the table, so I implemented a custom delegate following this…
bolt
  • 13
  • 4
1
vote
2 answers

How to get a Custom QCompleter to work with a custom item delegate?

I have a custom qcompleter (to match any part of the string) and a custom QStyledItemDelegate (to show different formatting on the drop down options returned by the qcompleter) applied to a QLineEdit, and they both work individually however the…
1
vote
1 answer

QStyledItemDelegate subclass implementation of paint()

I have a QStandardItemModel being displayed in two QTreeViews. The first TreeView uses the standard QStyledItemDelegate without any alterations and shows the items with a checkbox, an icon and their display text. The second view is supposed to show…
1
vote
1 answer

QStyledItemDelegate paint event on cell (not row) hover

I have a custom QStyledItemDelegate that paints a QPixmap in a particular column. When that cell is hovered over with the mouse, I would like to paint it differently. Below is my paint event, which does paint the cell correctly when not…
DaveK
  • 658
  • 8
  • 21
1
vote
1 answer

QAbstractTableModel & QTableView with more than one StyledItemDelegateForColumn crashes my app

I have QTableView with QAbstractTableModel and multiple QStyledItemDelegates. I set these delegates by setStyledItemForColumn. In this case, my app crashes. Crash happens when I push 1 key, or try to expand the gui to right. But if I use one of…
Haru
  • 1,884
  • 2
  • 12
  • 30
1
vote
1 answer

How to display QSpinBox in QTableView when it is not in the edit mode

I was able to add the QSpinBox widget in a QTreeView using QStyledItemDelegate. QWidget *NoteDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (index.column() == 2) { …
Jude
  • 11
  • 1
1
vote
1 answer

Custom QPushButton inside QStyledItemDelegate

Problem: I'm able to add a QPushButton to a QStyledItemDelegate just fine. I'm faking the button press inside the delegate's editorEvent method so when you press it an action happens. I'm having trouble getting my QPushButton's style sheet working…
1
vote
1 answer

Qt C++ QStyledItemDelegate subclass - Mouse over paint

I have sub-classed QStyledItemDelegate (just the paint function) and applied to my QTableview along with my custom QAbstractTableModel model for the data. The cells of the Table are drawn correctly, so are when selected, but the color for the Mouse…
BobR
  • 85
  • 6
1
vote
1 answer

Creating item with a integer, QStandardItem doesn't provide QSpinBox

I use PySide2 and QTableView with QStandardItemModel (object called resourcesModel) in my program. When I use the following code to create, fill and put an item into the table: item = QStandardItem() item.setData(123123,…
kunek
  • 91
  • 5
1
vote
1 answer

Using QStyledItemDelegates as custom items in QListView

I want to design a custom ListView widget which has custom items similar to this: https://i.stack.imgur.com/iTNbN.png However, the qt documentation and some stackoverflow posts state that one should ideally use a QStyleItemDelegate. I never worked…
1
vote
2 answers

qstyleditemdelegate subclassing paint method not working right

I extended the qstyleditemview class. When I am in the editing mode for the qtreeview item, the paint method seems not to be executing right. When I change state to QStyle::State_Selected it works - it paints the selected row (text) in the…
Tom
  • 21
  • 3
1
vote
1 answer

How to animate the color of a QTableview cell in time once it's value gets updated?

I want to animate the color (in time) of a QTableview cell once it's value is updated via the connected data model to attract the end-users attention that something has changed. The idea is that the color changes in gradients of f.i. blue, starts…
fruitCoder
  • 77
  • 5
1
vote
1 answer

QStyledItemDelegate truncates text horizontally and doesn't add a horizontal scroll bar

I got the following code, which I slightly modified, as an answer on how to use HTML formatted text in a QListWidget. main.ui Dialog
Nemo XXX
  • 644
  • 2
  • 14
  • 35
1
vote
0 answers

Overriding Qt Stylesheet in QStyledItemDelegate

I have a QTableView that is using a custom QStyledItemDelegate to render each row of the table. A stylesheet is setting the background color of the selected row on the TableView by doing the following: QTableView::item::selected { …
Haus
  • 1,492
  • 7
  • 23
1
vote
0 answers

How to create a button in QTreeView with Delegate?

I have a table like this: When I move the mouse over a row of that table, there is a button in the right hand side of the row, and when I click onto that button, that row will be deleted from the table. How can I adjust my delegate and signal/slot…
trangan
  • 341
  • 8
  • 22