Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void NumismatistHandbook::deleteItemSlot()
- {
- int currentIndex = ui->listWidget->currentRow();
- if (currentIndex != -1)
- { //выбран существующий элемент
- //удалить из массива
- uint32_t currentId = ui->listWidget->currentItem()->data(Qt::UserRole).toUInt();
- int currentIndex = ui->listWidget->currentRow();
- model.remove(currentId);
- delete ui->listWidget->takeItem(currentIndex);
- }
- //выбор нового индекса
- int newIndex = currentIndex;
- if (currentIndex >= model.count())
- newIndex -= 1;
- ui->listWidget->setCurrentRow(newIndex);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement