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
2
votes
2 answers

How to close an editor created by a custom QItemDelegate::createEditor()

I have created a custom item delegate which lets users edit a list of file paths: I have achieved this through a custom class DirEdit. Now the selected path is commited and the editor is closed when the user presses enter, but I would like to add…
bgp2000
  • 1,070
  • 13
  • 32
2
votes
0 answers

Style the QTreeView/QTreeWidget item in edit state

I want to style using QSS the line edit that appears when I edit a QTreeView/QTreeWidget item. Here is an example: This is a standard QTreeWidget with QTreeView::item { min-height: 25px; } style applied to it. My question is: Is it possible to have…
Iuliu
  • 4,001
  • 19
  • 31
2
votes
1 answer

'C++ object destroyed' in QComboBox descendant editor in delegate

I have modified combobox to hold colors, using QtColorCombo (http://qt.nokia.com/products/appdev/add-on-products/catalog/4/Widgets/qtcolorcombobox) as howto for the 'more...' button implementation details. It works fine in C++ and in PyQt on linux,…
Maxim Popravko
  • 4,100
  • 3
  • 29
  • 43
2
votes
1 answer

Using custom delegate with the class derived from QTableView

I have derived a class from QTableView. and I have Promoted the Widget QTableViewto the derived class in Qt creator. and try to implement the Custom delegate in the derived class, which does not seem to work. But when I demote the QTableView Widget…
user1703942
  • 317
  • 3
  • 15
2
votes
1 answer

QWidgetItem override by setDefaultFactory in PyQt4 Example coloreditorfactory

has anyone tried they PyQt4 example coloreditorfactory? Normally, I can create editable QWidgetItem with the setFlags() or setData() method, but it does not work after setDefaultFactory method. I saw some documentation that said all new or existing…
juseedom
  • 43
  • 2
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

PyQt5 QDoubleValidator don't allow to write dot separators : x.y

Hello everyone, I'm trying to develop a GUI to modify and make computation on Pandas DataFrames with the PyQt5 module. I could actually display my DataFrame, and Edit specific column or not. It's displayed in a QTableWidget. I tried to implement a…
Mbstfcful
  • 15
  • 5
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
vote
1 answer

Text can be seen behind delegate widgets in QTableView

I have a QTableView that uses QItemDelegate and QAbstractTableModel. A row contains a QPushButton, QCheckBox, QCombobox and QTimeEdit. My issue is that text appears behind the widgets. When a cell containing the QPushButton and QCheckBox are…
1
vote
1 answer

Qt TableView+Delegate+ProxyIndex+PersistenIndex - deleting rows with widgets

I'm trying to figure out how to code table with widgets with sorting/filtering possibility. I use QItemDelegate, QAbstractTableModel, QTableView. Already checked many threads on this topic which led me to code part of my app. What I want to…
1
vote
1 answer

Add a checkbox to text in a QTableView cell using delegate

I wish to add a checkbox to a cell with text in my QTableView: when a cell is not activated we should see a text and a greyed out checkbox, like this when we open a delegate editor, we should be able to edit text and to change state of a…
Nasty_gri
  • 83
  • 7
1
vote
0 answers

QTableView with comboBox

I want my QTableView to have a column of comboBoxes. After a lot of try-outs, I've reached my goal : display the comboBoxes. Now my problem is that they won't keep the selected item displayed. I use a custom delegate to do it, below is the relevant…
Johanna
  • 1,343
  • 4
  • 25
  • 44
1
vote
2 answers

How to create Symbian style list views in Qt

I've never done any item delegates in Qt before, and I think the documentation doesn't explain well about more complex delegates. I need to create 2 styles of Symbian(^3) style lists Type 1: This is for common navigation lists, the icon and the…
Gerstmann
  • 5,368
  • 6
  • 37
  • 57
1
vote
1 answer

Sorting QTableView with combo delegates removes delgetes except after double clicking

I have QTableView which views a pandas table. The first row has QComboBox delegates. When I sort the table by a column the delegates disappear. A working example of my code is below. import sys import pandas as pd import numpy as np from…
Khalil Al Hooti
  • 4,207
  • 5
  • 23
  • 40
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