From 6a86ae9909031679b2dd2a6c07de53f090178335 Mon Sep 17 00:00:00 2001 From: krivoshein Date: Thu, 23 Jan 2025 12:04:59 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB=20=D0=BE?= =?UTF-8?q?=D1=87=D0=B8=D1=89=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=BE=D0=B2=20=D0=9E=D0=B1=D1=83=D1=87=D0=B0=D0=B5?= =?UTF-8?q?=D0=BC=D1=8B=D1=85=20=D0=B8=20=D0=B8=D0=BD=D1=81=D1=82=D1=80?= =?UTF-8?q?=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20=D0=BF=D1=80=D0=B8?= =?UTF-8?q?=20=D0=B4=D0=B5=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- InstructorsAndTrainees/commonview.h | 4 ++++ .../instructorsandtraineeswidget.cpp | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) 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);