Qt6 topics merged with General

How to make QlistWidget editable and have headers

  • I have listwidget
    I want to make all the items of listwidget as editable . is there any global we do that , I could not find in QT docs

    Also how to have a header in QListWidget

  • @Qt-Enthusiast
    As the docs say:

    This view does not display horizontal or vertical headers; to display a list of items with a horizontal header, use QTreeView instead.

    For edit item use flags.

        for (int i = 1; i <= 10; i++) {
            auto item = new QListWidgetItem(QString::number(i));
            item->setFlags(item->flags() | Qt::ItemIsEditable);

Log in to reply