12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "ConfigSchemeDataWidget.h"
- #include <Widgets/Button.h>
- #include <Common/Icon.h>
- #include <QLabel>
- #include <QListWidget>
- #include <QBoxLayout>
- #include <QDebug>
- ConfigSchemeDataWidget::ConfigSchemeDataWidget(QWidget *parent) : QWidget(parent)
- {
- initWidget();
- initLayout();
- connectSignalsAndSlots();
- }
- void ConfigSchemeDataWidget::setProcess(SchemePlanManager::SchemeProcessInfo process)
- {
- m_process = process;
- }
- void ConfigSchemeDataWidget::initWidget()
- {
- m_titleLabel = new QLabel("添加方案数据", this);
- m_titleLabel->setObjectName("titleLabel");
- m_titleLabel->setFixedHeight(50);
- m_titleLabel->setContentsMargins(10, 0, 0, 0);
- m_listTitleLabel = new QLabel("方案列表", this);
- m_listTitleLabel->setObjectName("listTitleLabel");
- m_tipsLabel = new QLabel("已导入的数据将会显示在这里", this);
- m_tipsLabel->setObjectName("tipsLabel");
- m_tipsLabel->setHidden(true);
- m_addButton = new QPushButton(NEWFLICON(FluentIcon, ADD)->icon(), "", this);
- m_addButton->setToolTip("添加方案");
- m_listWidget = new QListWidget(this);
- setStyleSheet("#titleLabel {color:#333333; font-size:16px}"
- "#listTitleLabel {color:#333333; font-size:12px}"
- "QPushButton {border: 0;background-color: qlineargradient(x1: 0, y1: 0, x2: "
- "0, y2: 1,stop: 0 #f8f8f8, stop: 1 #f8f8f8);}"
- "QPushButton::hover {border: 1px solid rgba(0, 0, 0, 0.073);}"
- "QPushButton::pressed {background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #dadbde, "
- "stop: 1 #f6f7fa);}"
- "QListWidget {border: 1px solid rgba(0, 0, 0, 0.073);}"
- "QListView::item {height:44;}");
- }
- void ConfigSchemeDataWidget::initLayout()
- {
- m_layout = new QVBoxLayout(this);
- m_layout->setMargin(0);
- m_layout->setSpacing(0);
- m_layout->addWidget(m_titleLabel);
- m_headerLayout = new QHBoxLayout();
- m_layout->addLayout(m_headerLayout);
- m_layout->addSpacing(10);
- m_layout->addWidget(m_tipsLabel);
- m_layout->addWidget(m_listWidget);
- m_headerLayout->addWidget(m_listTitleLabel);
- m_headerLayout->addStretch();
- m_headerLayout->addWidget(m_addButton);
- }
- void ConfigSchemeDataWidget::connectSignalsAndSlots()
- {
- connect(m_addButton, &PushButton::clicked, this, &ConfigSchemeDataWidget::slotAddDataClicked);
- }
- void ConfigSchemeDataWidget::slotAddDataClicked()
- {
- qDebug() << __FUNCTION__ << __LINE__ << endl;
- emit sigAddScheme();
- }
|