Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    1. Home
    2. Tags
    3. qitemdelegate
    Log in to post

    • UNSOLVED Custom QStyledItemDelegate - strange behavior on closing
      General and Desktop • qitemdelegate • • MasterBLB  

      9
      0
      Votes
      9
      Posts
      108
      Views

      Ok, this paste page works: .h https://paste.ofcode.org/uiz7UuRsAYhWJVzN2r76MQ .cpp https://paste.ofcode.org/GsvM6EBgtXyqk2YuYKBCgs
    • UNSOLVED Animation of QItemDelegates
      General and Desktop • qtreeview animation qitemdelegate • • H. Krishnan  

      4
      0
      Votes
      4
      Posts
      331
      Views

      Hi, One alternative could be to use QRubberBand and draw it on top of the lines/cells you are interested in.
    • SOLVED Wrong rich text height (QTextDocument) in item rendered by custom item delegate
      General and Desktop • linux windows qitemdelegate sizehint rich text • • michalos  

      2
      0
      Votes
      2
      Posts
      1426
      Views

      Terribly sorry, but it turned out to be my fault all along. The line responsible was: textDoc.setDocumentMargin(0); in the sizeHint() method.
    • UNSOLVED How do I customize icon scaling behaviour in a QListView?
      General and Desktop • qlistview x11 qicon qitemdelegate icons • • ssokolow  

      9
      0
      Votes
      9
      Posts
      5077
      Views

      @hskoglund I already have an underlying data store and I'm using a subclass of QAbstractTableModel to bridge it into a Qt GUI. Making two in-memory copies of that data store and then jerry-rigging View-like synchronization between the actual data and two widget-specific data stores (plus all the requisite automated testing to make sure it works reliably) seems like the exact opposite of what I want.
    • SOLVED Show HTML content in QTableView column while keeping BackgroundColorRole works
      General and Desktop • qtableview qt 5.7 qstandarditemmo qstyleditemdele qitemdelegate • • alizadeh91  

      2
      0
      Votes
      2
      Posts
      1139
      Views

      @alizadeh91 Either you paint it yourself since you already have the QModelIndex at hand: QColor color = index.data( Qt::BackgroundColorRole ).toColor(); or by letting the style paint the stuff. Note that this also paints the selected background. style->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter, widget );
    • UNSOLVED Problem with pressing TAB key during QTableView cell edit
      General and Desktop • qtableview qt4.8 qitemdelegate editor tab • • Ben35  

      4
      0
      Votes
      4
      Posts
      3574
      Views

      I think i've found a solution. First, i install an eventFilter in my custom editor widget B on the internal spinbox : internalSpinbox->installEventFilter(this); Then, i implement eventFilter to treat the events on the spinbox and duplicate them to the parent: bool AbstractRatioQuantitySpinbox::eventFilter(QObject *object, QEvent *event) { // cf http://stackoverflow.com/questions/12145522/why-pressing-of-tab-key-emits-only-qeventshortcutoverride-event if (event->type() == QEvent::KeyPress) { auto keyEvent = static_cast<QKeyEvent *>(event); if (keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab) { QApplication::postEvent( this, new QKeyEvent(keyEvent->type(), keyEvent->key(), keyEvent->modifiers())); return true; } } else if (event->type() == QEvent::FocusOut) { auto focusEvent = static_cast<QFocusEvent *>(event); QApplication::postEvent(this, new QFocusEvent(focusEvent->type(), focusEvent->reason())); return false; } return QWidget::eventFilter(object, event); }
    • UNSOLVED Qt Application gets freezed due to read huge data from SQLite database periodically
      General and Desktop • qtableview qitemdelegate • • Sudo007  

      5
      0
      Votes
      5
      Posts
      1370
      Views

      @Sudo007 said: hi I have created a class customDelegate (inherits QItemDelegate) in my Qt applicatrion and i created setEditor() function.But the delegate is not visible in the QTableView , untill i click on the row. How to fix the issue? How did you implement the paint() in your custom delegate ? As you are adding different widget in each cell, you need to paint a fake widget (QPushButton) using QApplication::style()->drawControl(QStyle::CE_PushButton, &btn,painter); where btn is QStyleOptionButton, then in createEditor() you create an instance of QPushButton.
    • SOLVED Custom QItemDelegate works in QTableView but not QTreeView
      General and Desktop • qitemdelegate item delegate • • Joel Bodenmann  

      8
      0
      Votes
      8
      Posts
      4611
      Views

      At the end, @SGaist pointed me to this implementation of a checkbox item delegate which works very well.
    • UNSOLVED Changing content of part of QTableWidget after editiong
      General and Desktop • qtablewidget qitemdelegate qmodelidex • • michelson  

      4
      0
      Votes
      4
      Posts
      1391
      Views

      @michelson said: Hello, I assumed i had to reimplement QItemDelegate::setModelData(...) I think this should suffice for your case. You can of course always create your own model as @SGaist suggested. As for your request for additional material: Here is an overview of the model-view framework A simple spinbox delegate example Icons example that uses delagets I hope this helps. Kind regards.
    • UNSOLVED QListView with Groups
      General and Desktop • qlistview modelview qitemdelegate • • walkingTarget  

      3
      0
      Votes
      3
      Posts
      2020
      Views

      I think I take your meaning. As I geared up to subclass QAbstractItemView, it also became evident how niche my new class would be. Based on this, I decided to take your advice of composing a custom widget. If anyone should want to subclass QAbstractItemView, this is a good article to get you started.
    • SOLVED QItemDelegate with QTableWidget, access problem
      General and Desktop • qtablewidget qitemdelegate editor • • michelson  

      6
      0
      Votes
      6
      Posts
      2751
      Views

      QComboBox has a addItems where you can directly use your QStringList, so no need for the loops. And again, you should not use static_cast like that, use object_cast. You're lucky it's not crashing because you only handle column 1 where you know you create a QComboBox. You should move these two lines under the if protection.
    • setEditorData not being called in Custom Delegate
      General and Desktop • qitemdelegate custom delegate seteditordata • • Code_Wrangler  

      3
      0
      Votes
      3
      Posts
      1576
      Views

      Hi and welcome to devnet, The logic is the following: You create your widget in createEditor You get the data from that widget in setModelData, it's the first parameter of the function. You just have to cast it to the right type using qobject_cast Hope it helps
    • Creating a calendar using QTableWidget with QItemDelegate
      General and Desktop • qtablewidget qitemdelegate • • Binary91  

      20
      0
      Votes
      20
      Posts
      5216
      Views

      The QTableWidgetItem is essentially a data container, it doesn't know about any editor. It's the delegate that uses a factory that will return the corresponding editor based on the item content type.
    • QItemDelegate sizeHint() with QComboBox
      General and Desktop • qitemdelegate • • Joel Bodenmann  

      7
      0
      Votes
      7
      Posts
      3861
      Views

      @Harb When I understood correctly a column of a QTableView which has a delegate assigned will automatically resize itself to the QItemDelegate::sizeHint() size. Therefore, I could return the required width of the column to display the full text in the cell, right? My custom delegate uses a QComboBox. The combobox is populated with items of different length. Now, let's assume there is just one row in the table and the item in the cell with the custom delegate is the item in the combobox with the shortest width. Therefore, the column will be just wide enough to display that text. When the user then clicks on the cell and the combobox dropdown shows up the user will not be able to see entries in the combobox which are longer. Items in the combobox which are longer than the width of the column will be shorted and three dots will be inserted. I took a screenshot so you can see what I mean: http://paste.ugfx.org/sores/7505d64a54e0/bcdde374e0fc.jpg As you can see there is one item in the dropdown which cannot be displayed in full length because the column width is too small. What I would like to do is using the QItemDelegate::sizeHint()to return the QComboBox::sizeHint() so the column will automatically be wide enough to display all items (because the QComboBox::sizeHint() returns the size so all items can be displayed.
    • QItemDelegate::createEditor runs 2 times in first edition
      General and Desktop • qtreeview qitemdelegate • • scastiello  

      2
      1
      Votes
      2
      Posts
      1172
      Views

      I have the same problem. Does anybody have any solution? Thank you.