qitemdelegate

Use QItemDelegate to show image thumbnails

What's the best way to use QT4's QItemDelegate to show thumbnails for images in a view? Specifically, how do you stop the item delegate from blocking when generating pixmaps from very large image files (> 500MB)? Can anyone link to some example code that achieves this? Then again, perhaps this isn't the place to look for Qt-specific c...

How to make QCombobox painting item delegate for it's current Item? (Qt 4)

QCombobox set Item delegate not painting for current Item.. I am trying to create a combo box showing different line types (Solid, Dotted, Dash etc). Currently i am setting item delegate for its content so as to draw/paint line type instead of displaying names. All line types are drawing currectly but as soon as i am selecting any line ...

How do I tell Qt to always show an editor in a QTableView?

I've got a QTableView for which I want to display the last column always in edit mode. (It's a QComboBox where the user should be able to always change the value.) I think I've seen the solution in the Qt documentation, but I can't find it anymore. Is there a simple way of doing it? I think I could archive this effect by using openPers...

Mystery: In Qt, why would editorEvent be called, but not createEditor?

I'm subclassing QAbstractItemDelegate. This is my code. Suggestions are welcome: QWidget *ParmDelegate::createWidget(Parm *p, const QModelIndex &index) const { QWidget *w; if (index.column() == 0) { w = new QLabel(p->getName().c_str()); } else { if (p->isSection()) return NULL; w = p->createControl(); ...

A ListView of checkboxes in PyQt

Hello, I want to display a QListView where each item is a checkbox with some label. The checkboxes should be visible at all times. One way I can think of is using a custom delegate and QAbstractListModel. Are there simpler ways? Can you provide the simplest snippet that does this? Thanks in advance ...

QListView/QListWidget with custom items

I'm writing my first Qt application with PyQt and am having some trouble creating a custom list view. I'd like the list to contain arbitrary widgets (one custom widget in particular). How would I go about this? It seems that the alternative would be to create a table or grid view wrapped in a scrollbar. However, I'd like to be able t...

What is the best way to make a QTableView's cells have up and down button pushed states in Qt?

I'm trying to make the cells of a QTableView look like 3D clickable buttons. So that when you click on a cell, the button looks pushed. Everyone seems to think I merely want to change the colour, I need to show images of a normal button, and a pushed button, that look 3-dimensional. I have done this already with calling QTableView::setI...

Model - View - Controler in Qt

I understand more or less how does MPV works. But I don't get what classes: QAbstractItemModel QAbstractItemView QAbstractItemDelegate / QItemDelegate Can do for me? If that is relevant, I'm using QGraphicsScene / QGraphicsView with some elements (visual representation of game board) that user can interact with while the interaction log...

Should I use Delegate Classes if I want items to be edited using a dialog in Qt?

All examples in Qt show that one should use delegate classes to provide editors that reside within QTreeView (QListView, etc). I want to have a separate non-modal dialog to edit item's attributes. Should I use delegate classes to do so? That is, no editing or special behavior is required within QTreeView. ...

How do I determine if the item is selected or not in the paint() function of QItemDelegate?

I am making a table using QItemDelegate. I use the paint(..) method to draw delegated items to look the same when they go out of edit mode but I also need to draw the items differently when they are selected or not and the paint method is also called during those events. My question is how do I know when to draw which? thank you. ...

Show other data in QTableView with QItemDelegate

I have a QTableView connected with an QSqlTableModel. In the first column, there are only dates at this format: 2010-01-02 I want this column to show the date at this format (but without changing the real data): 02.01.2010 I know that I have to create an QItemDelegate for this column, but I don't know how I can read the existing data and...

PyQt QTreeWidget problem with custom delegate

Hi, All! I'm trying to write simple property editor. I have automatically generated pyqt class (WorkZone in the code below), and I need to view/edit some of it's properties with PropertyEditor, with the delegate PropertyEditorDelegate, that uses custom editors ColorEditor, LineEditor, etc. Main idea is that WorkZone knows what propertie...

How does one paint the entire row's background in a QStyledItemDelegate ?

I have a QTableView which I am setting a custom QStyledItemDelegate on. In addition to the custom item painting, I want to style the row's background color for the selection/hovered states. The look I am going for is something like this KGet screenshot: Here is my code: void MyDelegate::paint( QPainter* painter, const QStyleOptionVie...

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

Hi, all! 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, but I get 'underlying C++ object was destroyed' when use this control in PyQt on ...

PyQt4 and QTableView with spinbox and checkbox

Hi, I have a QTableView with QSqlTableModel and with 3 columns, now I need to have: - second column: spinbox after clicked to edit - third column: checkbox (displayed center) My code: class SpinBoxDelegate(QtGui.QItemDelegate): def createEditor(self, parent, option, index): editor = QtGui.QSpinBox(parent) editor.setMinimum(0) ...

HowTo combine QAbstractTableModel and QItemDelegate to one working source?

Hi there! I have a QTableView defines in UI file. Here is the figure: I'd like to make month change (where the red array points) with QComboBox widget, dealing with delegates, but for me, for my custom delegate and model it's a too complex problem, and I can't figure out what is wrong?! Problem: on my opinion, QAbstractTableModel ca...

Formatting data in a QTableView

Hello everyone, I'm using a custom delegate to display QDoubleSpinBoxes in a QTableView. Those spinboxes display their contents with two decimals. My problem is that I would like the QTableView to also display those numbers with two decimals while they are not being edited (at which point they are not in a QDoubleSpinBox). Or, rather,...

Call QFileDialog when trying to edit cell in QTableView

Is there a way of doing this without using a QItemDelegate? I've been having a lot of trouble with it. For example, if I use a Delegate: 1) Won't have a native dialog. 2) I'll have to implement my own image preview, 2) For some reason I can't resize the window cause setGeometry doesn't work, etc etc. QWidget *createEditor( QWi...