summaryrefslogtreecommitdiff
path: root/src/categoriesdialog.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jrim@rimpo.org>2023-09-24 19:03:08 -0500
committerJeremy Rimpo <jrim@rimpo.org>2023-09-24 19:03:08 -0500
commit74668b9363d877d055a5e8b8c7d001ba448dc832 (patch)
tree3674e6b1223ac104422ce77b06d020c50ad31cc0 /src/categoriesdialog.cpp
parentcdc16dfbb2b41f4ede8c471658819d4b6132fcf0 (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/categoriesdialog.cpp')
-rw-r--r--src/categoriesdialog.cpp12
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()