[Solved] QTableWidget - problem when editing multiple items



  • 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?




Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.