2024-11-24 09:48:52 +00:00
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "./ui_mainwindow.h"
|
2024-11-28 08:02:59 +00:00
|
|
|
#include "sensorwidget.h"
|
|
|
|
#include "sensorlayout.h"
|
2024-11-24 09:48:52 +00:00
|
|
|
|
2024-11-24 21:46:29 +00:00
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QResizeEvent>
|
|
|
|
#include <QComboBox>
|
2024-11-28 08:02:59 +00:00
|
|
|
#include <QScrollArea>
|
|
|
|
|
|
|
|
#include <QDebug>
|
2024-11-24 21:46:29 +00:00
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: QMainWindow(parent)
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2024-11-28 08:02:59 +00:00
|
|
|
|
|
|
|
// Создаем QScrollArea для прокрутки
|
|
|
|
QScrollArea* scrollArea = new QScrollArea(this);
|
|
|
|
scrollArea->setStyleSheet("background: transparent; border: 0;");
|
|
|
|
SensorLayout* sl = new SensorLayout(scrollArea);
|
|
|
|
scrollArea->setLayout(sl); // Устанавливаем контейнер
|
|
|
|
scrollArea->setWidgetResizable(true); // Контейнер будет растягиваться по области просмотра
|
|
|
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
|
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
|
|
|
|
|
|
// Добавляем QScrollArea в основной layout
|
|
|
|
ui->SensorsTabLayout->addWidget(scrollArea);
|
|
|
|
|
|
|
|
// Добавляем виджеты в SensorLayout
|
|
|
|
int rows = 0; // Количество строк
|
|
|
|
int columns = 0; // Количество столбцов
|
|
|
|
|
|
|
|
for (int row = 0; row < rows; ++row) {
|
|
|
|
for (int col = 0; col < columns; ++col) {
|
|
|
|
const QString a = QString::number(row);
|
|
|
|
const QString b = QString::number(col);
|
|
|
|
const QString c = QString::number(row + col);
|
|
|
|
SensorWidget* sensor = new SensorWidget(nullptr, a, b, c);
|
|
|
|
sl->addWidget(sensor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
}
|
|
|
|
|
2024-11-28 08:02:59 +00:00
|
|
|
|
|
|
|
|
2024-11-24 09:48:52 +00:00
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
2024-11-24 21:46:29 +00:00
|
|
|
|
|
|
|
void MainWindow::ResizeEvent(QResizeEvent *event)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupTabs()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupSensorTab(QWidget *tab, QVBoxLayout *mainLayout)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupIncidentTab(QWidget *tab, QVBoxLayout *mainLayout)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupStatisticsTab(QWidget *tab, QVBoxLayout *mainLayout)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupJournalTab(QWidget *tab, QVBoxLayout *mainLayout)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::SetupSettingsTab(QWidget *tab, QVBoxLayout *mainLayout)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|