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. [Solved] QTableWidget - problem when editing multiple items
Qt 6.11 is out! See what's new in the release blog

[Solved] QTableWidget - problem when editing multiple items

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 4.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.
  • X Offline
    X Offline
    xportation
    wrote on last edited by
    #1

    Hi,

    The QTableWidget is not notifying a change when an item is "changed" for the same value.
    It seems silly, but it's important when editing multiple items.

    This is my code:
    @
    QTableWidgetTest::QTableWidgetTest(QWidget parent, Qt::WFlags flags)
    : QDialog(parent, flags)
    {
    ui.setupUi(this);
    //...
    connect(ui.tableWidget, SIGNAL(itemChanged(QTableWidgetItem
    )), this, SLOT(multipleItemsChanged(QTableWidgetItem*)));
    }

    //...

    void QTableWidgetTest::multipleItemsChanged( QTableWidgetItem item )
    {
    ui.tableWidget->blockSignals(true);
    QList<QTableWidgetItem
    > selectedItems = ui.tableWidget->selectedItems();
    foreach(QTableWidgetItem* selectItem, selectedItems)
    {
    selectItem->setText(item->text());
    }
    ui.tableWidget->blockSignals(false);
    }
    @

    "Sample project":http://dl.dropbox.com/u/18906327/QTableWidgetTest.zip

    It's important to use the same value as the last item selected.
    If you test with only one item, the result is the same.

    Does somebody know another way to solve this?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xportation
      wrote on last edited by
      #2

      The link below can help you:

      http://www.qtcentre.org/threads/45348-QTableWidget-problem-when-editing-multiple-items

      1 Reply Last reply
      0

      • Login

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