1、构建多选表格组件;

feature/struct-menu-20241023
simonyan 2 weeks ago
parent 7a3e216e0f
commit 696f581460

@ -10,6 +10,7 @@
#include "CFDStructDataSolverInitializationManager.h"
#include "CFDStructDataSolverReferenceQuantityManager.h"
#include "CFDStructDataSolverComputingControlManager.h"
#include "CFDStructDataSolverMonitorResidualManager.h"
#include "CUIProperty/CUIConfig.h"
@ -57,7 +58,8 @@ CUIConfig *CFDStructDataManager::getActionParamUIConfig(QString s)
// 计算控制
if (s == "actionComputationalControlEdit")
return m_solverComputingControlManager->getParamUIConfig();
if (s == "actionComputationalMonitorsResidual")
return m_solverMonitorResidualManager->getParamUIConfig();
qDebug() << "DataManager return null CUIConfig";
return nullptr;
}
@ -74,4 +76,6 @@ void CFDStructDataManager::initDataManagers()
m_solverInitializationManager = new CFDStructDataSolverInitializationManager;
m_solverReferenceQuantityManager = new CFDStructDataSolverReferenceQuantityManager;
m_solverComputingControlManager = new CFDStructDataSolverComputingControlManager;
m_solverMonitorResidualManager = new CFDStructDataSolverMonitorResidualManager;
}

@ -13,6 +13,7 @@ class CFDStructDataSolverTimeModeManager;
class CFDStructDataSolverBasicModelManager;
class CFDStructDataSolverKvislManager;
class CFDStructDataSolverNumericalMethodManager;
class CFDStructDataSolverMonitorResidualManager;
class CUIConfig;
class CFDSTRUCTDATAMANAGER_EXPORT CFDStructDataManager
@ -45,6 +46,8 @@ private:
CFDStructDataSolverReferenceQuantityManager *m_solverReferenceQuantityManager;
// 计算控制
CFDStructDataSolverComputingControlManager *m_solverComputingControlManager;
// 监控-残差曲线
CFDStructDataSolverMonitorResidualManager *m_solverMonitorResidualManager;
};
#endif // CFDSTRUCTDATAMANAGER_H

@ -3,6 +3,9 @@ SOURCES += \
$$PWD/CFDStructDataSolverBoundaryConditionManager.cpp \
$$PWD/CFDStructDataSolverComputingControlManager.cpp \
$$PWD/CFDStructDataSolverInitializationManager.cpp \
$$PWD/CFDStructDataSolverMonitorAerodynamicManager.cpp \
$$PWD/CFDStructDataSolverMonitorImpellerManager.cpp \
$$PWD/CFDStructDataSolverMonitorResidualManager.cpp \
$$PWD/CFDStructDataSolverReferenceQuantityManager.cpp \
$$PWD/CFDStructDataSolverSportsAttributesManager.cpp \
$$PWD/CFDStructDataSolverTimeModeManager.cpp \
@ -17,6 +20,9 @@ HEADERS += \
$$PWD/CFDStructDataSolverBoundaryConditionManager.h \
$$PWD/CFDStructDataSolverComputingControlManager.h \
$$PWD/CFDStructDataSolverInitializationManager.h \
$$PWD/CFDStructDataSolverMonitorAerodynamicManager.h \
$$PWD/CFDStructDataSolverMonitorImpellerManager.h \
$$PWD/CFDStructDataSolverMonitorResidualManager.h \
$$PWD/CFDStructDataSolverReferenceQuantityManager.h \
$$PWD/CFDStructDataSolverSportsAttributesManager.h \
$$PWD/CFDStructDataSolverTimeModeManager.h \

@ -0,0 +1,11 @@
#include "CFDStructDataSolverMonitorAerodynamicManager.h"
CFDStructDataSolverMonitorAerodynamicManager::CFDStructDataSolverMonitorAerodynamicManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent)
{
}
CUIConfig *CFDStructDataSolverMonitorAerodynamicManager::getParamUIConfig()
{
return NULL;
}

@ -0,0 +1,13 @@
#ifndef CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H
#define CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H
#include "CFDStructDataSolverBasicModelManager.h"
class CFDStructDataSolverMonitorAerodynamicManager : public CFDStructDataSolverBasicModelManager
{
public:
explicit CFDStructDataSolverMonitorAerodynamicManager(QObject *parent = nullptr);
CUIConfig* getParamUIConfig();
};
#endif // CFDSTRUCTDATASOLVERMONITORAERODYNAMICMANAGER_H

@ -0,0 +1,11 @@
#include "CFDStructDataSolverMonitorImpellerManager.h"
CFDStructDataSolverMonitorImpellerManager::CFDStructDataSolverMonitorImpellerManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent)
{
}
CUIConfig *CFDStructDataSolverMonitorImpellerManager::getParamUIConfig()
{
return NULL;
}

@ -0,0 +1,14 @@
#ifndef CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H
#define CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H
#include "CFDStructDataSolverBasicModelManager.h"
class CFDStructDataSolverMonitorImpellerManager : public CFDStructDataSolverBasicModelManager
{
public:
explicit CFDStructDataSolverMonitorImpellerManager(QObject *parent = nullptr);
CUIConfig* getParamUIConfig();
};
#endif // CFDSTRUCTDATASOLVERMONITORIMPELLERMANAGER_H

@ -0,0 +1,12 @@
#include "CFDStructDataSolverMonitorResidualManager.h"
CFDStructDataSolverMonitorResidualManager::CFDStructDataSolverMonitorResidualManager(QObject *parent) : CFDStructDataSolverBasicModelManager(parent)
{
}
CUIConfig *CFDStructDataSolverMonitorResidualManager::getParamUIConfig()
{
return new CUIConfig({
{"type", "MultiTableWidget"}}, {});
}

@ -0,0 +1,14 @@
#ifndef CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H
#define CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H
#include "CFDStructDataSolverBasicModelManager.h"
class CFDStructDataSolverMonitorResidualManager : public CFDStructDataSolverBasicModelManager
{
public:
explicit CFDStructDataSolverMonitorResidualManager(QObject *parent = nullptr);
CUIConfig* getParamUIConfig();
};
#endif // CFDSTRUCTDATASOLVERMONITORRESIDUALMANAGER_H

@ -275,7 +275,9 @@ namespace GUI
case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverComputationalControl:
name = "actionComputationalControlEdit";
break;
case SolutionAnalysisTreeEnum::SATree_ComputationalSetupComputationalDomainSolverMonitorsResidual:
name = "actionComputationalMonitorsResidual";
break;
default:
name = "";
}

@ -13,6 +13,7 @@
#include<QDebug>
#include<CUIButtonBox.h>
#include<QVBoxLayout>
#include<CUIMultiTableWidget.h>
/**
@ -57,6 +58,8 @@ void CUI::buildUI()
widget = new CUIButtonBox(conf, subCUI);
} else if(type == "RadioComponent"){
widget = new CUIRadioComponent(conf,subCUI);
} else if(type == "MultiTableWidget") {
widget = new CUIMultiTableWidget(conf, subCUI);
}
if (widget) {
QVBoxLayout *layout = new QVBoxLayout;

@ -17,14 +17,14 @@
CUIButtonBox::CUIButtonBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : CUIComponentBaseContainerWidget(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
/**
* @brief CUIButtonBox::iniUI
* @brief CUIButtonBox::initUI
* @param subCUI
*/
void CUIButtonBox::iniUI(QVector<CUI *> &subCUI)
void CUIButtonBox::initUI(QVector<CUI *> &subCUI)
{
m_groupBox = new QGroupBox;

@ -15,7 +15,7 @@ public:
explicit CUIButtonBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
CUIConfig* conf;
QLayout* layout;
QGroupBox* m_groupBox;

@ -6,10 +6,10 @@
CUICheckBox::CUICheckBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : QCheckBox(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
void CUICheckBox::iniUI(QVector<CUI*> &subCUI)
void CUICheckBox::initUI(QVector<CUI*> &subCUI)
{
this->setText(conf->getPropertyValue("name"));

@ -14,7 +14,7 @@ public:
explicit CUICheckBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
CUIConfig* conf;

@ -15,7 +15,7 @@
CUIComboBox::CUIComboBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : QWidget(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
/**
@ -39,9 +39,9 @@ void CUIComboBox::setLabelWidth(qint32 width)
/**
* @brief CUIComboBox::iniUI widget,labelcomboBox
* @brief CUIComboBox::initUI widget,labelcomboBox
*/
void CUIComboBox::iniUI(QVector<CUI*> &subCUI)
void CUIComboBox::initUI(QVector<CUI*> &subCUI)
{
label = new QLabel(conf->getPropertyValue("name"));
comboBox = new QComboBox;

@ -17,7 +17,7 @@ public:
qint32 getLabelWidth();
void setLabelWidth(qint32 width);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
void iniComoboBox();
QComboBox* comboBox;
QLabel* label;

@ -26,3 +26,8 @@ QLayout *CUIComponentBaseContainerWidget::getLayout(CUIConfig *conf)
layout->setMargin(0);
return layout;
}
void CUIComponentBaseContainerWidget::initUI()
{
}

@ -12,6 +12,7 @@ public:
explicit CUIComponentBaseContainerWidget(QWidget *parent = nullptr);
protected:
virtual QLayout* getLayout(CUIConfig* conf);
virtual void initUI();
protected:
QLayout* m_layout;
signals:

@ -26,3 +26,8 @@ QLayout *CUIComponentBaseWidget::getLayout(CUIConfig *conf)
layout->setMargin(0);
return layout;
}
void CUIComponentBaseWidget::initUI()
{
}

@ -11,9 +11,9 @@ public:
explicit CUIComponentBaseWidget(QWidget *parent = nullptr);
protected:
virtual QLayout* getLayout(CUIConfig* conf);
virtual void initUI();
protected:
QLayout* m_layout = nullptr;
signals:
};

@ -14,14 +14,14 @@
CUIGroupBox::CUIGroupBox(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : CUIComponentBaseContainerWidget(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
/**
* @brief CUIGroupBox::iniUI
* @brief CUIGroupBox::initUI
*/
void CUIGroupBox::iniUI(QVector<CUI*> &subCUI)
void CUIGroupBox::initUI(QVector<CUI*> &subCUI)
{
m_groupBox = new QGroupBox;
m_groupBox->setTitle(conf->getPropertyValue("name"));

@ -19,7 +19,7 @@ protected:
QLayout* m_layout;
QGroupBox* m_groupBox;
protected:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
signals:

@ -16,7 +16,7 @@
CUILineEdit::CUILineEdit(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : CUIComponentBaseWidget(parent)
{
this->m_conf = conf;
this->iniUI(subCUI);
this->initUI(subCUI);
}
@ -40,9 +40,9 @@ void CUILineEdit::setLabelWidth(qint32 width)
/**
* @brief CUILineEdit::iniUI
* @brief CUILineEdit::initUI
*/
void CUILineEdit::iniUI(QVector<CUI*> &subCUI)
void CUILineEdit::initUI(QVector<CUI*> &subCUI)
{
m_layout = new QHBoxLayout();
m_label = new QLabel(m_conf->getPropertyValue("name"));

@ -20,7 +20,7 @@ public:
qint32 getLabelWidth();
void setLabelWidth(qint32 width);
private:
void iniUI(QVector<CUI*> &subCUI);
virtual void initUI(QVector<CUI*> &subCUI);
// 设置格式校验器
void setValidator();
// 设置输入提示

@ -0,0 +1,67 @@
#include "CUIMultiTableWidget.h"
#include <QTableWidget>
#include <QTableWidgetItem>
#include <QHeaderView>
#include <QList>
#include <QPair>
#include <QVBoxLayout>
#include <QCheckBox>
#include "CUI.h"
CUIMultiTableWidget::CUIMultiTableWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : CUIComponentBaseWidget(parent)
{
this->initUI();
}
void CUIMultiTableWidget::initUI()
{
QStringList headers;
headers<<tr("index")<<tr("name")<<tr("view");
QList<QList<QString>> items;
QList<QString> item1 = {tr("quaility"), "quaility"};
QList<QString> item2 = {tr("x"), "x"};
QList<QString> item3 = {tr("y"), "y"};
QList<QString> item4 = {tr("z"), "z"};
items.append(item1);
items.append(item2);
items.append(item3);
items.append(item4);
// 根据配置来初始化tableWidget
m_tableWidget = new QTableWidget(this);
m_tableWidget->setColumnCount(items.count() + 2);
m_tableWidget->setRowCount(items.count());
m_tableWidget->setHorizontalHeaderLabels(headers);
// 设置水平表头的背景颜色
m_tableWidget->setStyleSheet(QString(u8"QHeaderView::section{background-color: rgb(226,234,243); color: black; border:1px solid rgb(255, 255, 255);}"));
m_tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); // 禁止编辑
m_tableWidget->setFocusPolicy(Qt::NoFocus);
// 隐藏垂直表头
QHeaderView *verticalHeader = m_tableWidget->verticalHeader();
verticalHeader->setVisible(false);
for (int i=0;i<items.count();i++) {
QList<QString> item = items[i];
// 序号
QTableWidgetItem* indexItem = new QTableWidgetItem(QString("%1").arg(i+1));
indexItem->setFlags(indexItem->flags() &~Qt::ItemIsSelectable);
indexItem->setTextAlignment(Qt::AlignCenter); // 设置水平居中
m_tableWidget->setItem(i,0, indexItem);
// 内容
for (int j=0;j<item.count();j++) {
QTableWidgetItem* nameItem = new QTableWidgetItem(item[j]);
nameItem->setFlags(indexItem->flags() &~Qt::ItemIsSelectable);
nameItem->setTextAlignment(Qt::AlignCenter); // 设置水平居中
m_tableWidget->setItem(i,j+1, nameItem);
}
// 复选框
QTableWidgetItem *checkBoxItem = new QTableWidgetItem();
m_tableWidget->setItem(i,item.count() + 1, checkBoxItem);
QCheckBox* checkBox = new QCheckBox();
checkBox->setStyleSheet("margin-left:45%; margin-right:45%;");// 设置水平居中
m_tableWidget->setCellWidget(i, item.count() + 1, checkBox);
}
m_layout = new QVBoxLayout;
m_layout->addWidget(m_tableWidget);
this->setLayout(m_layout);
}

@ -0,0 +1,24 @@
#ifndef CUIMULTITABLEWIDGET_H
#define CUIMULTITABLEWIDGET_H
#include "CUIComponentBaseWidget.h"
#include "CUIComponentBase.h"
class QTableWidget;
class CUI;
class CUIMultiTableWidget : public CUIComponentBaseWidget, public CUIComponentBase
{
Q_OBJECT
public:
explicit CUIMultiTableWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
protected:
void initUI();
protected:
QTableWidget* m_tableWidget;
signals:
};
#endif // CUIMULTITABLEWIDGET_H

@ -4,34 +4,36 @@ HEADERS += \
$$PWD/CUIComponentBaseWidget.h \
$$PWD/CUIDefine.h \
$$PWD/CUIRadioComponent.h \
CUI.h \
CUIButtonBox.h \
CUICheckBox.h \
CUIComboBox.h \
CUIGroupBox.h \
CUILineEdit.h \
CUIPushButton.h \
CUIRadioButton.h \
CUITabWidget.h \
CUIWidget.h \
CUISigsCenter.h \
CUIPropertyAPI.h \
CUIConfig.h
$$PWD/CUIMultiTableWidget.h \
$$PWD/CUI.h \
$$PWD/CUIButtonBox.h \
$$PWD/CUICheckBox.h \
$$PWD/CUIComboBox.h \
$$PWD/CUIGroupBox.h \
$$PWD/CUILineEdit.h \
$$PWD/CUIPushButton.h \
$$PWD/CUIRadioButton.h \
$$PWD/CUITabWidget.h \
$$PWD/CUIWidget.h \
$$PWD/CUISigsCenter.h \
$$PWD/CUIPropertyAPI.h \
$$PWD/CUIConfig.h
SOURCES += \
$$PWD/CUIComponentBase.cpp \
$$PWD/CUIComponentBaseContainerWidget.cpp \
$$PWD/CUIComponentBaseWidget.cpp \
$$PWD/CUIRadioComponent.cpp \
CUI.cpp \
CUIButtonBox.cpp \
CUICheckBox.cpp \
CUIComboBox.cpp \
CUIGroupBox.cpp \
CUILineEdit.cpp \
CUIPushButton.cpp \
CUIRadioButton.cpp \
CUITabWidget.cpp \
CUIWidget.cpp \
CUIConfig.cpp \
CUISigsCenter.cpp
$$PWD/CUIMultiTableWidget.cpp \
$$PWD/CUI.cpp \
$$PWD/CUIButtonBox.cpp \
$$PWD/CUICheckBox.cpp \
$$PWD/CUIComboBox.cpp \
$$PWD/CUIGroupBox.cpp \
$$PWD/CUILineEdit.cpp \
$$PWD/CUIPushButton.cpp \
$$PWD/CUIRadioButton.cpp \
$$PWD/CUITabWidget.cpp \
$$PWD/CUIWidget.cpp \
$$PWD/CUIConfig.cpp \
$$PWD/CUISigsCenter.cpp

@ -6,10 +6,10 @@
CUIPushButton::CUIPushButton(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : QPushButton(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
void CUIPushButton::iniUI(QVector<CUI*> &subCUI)
void CUIPushButton::initUI(QVector<CUI*> &subCUI)
{
this->setText(conf->getPropertyValue("name"));
}

@ -14,7 +14,7 @@ public:
explicit CUIPushButton(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
CUIConfig* conf;
signals:

@ -7,10 +7,10 @@
CUIRadioButton::CUIRadioButton(CUIConfig* conf, QVector<CUI*> subCUI,QWidget *parent) : QRadioButton(parent)
{
this->conf = conf;
iniUI();
initUI();
}
void CUIRadioButton::iniUI()
void CUIRadioButton::initUI()
{
this->setText(conf->getPropertyValue("name"));

@ -15,7 +15,7 @@ public:
explicit CUIRadioButton(CUIConfig* conf, QVector<CUI*> subCUI, QWidget *parent = nullptr);
private:
void iniUI();
void initUI();
CUIConfig* conf;
signals:

@ -12,13 +12,13 @@
CUITabWidget::CUITabWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent) : QTabWidget(parent)
{
this->conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
/**
* @brief CUITabWidget::iniUI
* @brief CUITabWidget::initUI
*/
void CUITabWidget::iniUI(QVector<CUI*> &subCUI)
void CUITabWidget::initUI(QVector<CUI*> &subCUI)
{
for(auto conf : conf->getSub()) {
CUI* subui = new CUI(nullptr, conf);

@ -13,7 +13,7 @@ public:
explicit CUITabWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
CUIConfig* conf;
QVector<CUI> subUI;

@ -14,13 +14,13 @@
CUIWidget::CUIWidget(CUIConfig *conf, QVector<CUI*> &subCUI, QWidget *parent): CUIComponentBaseContainerWidget(parent)
{
this->m_conf = conf;
iniUI(subCUI);
initUI(subCUI);
}
/**
* @brief CUIWidget::iniUI
* @brief CUIWidget::initUI
*/
void CUIWidget::iniUI(QVector<CUI*> &subCUI)
void CUIWidget::initUI(QVector<CUI*> &subCUI)
{
m_layout = this->getLayout(m_conf);
this->setLayout(m_layout);

@ -13,7 +13,7 @@ class CUIWidget : public CUIComponentBaseContainerWidget, CUIComponentBase
public:
explicit CUIWidget(CUIConfig* conf, QVector<CUI*> &subCUI, QWidget *parent = nullptr);
private:
void iniUI(QVector<CUI*> &subCUI);
void initUI(QVector<CUI*> &subCUI);
signals:
};

Loading…
Cancel
Save