Results 1 to 2 of 2

Thread: Find and delete a SPECIFIC item in QTableWidget

  1. #1
    Join Date
    Mar 2014
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Find and delete a SPECIFIC item in QTableWidget

    I've made a winsock application that connects to a server. Upon connection it receives a bunch of packets I like to call "user ids". An example of one of these packets would be "C10x". The 'C' meaning someone has just connected. I also receive other information with this user id, such as their username. I store their user id and the corresponding username in a QHash, like this:

    Qt Code:
    1. QHash<QString, QString> userInfo;
    2.  
    3. userInfo.insert(qUid, qUsername);
    To copy to clipboard, switch view to plain text mode 

    I then add these to my QTableWidget like this:

    Qt Code:
    1. ui->tableWidget->insertRow(row);
    2. QTableWidgetItem *item2 = new QTableWidgetItem(qUsername);
    3. ui->tableWidget->setItem(row, 0,item);
    4. ui->tableWidget->setItem(row, 1,item2);
    5. row++;
    To copy to clipboard, switch view to plain text mode 

    When someone disconnects, I receive a packet that looks like this: "D10x", which means that the user 10x has disconnected. How can I search for "10x" in my QTableWidget and remove its respective row? Thanks in advance~

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Find and delete a SPECIFIC item in QTableWidget


Similar Threads

  1. Replies: 1
    Last Post: 10th September 2013, 11:07
  2. Replies: 4
    Last Post: 2nd July 2012, 09:04
  3. how to find all signals connected to specific slot
    By davidovv in forum Qt Programming
    Replies: 17
    Last Post: 10th May 2012, 00:21
  4. Replies: 4
    Last Post: 14th September 2011, 06:14
  5. selecting a specific QtreeList item
    By MrGarbage in forum Qt Programming
    Replies: 1
    Last Post: 9th October 2007, 13:45

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.