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 Delete QListwidgetItem
Qt 6.11 is out! See what's new in the release blog

how to Delete QListwidgetItem

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 1.3k Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by Bharth
    #1

    Hi everyone,,,,

    i added items to Qlistwidget,,,i want to delete particular selected row

    int row = ui->list_chat->currentRow();
    QListWidgetItem* item= ui->list_chat->takeItem(row);
    delete item;

    please help me

    thanks in advance

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use takeItem to remove an item from QListWidget.

      (Z(:^

      1 Reply Last reply
      4
      • B Offline
        B Offline
        Bharth
        wrote on last edited by
        #3

        how to get selected row number ,,now its always showing 0

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          The selected items (and therefore also the row) can be retrieved with QListWidget::selectedItems

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          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