Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make QlistWidget editable and have headers
QtWS25 Last Chance

How to make QlistWidget editable and have headers

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by Qt Enthusiast
    #1

    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

    Taz742T 1 Reply Last reply
    0
    • Q Qt Enthusiast

      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

      Taz742T Offline
      Taz742T Offline
      Taz742
      wrote on last edited by Taz742
      #2

      @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);
              ui->listWidget->addItem(item);
          }
      

      Do what you want.

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved