Important: Please read the Qt Code of Conduct -

Changing editor size in QStyledItemDelegate

  • Hi,
    I have a QStandardItemModel with QStyledItemDelegate. Because the records include pictures the rows are quite high and the editors (QLineEdit, QTextEdit, QComboBox) don't look too good. Is it possible to change the size of these editors somehow? Especially their height.
    Thank you.

  • Lifetime Qt Champion

    Can you try in
    ::createEditor(QWidget *parent,
    const QStyleOptionViewItem &option,
    const QModelIndex &index) const
    StarEditor *editor = new StarEditor(parent); // Create editor
    editor->resize( option.rect.width(), option.rect.height() )

  • I think reimplementing sizeHint in the delegate should be enough

Log in to reply