Вывел все окна в свои диалоги

This commit is contained in:
2025-09-18 13:26:22 +03:00
parent a2cd5280bd
commit 8bb54cb56c
17 changed files with 166 additions and 51 deletions

View File

@@ -0,0 +1,33 @@
#include <QHBoxLayout>
#include "dialogredactortrainees.h"
DialogRedactorTrainees::DialogRedactorTrainees(ConnectorToServer* connectorToServer,
bool adminMode, QWidget *parent) :
QDialog(parent,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint),
editorTraineesGroups(nullptr)
{
editorTraineesGroups = new EditorTrainees(connectorToServer, adminMode, this);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorTraineesGroups, &EditorTrainees::slot_NeedUpdateUI);
editorTraineesGroups->activate();
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(editorTraineesGroups);
this->setWindowTitle(tr("Editor of trainees"));
this->setMinimumSize(1400, 700);
this->setWindowState(Qt::WindowMaximized);
this->setModal(true);
}
DialogRedactorTrainees::~DialogRedactorTrainees()
{
delete editorTraineesGroups;
}
void DialogRedactorTrainees::closeEvent(QCloseEvent *event)
{
editorTraineesGroups->close();
}

View File

@@ -0,0 +1,22 @@
#ifndef DIALOGREDACTORTRAINEES_H
#define DIALOGREDACTORTRAINEES_H
#include <QDialog>
#include <QObject>
#include "connectortoserver.h"
#include "editortrainees.h"
class DialogRedactorTrainees : public QDialog
{
Q_OBJECT
public:
DialogRedactorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~DialogRedactorTrainees();
void closeEvent(QCloseEvent *event) override;
private:
EditorTrainees* editorTraineesGroups;
};
#endif // DIALOGREDACTORTRAINEES_H

View File

@@ -41,6 +41,11 @@ EditorTrainees::~EditorTrainees()
delete ui;
}
void EditorTrainees::closeEvent(QCloseEvent *event)
{
}
void EditorTrainees::on_btnNewGroup_clicked()
{
Group group;

View File

@@ -20,6 +20,8 @@ public:
explicit EditorTrainees(ConnectorToServer* connectorToServer, bool adminMode, QWidget *parent = nullptr);
~EditorTrainees();
void closeEvent(QCloseEvent *event) override;
private Q_SLOTS:
void on_btnNewGroup_clicked();
void on_btnDeleteGroup_clicked();

View File

@@ -75,6 +75,7 @@ PersonalCardTrainee::~PersonalCardTrainee()
void PersonalCardTrainee::closeEvent(QCloseEvent *event)
{
fimTasksWidget_personal->closeDlgCheckTask();
ammTasksWidget_personal->closeDlgCheckTask();
}
void PersonalCardTrainee::loadInfo()

View File

@@ -9,7 +9,7 @@ ViewerTrainees::ViewerTrainees(ConnectorToServer* connectorToServer, MessangerCo
ammTasksWidgetCommon(nullptr),
fimTasksWidgetCommon(nullptr),
messangerController(messangerController),
dlgEditor(nullptr),
dlgRedactor(nullptr),
dlgCardTrainee(nullptr),
ui(new Ui::ViewerTrainees)
{
@@ -48,8 +48,8 @@ ViewerTrainees::~ViewerTrainees()
fimTasksWidgetCommon = nullptr;
}
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
if(dlgCardTrainee)
dlgCardTrainee->close();
@@ -65,13 +65,11 @@ void ViewerTrainees::setAuthComplited(bool authComplited)
void ViewerTrainees::deactivate()
{
if(dlgEditor)
dlgEditor->close();
if(dlgRedactor)
dlgRedactor->close();
if(dlgCardTrainee)
{
dlgCardTrainee->close();
}
CommonView::deactivate();
@@ -96,25 +94,14 @@ void ViewerTrainees::on_btnEditorTrainees_clicked()
{
Q_EMIT signal_BlockAutorization(true);
EditorTrainees* editorTraineesGroups = new EditorTrainees(connectorToServer, adminMode);
connect(connectorToServer, &ConnectorToServer::signal_UpdateDB, editorTraineesGroups, &EditorTrainees::slot_NeedUpdateUI);
editorTraineesGroups->activate();
dlgRedactor = new DialogRedactorTrainees(connectorToServer, adminMode, this);
dlgRedactor->exec();
dlgEditor = new QDialog(this,
Qt::WindowSystemMenuHint
| Qt::WindowMaximizeButtonHint
| Qt::WindowMinimizeButtonHint
| Qt::WindowCloseButtonHint);
QHBoxLayout *layout = new QHBoxLayout(dlgEditor);
layout->addWidget(editorTraineesGroups);
dlgEditor->setWindowTitle(tr("Editor of trainees"));
dlgEditor->setMinimumSize(1400, 700);
dlgEditor->setWindowState(Qt::WindowMaximized);
dlgEditor->setModal(true);
dlgEditor->exec();
delete dlgEditor;
dlgEditor = nullptr;
if(dlgRedactor)
{
delete dlgRedactor;
dlgRedactor = nullptr;
}
if(authComplited)
loadTraineesFromDB();

View File

@@ -6,6 +6,7 @@
#include "fimtaskswidget.h"
#include "messangercontroller.h"
#include "dialogcardtrainee.h"
#include "dialogredactortrainees.h"
namespace Ui {
class ViewerTrainees;
@@ -53,7 +54,7 @@ private:
MessangerController* messangerController;
QDialog* dlgEditor;
DialogRedactorTrainees* dlgRedactor;
DialogCardTrainee* dlgCardTrainee;
private: