mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
53 lines
876 B
C++
53 lines
876 B
C++
#include <QMainWindow>
|
|
#include <QLabel>
|
|
#include <QPushButton>
|
|
#include <QHBoxLayout>
|
|
#include <string>
|
|
using namespace std;
|
|
|
|
class LabelPair
|
|
{
|
|
public:
|
|
LabelPair(QWidget* parent, int x, int y, int w, int h)
|
|
{
|
|
title.setParent(parent);
|
|
value.setParent(&title);
|
|
|
|
title.setGeometry(x, y, w, h);
|
|
value.setGeometry(80, 0, w-80, h);
|
|
|
|
title.show();
|
|
value.show();
|
|
}
|
|
|
|
void setTitle(std::string text)
|
|
{
|
|
title.setText(text.c_str());
|
|
}
|
|
|
|
void setValue(std::string text)
|
|
{
|
|
value.setText(text.c_str());
|
|
}
|
|
|
|
QLabel title;
|
|
QLabel value;
|
|
};
|
|
|
|
class MainApp : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
MainApp();
|
|
|
|
void setMyLayout();
|
|
|
|
struct {
|
|
std::shared_ptr<LabelPair> weburl {};
|
|
} ui;
|
|
|
|
struct {
|
|
std::shared_ptr<QGridLayout> main;
|
|
} layout;
|
|
|
|
}; |