diff options
| author | Jeremy Rimpo <jrim@rimpo.org> | 2023-09-24 19:03:08 -0500 |
|---|---|---|
| committer | Jeremy Rimpo <jrim@rimpo.org> | 2023-09-24 19:03:08 -0500 |
| commit | 74668b9363d877d055a5e8b8c7d001ba448dc832 (patch) | |
| tree | 3674e6b1223ac104422ce77b06d020c50ad31cc0 /src | |
| parent | cdc16dfbb2b41f4ede8c471658819d4b6132fcf0 (diff) | |
Fixes for table
* row increment needs to be before the logic but after the ID check/continue
* avoid running context menu logic on null rows
Diffstat (limited to 'src')
| -rw-r--r-- | src/categoriesdialog.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/categoriesdialog.cpp b/src/categoriesdialog.cpp index e577eb5f..ff226286 100644 --- a/src/categoriesdialog.cpp +++ b/src/categoriesdialog.cpp @@ -214,6 +214,7 @@ void CategoriesDialog::fillTable() --row; continue; } + ++row; table->insertRow(row); // table->setVerticalHeaderItem(row, new QTableWidgetItem(" ")); @@ -229,7 +230,6 @@ void CategoriesDialog::fillTable() table->setItem(row, 1, nameItem.take()); table->setItem(row, 2, parentIDItem.take()); table->setItem(row, 3, nexusCatItem.take()); - ++row; } for (const auto& nexusCat : categories.m_NexusMap) { @@ -270,14 +270,16 @@ void CategoriesDialog::addCategory_clicked() void CategoriesDialog::removeCategory_clicked() { - ui->categoriesTable->removeRow(m_ContextRow); + if (m_ContextRow >= 0) + ui->categoriesTable->removeRow(m_ContextRow); } void CategoriesDialog::removeNexusMap_clicked() { - ui->categoriesTable->item(m_ContextRow, 3)->setData(Qt::UserRole, QVariantList()); - ui->categoriesTable->item(m_ContextRow, 3)->setData(Qt::DisplayRole, QString()); - // ui->categoriesTable->update(); + if (m_ContextRow >= 0) { + ui->categoriesTable->item(m_ContextRow, 3)->setData(Qt::UserRole, QVariantList()); + ui->categoriesTable->item(m_ContextRow, 3)->setData(Qt::DisplayRole, QString()); + } } void CategoriesDialog::nexusRefresh_clicked() |
