展示请求队列的widget

This commit is contained in:
jackfiled 2022-06-26 11:02:21 +08:00
parent ac6a9c9a68
commit 7cbdf5963e
2 changed files with 68 additions and 0 deletions

36
include/queryListItem.h Normal file
View File

@ -0,0 +1,36 @@
//
// Created by ricardo on 2022/6/25.
//
#ifndef AUTO_BUS_GUI_QUERY_LIST_ITEM_H
#define AUTO_BUS_GUI_QUERY_LIST_ITEM_H
#include "QWidget"
#include "QObject"
#include "QLabel"
#include "QHBoxLayout"
class QueryListItem : public QWidget
{
Q_OBJECT
public:
explicit QueryListItem(const int &type, const int &node_id);
void SetColumnName();
private:
/**
*
*/
QLabel type_text;
/**
*
*/
QLabel target_pos_text;
/**
*
*/
QHBoxLayout *layout;
};
#endif //AUTO_BUS_GUI_QUERY_LIST_ITEM_H

32
src/queryListItem.cpp Normal file
View File

@ -0,0 +1,32 @@
//
// Created by ricardo on 2022/6/25.
//
#include "moc_queryListItem.cpp"
QueryListItem::QueryListItem(const int &type, const int &node_id) : QWidget()
{
QFont font("Microsoft YaHei", 10, 75);
layout = new QHBoxLayout(this);
layout->addWidget(&type_text);
layout->addWidget(&target_pos_text);
layout->setContentsMargins(0, 0, 0, 0);
this->setFixedHeight(20);
// 设置文本
type_text.setText(QString::number(type));
target_pos_text.setText(QString::number(node_id));
type_text.setFont(font);
target_pos_text.setFont(font);
type_text.resize(30, 20);
target_pos_text.resize(30, 20);
}
void QueryListItem::SetColumnName()
{
type_text.setText(QString("请求类型"));
target_pos_text.setText(QString("目标站点"));
}