71 lines
2.1 KiB
C++
71 lines
2.1 KiB
C++
#include "mainwindow.h"
|
|
#include "./ui_mainwindow.h"
|
|
#include "httpclient.h"
|
|
#include "flowlayout.h"
|
|
#include "sensorwidget.h"
|
|
|
|
#include <QComboBox>
|
|
#include <QGridLayout>
|
|
#include <QResizeEvent>
|
|
#include <QScrollArea>
|
|
|
|
#include <QDebug>
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
QScrollArea *scrollArea = new QScrollArea(this);
|
|
scrollArea->setStyleSheet("background: transparent; border: 0;");
|
|
scrollArea->setWidgetResizable(true);
|
|
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
|
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
QWidget *widgetContainer = new QWidget(scrollArea);
|
|
FlowLayout *layout = new FlowLayout(widgetContainer, 10, 10, 10);
|
|
|
|
int num = 0;
|
|
for (int row = 0; row < 10; ++row) {
|
|
for (int col = 0; col < 1; ++col) {
|
|
const QString a = QString::number(row);
|
|
const QString b = QString::number(col);
|
|
const QString c = QString::number(num);
|
|
num++;
|
|
SensorWidget *sensor = new SensorWidget(nullptr, a, b, c);
|
|
|
|
layout->addWidget(sensor);
|
|
}
|
|
}
|
|
|
|
widgetContainer->setLayout(layout);
|
|
scrollArea->setWidget(widgetContainer);
|
|
ui->SensorsTabLayout->addWidget(scrollArea);
|
|
|
|
/* HttpClient httpClient;
|
|
for (int i = 0; i < 10; ++i) {
|
|
QJsonObject getResult = httpClient.get("http://raspberrypi.lan:8080/data/getDevices");
|
|
qDebug() << "GET Response:" << getResult;
|
|
}*/
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
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) {}
|