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

How do I animate the border of a list item in a QListView?

I am using a QListView with a custom delegate that extends from QStyledItemDelegate. I reimplemented the paint method to custom paint each item in the list. In the paint method, I am drawing a border around selected items in the list view. I want…
Joey Kleingers
  • 297
  • 1
  • 4
  • 13
2
votes
1 answer

QTreeView with fixed column widths

Today I'm trying to configure a QTreeView to fit my requirements. My view has basically three columns. The second and third column should be exactly 50 pixels wide no matter, what might be widgets size. The first column should occupy the remaining…
Aleph0
  • 5,816
  • 4
  • 29
  • 80
2
votes
1 answer

QStyledItemDelegate paint refresh issues

I am currently trying to wrap my head around the model-view approach and write a thumbnail viewer application. In this example I simply try to draw 20 boxes, but I get what seems like a random selection which updates on mouse movement. Scrolling…
L-rac
  • 96
  • 8
2
votes
1 answer

QStyledItemDelegate partially select text of default QLineEdit editor

I have a subclass of QStyledItemDelegate which at the moment does not reimplement any functions (for simplicity of the question). With default QStyledItemDelegate implementation, when the user begins to edit text in a QTableView, the delegate draws…
CSLover
  • 251
  • 2
  • 18
2
votes
1 answer

Qt5 Subclassing QStyledItemDelegate Formatting

I am developing a GUI for a SQLite database in Qt5. I use QSqlQueryModel and QTableView for storing and displaying the data. I then created a custom delegate to replace the numeric values of certain columns with their literals in the table view…
mrwolf
  • 41
  • 1
  • 12
2
votes
1 answer

How to format the list items of QCompleter's popup list properly?

I want to investigate how to make a small user interface in which a user can type some letters and gets some suggestions based on a given data source (list here) which makes searches easier. For this purpose i am using Qt's QCompleter class. In the…
maggie
  • 3,935
  • 3
  • 27
  • 31
2
votes
0 answers

pyqt pass focus to delegate editor

My QStyledItemDelegate uses a QDialog (Qt.Popup) to display a QLineEdit and a QListWidget. I'm failing to have the focus set properly on the QLineEdit. The focus seems to remain on the QTreeView from which the editing began. I've tried,…
tom voll
  • 55
  • 5
2
votes
1 answer

How to paint according to qStylesheet in QStyledItemDelegate

I want to subclass QStyledItemDelegate and modify it with QStyleSheets. I dont have any clue of how to get it to work. I tried plenty of hours to just display anything, looking like I defined in the qss. In priciple it has to work, because when I…
ManuelSchneid3r
  • 15,850
  • 12
  • 65
  • 103
2
votes
1 answer

Correctly implementing QStyledItemDelegate

I have a class (EditorTagManager) that contains a QTreeWidget. During runtime, the tree can contain any number of tag items, all of which are checkable. I'm trying to add horizontal lines between the QTreeWidgetItems in order to make it clear that…
Will Kraft
  • 553
  • 1
  • 8
  • 23
2
votes
0 answers

Qt: ProxyModel, QTreeView and Delegate Setup with filtering does not correctly update

I have a setup with QTreeView displaying a QSortFilteredProxyModel with custom filtering in filterAcceptsRow() accepting only rows depending on the value of a parent row value (selected in a QComboBox via QStyledItemDelegate-derived class. For…
1
vote
2 answers

QListView with Two QTextEdit 's as Item

In Qt Widget Application (c++), a part of my *.ui file consists of a QListView with two QTextEdits as its items like the below figure. As you can see custom widget includes two QTextEdit that each one has its text and stylesheet. As I searched on…
1
vote
1 answer

How to use an active QComboBox as an element of QListView in PyQt5?

I am using PyQt5 to make an application. One of my widgets will be a QListView that displays a list of required items, e.g. required to cook a particular dish, say. For most of these, the listed item is the only possibility. But for a few items,…
Bill Peria
  • 13
  • 2
1
vote
1 answer

QStyledItemDelegate disabling button in last column moves selection to next row

Setup description Table in PySide created with QMainWindow - > QWidget -> QTableView -> TableModel (QAbstractTableModel) -> array[] For second and third column is created ButtonDelegate(QStyledItemDelegate) buttons toggle value in the first column…
martin_h
  • 29
  • 5
1
vote
1 answer

How can I add records to my SQLite database, using PySide2, that have NULL values?

I have a PySide2 GUI that can add, update and delete records in my SQLite3 database. I use QTableView to view the data and QDataWidgetMapper to edit data. My problem is that when I add a record to the database that has a blank value in any field it…
1
vote
1 answer

Resizing a QTableView column horizontally to the content of an item delegated column which is painted with a new text in Qt

I want to show my database tabel content in a QTableView. I use the following codes to do that: QSqlDatabase test =…
1 2
3
9 10