This commit is contained in:
2023-03-28 10:24:50 +02:00
parent 537c508e69
commit d3e465a3b2
3 changed files with 17 additions and 10 deletions
+1
View File
@@ -12,6 +12,7 @@
#include <QDir>
#include <QFile>
#include <QBuffer>
#include <QIntValidator>
#include <QDebug>
+2
View File
@@ -1,5 +1,7 @@
#include "cpartlistitem.h"
#include <QObject>
cPartlistItem::cPartlistItem() :
m_id(-1),
+14 -10
View File
@@ -164,18 +164,22 @@ void cPartWindow::deletePart()
void cPartWindow::onAdd()
{
QStandardItem* lpItem = m_lpPartListModel->itemFromIndex(ui->m_lpPartList->selectionModel()->selectedIndexes().at(0));
QString szGroup;
if(lpItem)
if(ui->m_lpPartList->selectionModel()->selectedIndexes().count())
{
QStandardItem* lpRoot;
QStandardItem* lpItem = m_lpPartListModel->itemFromIndex(ui->m_lpPartList->selectionModel()->selectedIndexes().at(0));
lpRoot = lpItem->parent();
if(!lpRoot)
szGroup = lpItem->text();
else
szGroup = lpRoot->text();
if(lpItem)
{
QStandardItem* lpRoot;
lpRoot = lpItem->parent();
if(!lpRoot)
szGroup = lpItem->text();
else
szGroup = lpRoot->text();
}
}
cPartEditDialog* lpDialog = new cPartEditDialog(this);
@@ -191,8 +195,8 @@ void cPartWindow::onAdd()
delete lpDialog;
partGroupChanged(0);
partChanged(0);
emit partGroupChanged(0);
emit partChanged(0);
showPartList(id);
}