Files

71 lines
2.0 KiB
C++
Raw Permalink Normal View History

2024-05-18 23:53:26 +08:00
#include <qlayout.h>
#include <qwidget.h>
#include <qlabel.h>
class OnceDataDisplay :public QWidget
{
public:
QVBoxLayout* layout;
QLabel* title;
QLabel* widthValueLabel;
QLabel* heightValueLabel;
QWidget* dataPanel;
OnceDataDisplay()
{
this->setObjectName("OnceDataDisplay");
this->setStyleSheet("QWidget#OnceDataDisplay {"
" border: 2px solid white;"
" border-radius: 10px;"
"}");
layout = new QVBoxLayout();
layout->setAlignment(Qt::AlignTop);
this->setLayout(layout);
title = new QLabel(u8"本次运行数据");
QFont font("微软雅黑", 16, QFont::Bold);
QPalette palette;
palette.setColor(QPalette::WindowText, Qt::white);
title->setFont(font);
title->setPalette(palette);
title->setAlignment(Qt::AlignCenter);
title->setObjectName("titleLabel");
title->setStyleSheet("QLabel#titleLabel {"
" border: 4px solid white;"
" border-radius: 12px;"
"}");
dataPanel = new QWidget;
dataPanel->setObjectName("dataPanel");
dataPanel->setStyleSheet("QWidget#dataPanel {"
" border: 2px solid white;"
" border-radius: 3px;"
"}");
QVBoxLayout* dataPanelVboxLayout = new QVBoxLayout();
dataPanel->setLayout(dataPanelVboxLayout);
QFont font2("微软雅黑", 8, QFont::Bold);
QHBoxLayout* widthVLayout = new QHBoxLayout();
QLabel* widthTextLabel = new QLabel(u8"长度");
widthValueLabel = new QLabel(u8"待读取");
widthVLayout->addWidget(widthTextLabel);
widthVLayout->addWidget(widthValueLabel);
widthTextLabel->setPalette(palette);
widthValueLabel->setPalette(palette);
QHBoxLayout* heightVLayout = new QHBoxLayout();
QLabel* heightTextLabel = new QLabel(u8"宽度:");
heightValueLabel = new QLabel(u8"待读取");
heightVLayout->addWidget(heightTextLabel);
heightVLayout->addWidget(heightValueLabel);
heightTextLabel->setPalette(palette);
heightValueLabel->setPalette(palette);
dataPanelVboxLayout->addLayout(widthVLayout);
dataPanelVboxLayout->addLayout(heightVLayout);
layout->addWidget(title);
layout->addWidget(dataPanel);
}
};
#pragma once