Important: Please read the Qt Code of Conduct -

QAbstractItemDelegate problem!!!

  • QAbstractItemDelegate problem:
    i inherite a class from QAbstractItemDelegate , in order to custom my own item appearence in QListWidget.
    i set a m_nSize in the QAbstractItemDelegate, and update it outside the class dynamically. m_nSize is used in sizeHint(...), as return QSize(m_nSize, m_nSize);
    however, i found when i dynamic change the m_nSize, the items in the QListWidget change into new size very slow and the Item rect seems still the old size, no matter if i call the QListWidget::update() or not. However, when i resize the widget, the result turns Right.

  • solved.
    and really weried. i add this code when i set the m_nIconSize.
    QModelIndex temp;
    emit sizeHintChanged(temp);

    and it change the items size quickly.

Log in to reply