diff --git a/InstructorsAndTrainees/commonview.h b/InstructorsAndTrainees/commonview.h index ea9e755..157044e 100644 --- a/InstructorsAndTrainees/commonview.h +++ b/InstructorsAndTrainees/commonview.h @@ -39,6 +39,10 @@ public: { this->authComplited = authComplited; } + void clearTree() + { + treeWidget->clear(); + } protected: void setArchiveVisible(bool archiveVisible) diff --git a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp index 234fbed..b1bcc47 100644 --- a/InstructorsAndTrainees/instructorsandtraineeswidget.cpp +++ b/InstructorsAndTrainees/instructorsandtraineeswidget.cpp @@ -38,8 +38,8 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) : connect(viewerInstructors, &ViewerInstructors::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization); connect(viewerTrainees, &ViewerTrainees::signal_BlockAutorization, this, &InstructorsAndTraineesWidget::signal_BlockAutorization); - connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); - connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); + //connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); + //connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); connect(connectorToServer,&ConnectorToServer::signal_ConnectedToServer,this,&InstructorsAndTraineesWidget::slot_ConnectedToServer); @@ -194,7 +194,7 @@ void InstructorsAndTraineesWidget::checkDeLoginResult(ServerDeAuthorization *ser viewerInstructors->setAuthComplited(false); viewerTrainees->setAuthComplited(false); - Q_EMIT signal_NeedUpdateUI(true, false); + //Q_EMIT signal_NeedUpdateUI(true, false); ui->btnAuthorizationInstructor->setText(tr("Authorization Instructor")); updateLabelLoggedInInstructor("",""); @@ -225,6 +225,9 @@ void InstructorsAndTraineesWidget::slot_ConnectedToServer(bool state) ui->btnAuthorizationInstructor->setChecked(false); ui->btnSetVersion->hide(); ui->lblDBisConnected->setPixmap(QPixmap(QStringLiteral(":/resources/icons/circleGray.png"))); + + viewerTrainees->clearTree(); + viewerInstructors->clearTree(); } } @@ -284,6 +287,8 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked() {//Авторизация Инструктора локальная (Администратора) if(authorizationInstructorDialog(this)) { + connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); + connect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); } else ui->btnAuthorizationInstructor->setChecked(false); @@ -294,6 +299,11 @@ void InstructorsAndTraineesWidget::on_btnAuthorizationInstructor_clicked() { if(deAuthorizationInstructor(loginInstructorLoggedInLocal)) { + disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerInstructors,&ViewerInstructors::slot_NeedUpdateUI); + disconnect(connectorToServer,&ConnectorToServer::signal_UpdateDB,viewerTrainees,&ViewerTrainees::slot_NeedUpdateUI); + + viewerTrainees->clearTree(); + viewerInstructors->clearTree(); } else ui->btnAuthorizationInstructor->setChecked(true);