В основном работает

This commit is contained in:
krivoshein
2024-12-12 17:20:06 +03:00
parent d28453440f
commit 1c9e0510a9
51 changed files with 634 additions and 810 deletions

View File

@@ -5,7 +5,7 @@
InstructorsView::InstructorsView(ConnectorToServer* connectorToServer, TypeView type, QWidget *parent):
CommonView(connectorToServer, type, parent)
{
typeObject = TypeObject::objInstructor;
}
void InstructorsView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
@@ -39,7 +39,7 @@ void InstructorsView::slot_NeedUpdateUI(bool treeInstructor, bool treeTrainee)
loadInstructorsFromDB();
}
void InstructorsView::preparationTreeWidget(/*QTreeWidget* tree*/)
void InstructorsView::preparationTreeWidget()
{
mtxTreeWidget.lock();
@@ -101,9 +101,6 @@ void InstructorsView::loadInstructorsFromDB()
//Инструкторы
QList<Instructor> listInstructors;
//TODO
//listInstructors = dbLMS->getListInstructors();
//sendSystem->getListInstructors();
listInstructors = connectorToServer->getListInstructors();
@@ -123,7 +120,7 @@ void InstructorsView::loadInstructorsFromDB()
if(instructor.getArchived())
{//Архивный
ItemInstructor->setText(ColumnsTreeInsructors::clmn_Archived, tr("yes"));
ItemInstructor->setIcon(ColumnsTreeInsructors::clmn_Instructor, QIcon(QStringLiteral(":/icons/instructorArchive.png")));
ItemInstructor->setIcon(ColumnsTreeInsructors::clmn_Instructor, QIcon(QStringLiteral(":/icons/archive.png")));
setItemColorArchive(ItemInstructor);
}
else
@@ -167,12 +164,15 @@ void InstructorsView::loadInstructorsFromDB()
treeWidget->expandAll();
/*
//if(typeView == TypeView::control)
{
QTreeWidgetItem * item = treeWidget->topLevelItem(0);
if(item != nullptr)
treeWidget->setCurrentItem(item);
}
}*/
setCurrentInstructor(lastCurrentID);
mtxTreeWidget.unlock();
}
@@ -183,3 +183,21 @@ void InstructorsView::reSetHeadTreeWidget()
treeWidget->setHeaderLabels(listHeaders);
}
void InstructorsView::setCurrentInstructor(int id)
{
for(int i = 0; i < treeWidget->topLevelItemCount(); i++)
{
QTreeWidgetItem * item = treeWidget->topLevelItem(i);
if(item != nullptr)
if(item->text(ColumnsTreeInsructors::clmn_ID).toInt() == id)
{
treeWidget->setCurrentItem(item);
return;
}
}
QTreeWidgetItem * item = treeWidget->topLevelItem(0);
if(item != nullptr)
treeWidget->setCurrentItem(item);
}