mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
refact1
This commit is contained in:
40
LibInstructorsAndTrainees/widgets/waitanimationwidget.cpp
Normal file
40
LibInstructorsAndTrainees/widgets/waitanimationwidget.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "waitanimationwidget.h"
|
||||
#include "ui_waitanimationwidget.h"
|
||||
|
||||
WaitAnimationWidget::WaitAnimationWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::WaitAnimationWidget),
|
||||
loadingMovie(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::initialize(QMovie *movie,QWidget *parent)
|
||||
{
|
||||
ui->MovieLabel->setMovie(movie);
|
||||
loadingMovie = movie;
|
||||
setFixedSize(parent->width(),parent->height());
|
||||
hide();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::showWithPlay()
|
||||
{
|
||||
show();
|
||||
loadingMovie->start();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::hideWithStop()
|
||||
{
|
||||
hide();
|
||||
loadingMovie->stop();
|
||||
}
|
||||
|
||||
void WaitAnimationWidget::resize(QSize size)
|
||||
{
|
||||
setFixedSize(size);
|
||||
}
|
||||
|
||||
WaitAnimationWidget::~WaitAnimationWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
29
LibInstructorsAndTrainees/widgets/waitanimationwidget.h
Normal file
29
LibInstructorsAndTrainees/widgets/waitanimationwidget.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef WAITANIMATIONWIDGET_H
|
||||
#define WAITANIMATIONWIDGET_H
|
||||
|
||||
#include <QMovie>
|
||||
#include <QWidget>
|
||||
#include "instructorsAndTrainees_global.h"
|
||||
|
||||
namespace Ui {
|
||||
class WaitAnimationWidget;
|
||||
}
|
||||
|
||||
class INSTRUCTORSANDTRAINEES_EXPORT WaitAnimationWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WaitAnimationWidget(QWidget *parent = nullptr);
|
||||
void initialize(QMovie *movie,QWidget *parent);
|
||||
void showWithPlay();
|
||||
void hideWithStop();
|
||||
void resize(QSize size);
|
||||
~WaitAnimationWidget();
|
||||
|
||||
private:
|
||||
Ui::WaitAnimationWidget *ui;
|
||||
QMovie *loadingMovie;
|
||||
};
|
||||
|
||||
#endif // WAITANIMATIONWIDGET_H
|
||||
73
LibInstructorsAndTrainees/widgets/waitanimationwidget.ui
Normal file
73
LibInstructorsAndTrainees/widgets/waitanimationwidget.ui
Normal file
@@ -0,0 +1,73 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WaitAnimationWidget</class>
|
||||
<widget class="QWidget" name="WaitAnimationWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>635</width>
|
||||
<height>293</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:rgba(0,0,0,50%);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="mainLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="MovieLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color:rgba(0,0,0,50%)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../resources.qrc">:/resources/icons/762.gif</pixmap>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
24
LibInstructorsAndTrainees/widgets/widgettools.cpp
Normal file
24
LibInstructorsAndTrainees/widgets/widgettools.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "widgettools.h"
|
||||
|
||||
WidgetTools::WidgetTools()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Рекурсивная функция для закрытия всех дочерних виджетов
|
||||
void WidgetTools::closeAllChildWidgets(QWidget *parent, QString objName)
|
||||
{
|
||||
// Ищем всех дочерних виджетов типа QWidget
|
||||
QObjectList children = parent->children();
|
||||
foreach(auto obj, children)
|
||||
{
|
||||
if (auto wgt = qobject_cast<QWidget*>(obj))
|
||||
{ // Проверяем имя объекта
|
||||
if(wgt->objectName() == objName)
|
||||
{
|
||||
wgt->close(); // Закрываем виджет
|
||||
}
|
||||
closeAllChildWidgets(wgt, objName); // Рекурсия для возможных внучатых виджетов
|
||||
}
|
||||
}
|
||||
}
|
||||
16
LibInstructorsAndTrainees/widgets/widgettools.h
Normal file
16
LibInstructorsAndTrainees/widgets/widgettools.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef WIDGETTOOLS_H
|
||||
#define WIDGETTOOLS_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class WidgetTools
|
||||
{
|
||||
public:
|
||||
WidgetTools();
|
||||
|
||||
public:
|
||||
static void closeAllChildWidgets(QWidget* parent, QString objName);
|
||||
|
||||
};
|
||||
|
||||
#endif // WIDGETTOOLS_H
|
||||
Reference in New Issue
Block a user