add color/size property adjustment
This commit is contained in:
parent
3843720e06
commit
f1cfd8828c
|
|
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
|||
|
||||
project(PropertyEditor CXX)
|
||||
|
||||
find_package(Qt6 COMPONENTS Core Widgets Gui QuickWidgets QuickTemplates2 QuickControls2 REQUIRED)
|
||||
find_package(Qt6 COMPONENTS Core Widgets Gui GuiPrivate QuickWidgets QuickTemplates2 QuickControls2 REQUIRED)
|
||||
|
||||
qt6_add_resources(QRC_FILE resources.qrc)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +1,91 @@
|
|||
import QtQuick;
|
||||
import QtQuick.Controls;
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Dialogs
|
||||
|
||||
Item{
|
||||
Item {
|
||||
id: control
|
||||
property color value
|
||||
implicitHeight: 25
|
||||
signal asValueChanged(text:var)
|
||||
implicitWidth: 150
|
||||
signal asValueChanged(text: var)
|
||||
|
||||
function setValue(newValue:var){
|
||||
if(newValue !== value){
|
||||
// 计算颜色代码(hex格式)
|
||||
function getColorCode(color) {
|
||||
if (color.a === 1) {
|
||||
// 不透明颜色
|
||||
return color.toString().toUpperCase()
|
||||
} else {
|
||||
// 透明颜色
|
||||
return Qt.rgba(color.r, color.g, color.b, color.a).toString()
|
||||
}
|
||||
}
|
||||
|
||||
function setValue(newValue: var) {
|
||||
if (newValue !== value) {
|
||||
value = newValue
|
||||
asValueChanged(value)
|
||||
}
|
||||
}
|
||||
|
||||
Button{
|
||||
anchors.margins: 2
|
||||
Row {
|
||||
anchors.fill: parent
|
||||
palette {
|
||||
button: value
|
||||
}
|
||||
background: Rectangle {
|
||||
spacing: 5
|
||||
|
||||
// 左边颜色显示矩形
|
||||
Rectangle {
|
||||
id: colorRect
|
||||
width: 25
|
||||
height: parent.height
|
||||
radius: 2
|
||||
border.width: 1
|
||||
border.color: Qt.darker(colorRect.color, 1.5)
|
||||
color: value
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
colorDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
colorDialog.open()
|
||||
|
||||
// 右边颜色代码显示(不可编辑)
|
||||
Rectangle {
|
||||
width: parent.width - colorRect.width - parent.spacing
|
||||
height: parent.height
|
||||
radius: 2
|
||||
border.width: 1
|
||||
border.color: "#cccccc"
|
||||
|
||||
Text {
|
||||
id: colorText
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
text: getColorCode(value)
|
||||
font.pixelSize: 12
|
||||
elide: Text.ElideRight
|
||||
|
||||
// 颜色值改变时更新文本
|
||||
Connections {
|
||||
target: control
|
||||
function onValueChanged() {
|
||||
colorText.text = getColorCode(control.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 点击整个右侧区域也可以打开颜色选择
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
colorDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ColorDialog {
|
||||
id: colorDialog
|
||||
selectedColor: value
|
||||
|
|
@ -35,6 +93,4 @@ Item{
|
|||
control.setValue(selectedColor)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
|||
include/structDataCauseEditDlg.h
|
||||
include/structDataActionParaDlg.h
|
||||
include/bayMeasureDlg.h
|
||||
include/basePropertyProxy.h
|
||||
include/basePannelPropertyProxy.h
|
||||
include/dataSourceDlg.h
|
||||
include/diagramEditor/editPanel.h
|
||||
include/diagramEditor/editView.h
|
||||
include/diagramEditor/editScene.h
|
||||
|
|
@ -129,6 +132,7 @@ set(DIAGRAMCAVAS_HEADER_FILES
|
|||
include/propertyType/CustomGadget.h
|
||||
include/propertyType/CustomType.h
|
||||
include/propertyType/PropertyTypeCustomization_CustomType.h
|
||||
include/propertyType/pannelColorGadget.h
|
||||
../common/include/httpInterface.h
|
||||
../common/include/tools.h
|
||||
../common/include/global.h
|
||||
|
|
@ -188,6 +192,9 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
|||
source/structDataCauseEditDlg.cpp
|
||||
source/structDataActionParaDlg.cpp
|
||||
source/bayMeasureDlg.cpp
|
||||
source/basePropertyProxy.cpp
|
||||
source/basePannelPropertyProxy.cpp
|
||||
source/dataSourceDlg.cpp
|
||||
source/diagramEditor/editPanel.cpp
|
||||
source/diagramEditor/editView.cpp
|
||||
source/diagramEditor/editScene.cpp
|
||||
|
|
@ -264,6 +271,7 @@ set(DIAGRAMCAVAS_SOURCE_FILES
|
|||
source/instance/extraPropertyManager.cpp
|
||||
|
||||
source/propertyType/PropertyTypeCustomization_CustomType.cpp
|
||||
source/propertyType/pannelColorGadget.cpp
|
||||
../common/source/httpInterface.cpp
|
||||
../common/source/baseProperty.cpp
|
||||
../common/source/tools.cpp
|
||||
|
|
@ -298,6 +306,7 @@ set(UI_FILES
|
|||
ui/diagramConnectSetting.ui
|
||||
ui/structDataPreviewDlg.ui
|
||||
ui/bayMeasureDlg.ui
|
||||
ui/dataSourceDlg.ui
|
||||
)
|
||||
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
|
|
|
|||
|
|
@ -17,11 +17,11 @@ class StatusBar;
|
|||
class PowerEntity;
|
||||
class ProjectDiagramNameInput;
|
||||
class BayManagerDlg;
|
||||
class BasePannelPropertyProxy;
|
||||
|
||||
class BaseDrawingPanel : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent = nullptr,DiagramMode mode = DM_edit);
|
||||
~BaseDrawingPanel();
|
||||
|
|
@ -50,10 +50,13 @@ public:
|
|||
QString getGenerateByPanel() {return _sGenerateByPanel;}
|
||||
|
||||
PowerEntity* getEntity() {return _pEntity;}
|
||||
BasePannelPropertyProxy* getPropertyProxy(){return _pPropertyProxy;}
|
||||
signals:
|
||||
void panelDelete(const QString&,int);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *closeEvent) {};
|
||||
protected:
|
||||
BasePannelPropertyProxy* _pPropertyProxy; //属性页代理
|
||||
protected:
|
||||
DesignerView* m_pGraphicsView;
|
||||
DesignerScene* m_pGraphicsScene;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef BASEPANNELPROPERTYPROXY_H
|
||||
#define BASEPANNELPROPERTYPROXY_H
|
||||
/****************************
|
||||
* pannel属性代理基类
|
||||
* *************************/
|
||||
#include "basePropertyProxy.h"
|
||||
#include "propertyType/pannelColorGadget.h"
|
||||
|
||||
class BaseDrawingPanel;
|
||||
|
||||
class BasePannelPropertyProxy : public BasePropertyProxy {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_PROPERTY(QString Name READ getName WRITE setName)
|
||||
Q_PROPERTY(QSize Size READ getSize WRITE setSize)
|
||||
Q_PROPERTY(PannelColorGadget* Color READ getColorGadgetPtr WRITE setColorGadgetPtr)
|
||||
//Q_PROPERTY(QColor BackColor READ getBackColor WRITE setBackColor)
|
||||
//Q_PROPERTY(QColor GridColor READ getGridColor WRITE setGridColor)
|
||||
public:
|
||||
BasePannelPropertyProxy(BaseDrawingPanel*);
|
||||
~BasePannelPropertyProxy();
|
||||
public:
|
||||
virtual QString getName() const;
|
||||
virtual void setName(QString);
|
||||
virtual QSize getSize() const;
|
||||
virtual void setSize(QSize);
|
||||
PannelColorGadget* getColorGadgetPtr(){return _pColorGadget;}
|
||||
void setColorGadgetPtr(PannelColorGadget* p){_pColorGadget = p;}
|
||||
// virtual QColor getBackColor() const;
|
||||
// virtual void setBackColor(QColor);
|
||||
// virtual QColor getGridColor() const;
|
||||
// virtual void setGridColor(QColor);
|
||||
protected:
|
||||
BaseDrawingPanel* _pPanel;
|
||||
PannelColorGadget* _pColorGadget;
|
||||
};
|
||||
#endif //BASEPANNELPROPERTYPROXY_H
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#ifndef BASEPROPERTYPROXY_H
|
||||
#define BASEPROPERTYPROXY_H
|
||||
/****************************
|
||||
* 属性页代理基类
|
||||
* *************************/
|
||||
#include <QObject>
|
||||
|
||||
class BasePropertyProxy : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
BasePropertyProxy(QObject* parnet = nullptr);
|
||||
~BasePropertyProxy();
|
||||
};
|
||||
#endif //BASEPROPERTYPROXY_H
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
#ifndef DATASOURCEDLG_H
|
||||
#define DATASOURCEDLG_H
|
||||
|
||||
/*********运行时数据源选则*********/
|
||||
#include <QDialog>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class dataSourceDlg; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class QStandardItemModel;
|
||||
class QStandardItem;
|
||||
struct ExtraProperty;
|
||||
class StructDataSource;
|
||||
class ExtraPropertyManager;
|
||||
|
||||
class DataSourceDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataSourceDlg(QWidget *parent = nullptr);
|
||||
~DataSourceDlg();
|
||||
|
||||
void initial();
|
||||
void loadData();
|
||||
|
||||
void setExtraPropertyManager(ExtraPropertyManager* p) {_pExtraProManager = p;}
|
||||
void showDlg();
|
||||
public slots:
|
||||
void onOkClicked();
|
||||
void onCancelClicked();
|
||||
|
||||
void onTreeSelectionChanged(const QModelIndex& current, const QModelIndex& previous);
|
||||
void addItemToView(const ExtraProperty& property,
|
||||
const QString& displayMode, // "name" 或 "tag"
|
||||
QStandardItem* root,
|
||||
QStandardItem* pItem);
|
||||
private:
|
||||
void clearItems();
|
||||
void clearPropertyList();
|
||||
void loadCategoryProperties(QStandardItem* categoryItem);
|
||||
QVector<ExtraProperty> getCategoryPropertiesFromDataManager(const QVariantMap& categoryData);
|
||||
void updatePropertyList(QVector<ExtraProperty>);
|
||||
bool expandToPropertyByCode(const QString& propertyCode,const QString& displayMode); //根据编码展开到属性节点
|
||||
bool expandToNodeByNames(QStandardItem* rootItem,const QStringList& nodeNames); //根据已知名称展开到对应节点
|
||||
private:
|
||||
Ui::dataSourceDlg *ui;
|
||||
QStandardItemModel* _treeModel;
|
||||
QStandardItem* m_currentCategoryItem; //当前操作对象
|
||||
ExtraPropertyManager* _pExtraProManager; //使用外部的manager
|
||||
StructDataSource* m_dataSource;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -24,7 +24,10 @@ public:
|
|||
|
||||
GraphicsItemGroup* createGroup();
|
||||
void destroyGroup();
|
||||
|
||||
void setBackGoundColor(QColor color) {m_backGroundColor = color;}
|
||||
QColor getBackGoundColor() {return m_backGroundColor;}
|
||||
void setGridColor(QColor color) {m_gridColor = color;}
|
||||
QColor getGridColor() {return m_gridColor;}
|
||||
signals:
|
||||
void signalAddItem(QGraphicsItem*);
|
||||
protected:
|
||||
|
|
@ -43,7 +46,8 @@ private:
|
|||
bool m_bGridVisible;
|
||||
QGraphicsView* m_pView;
|
||||
BaseDrawingPanel* m_pDrawingPanel; //保存父指针
|
||||
|
||||
QColor m_backGroundColor;
|
||||
QColor m_gridColor;
|
||||
private:
|
||||
FixedPortsModel* _graphModel;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ class DataAccessor;
|
|||
struct HttpRecommandInfo;
|
||||
class StructDataPreviewDlg;
|
||||
class ExtraPropertyManager;
|
||||
class DataSourceDlg;
|
||||
|
||||
class DIAGRAM_DESIGNER_PUBLIC DiagramCavas : public QMdiArea
|
||||
{
|
||||
|
|
@ -41,6 +42,7 @@ public:
|
|||
void passRecommmandHttpData(HttpRecommandInfo); //传递推荐列表数据
|
||||
DiagramConnectSetting* getConnectSettingDlg() {return _connectSetting;}
|
||||
ExtraPropertyManager* getExtraPropertyManager() {return _extraPropertyManager;}
|
||||
DataSourceDlg* getDataSourceDlg() {return _dataSourceDlg;}
|
||||
public:
|
||||
void initial();
|
||||
signals:
|
||||
|
|
@ -48,6 +50,7 @@ signals:
|
|||
void prepareSelectItems(QList<monitorRelationItem>);
|
||||
void updateMonitorList(QString,QPair<QString,QUuid>,int nMode = 0); //0新增1删除
|
||||
void createdMonitorItems(QList<monitorRelationItem>); //创建的监控中item个数
|
||||
void selectTarget(QObject*);
|
||||
public slots:
|
||||
void onSignal_addDrawingPanel(PowerEntity* p,DiagramMode = DM_edit,QString parent = QString()); //parent:派生运行时的page
|
||||
void onSignal_addGraphicsItem(modelStateInfo&);
|
||||
|
|
@ -103,6 +106,8 @@ public slots:
|
|||
QMap<QString,QPair<DrawingPanel*,QMdiSubWindow*>> getMapDraw() {return m_mapDrawPanel;}
|
||||
QMap<QString,QPair<EditPanel*,QMdiSubWindow*>> getMapEdit() {return m_mapEditPanel;}
|
||||
QMap<QString,QPair<MonitorPanel*,QMdiSubWindow*>> getMapMonitor() {return m_mapMonitorPanel;}
|
||||
|
||||
void onTargetSelected(QObject*); //选中事件(属性显示)
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
private:
|
||||
|
|
@ -120,6 +125,7 @@ private:
|
|||
DataAccessor* _dataAccessor;
|
||||
StructDataPreviewDlg* _structDataPreviewDlg;
|
||||
ExtraPropertyManager* _extraPropertyManager;
|
||||
DataSourceDlg* _dataSourceDlg;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -541,6 +541,10 @@ protected:
|
|||
class GraphicsProjectModelItem : public GraphicsBaseItem //工程模item
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_PROPERTY(QString Name READ getName WRITE setName)
|
||||
Q_PROPERTY(QPointF Position READ getPosition WRITE setPosition)
|
||||
Q_PROPERTY(QRectF Size READ getSize WRITE setSize)
|
||||
public:
|
||||
GraphicsProjectModelItem(QGraphicsItem *parent);
|
||||
GraphicsProjectModelItem(const GraphicsProjectModelItem&);
|
||||
|
|
@ -588,6 +592,13 @@ public:
|
|||
_curMonitorStateEnable = info.bEnable;
|
||||
}
|
||||
}
|
||||
public:
|
||||
QString getName() const;
|
||||
void setName(QString);
|
||||
QPointF getPosition() const;
|
||||
void setPosition(QPointF);
|
||||
QRectF getSize() const;
|
||||
void setSize(QRectF);
|
||||
protected:
|
||||
virtual QVariant itemChange(QGraphicsItem::GraphicsItemChange, const QVariant&) override;
|
||||
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent*) override;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef PANNELCOLORGADGET_H
|
||||
#define PANNELCOLORGADGET_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QSharedPointer>
|
||||
|
||||
class BaseDrawingPanel;
|
||||
|
||||
class PannelColorGadget {
|
||||
Q_GADGET
|
||||
public:
|
||||
Q_PROPERTY(QColor BackColor READ getBackColor WRITE setBackColor)
|
||||
Q_PROPERTY(QColor GridColor READ getGridColor WRITE setGridColor)
|
||||
public:
|
||||
PannelColorGadget(BaseDrawingPanel*);
|
||||
|
||||
QColor getBackColor() const;
|
||||
void setBackColor(QColor);
|
||||
QColor getGridColor() const;
|
||||
void setGridColor(QColor);
|
||||
private:
|
||||
BaseDrawingPanel* _pPanel;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QSharedPointer<PannelColorGadget>);
|
||||
|
||||
#endif // PANNELCOLORGADGET_H
|
||||
|
|
@ -8,7 +8,9 @@
|
|||
#include "util/selectorManager.h"
|
||||
#include "statusBar.h"
|
||||
#include "powerEntity.h"
|
||||
#include "diagramCavas.h"
|
||||
#include "topologyManager.h"
|
||||
#include "basePannelPropertyProxy.h"
|
||||
|
||||
BaseDrawingPanel::BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramMode mode)
|
||||
: QWidget(parent)
|
||||
|
|
@ -18,6 +20,7 @@ BaseDrawingPanel::BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramM
|
|||
,_verticalLayout(nullptr)
|
||||
,_horizontalLayout(nullptr)
|
||||
,_hSplitter(nullptr)
|
||||
,_pPropertyProxy(nullptr)
|
||||
{
|
||||
_pEntity = pEntity;
|
||||
_pModel = new FixedPortsModel(pEntity);
|
||||
|
|
@ -33,6 +36,15 @@ BaseDrawingPanel::BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramM
|
|||
m_pGraphicsView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
m_pGraphicsScene->setView(m_pGraphicsView);
|
||||
_pModel->setScene(m_pGraphicsScene);
|
||||
connect(m_pGraphicsScene, &DesignerScene::selectionChanged, this, [&](){
|
||||
QList<QGraphicsItem*> selectedItems = m_pGraphicsScene->selectedItems();
|
||||
if(selectedItems.count() != 1) {
|
||||
_pModel->getCavas()->onTargetSelected(_pPropertyProxy);
|
||||
return;
|
||||
}
|
||||
GraphicsBaseItem *item = static_cast<GraphicsBaseItem*>(selectedItems.first());
|
||||
_pModel->getCavas()->onTargetSelected(item);
|
||||
});
|
||||
|
||||
m_pStatusBar = new StatusBar(this);
|
||||
m_pStatusBar->setMaximumHeight(25);
|
||||
|
|
@ -54,12 +66,16 @@ BaseDrawingPanel::BaseDrawingPanel(PowerEntity* pEntity,QWidget *parent,DiagramM
|
|||
_verticalLayout->addWidget(m_pStatusBar);
|
||||
_verticalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
_verticalLayout->setSpacing(0);
|
||||
|
||||
_pPropertyProxy = new BasePannelPropertyProxy(this);
|
||||
}
|
||||
|
||||
BaseDrawingPanel::~BaseDrawingPanel()
|
||||
{
|
||||
if(_pModel)
|
||||
delete _pModel;
|
||||
if(_pPropertyProxy)
|
||||
delete _pPropertyProxy;
|
||||
}
|
||||
|
||||
QGraphicsScene* BaseDrawingPanel::getQGraphicsScene()
|
||||
|
|
@ -79,4 +95,3 @@ SelectorManager* BaseDrawingPanel::selectorManager() const
|
|||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
#include "basePannelPropertyProxy.h"
|
||||
#include "baseDrawingPanel.h"
|
||||
#include "propertyType/pannelColorGadget.h"
|
||||
|
||||
BasePannelPropertyProxy::BasePannelPropertyProxy(BaseDrawingPanel* pPanel)
|
||||
: BasePropertyProxy(pPanel)
|
||||
,_pPanel(pPanel)
|
||||
{
|
||||
_pColorGadget = new PannelColorGadget(_pPanel);
|
||||
}
|
||||
|
||||
BasePannelPropertyProxy::~BasePannelPropertyProxy()
|
||||
{
|
||||
if(_pColorGadget)
|
||||
delete _pColorGadget;
|
||||
}
|
||||
|
||||
|
||||
QString BasePannelPropertyProxy::getName() const
|
||||
{
|
||||
|
||||
return _pPanel->pageName();
|
||||
}
|
||||
|
||||
void BasePannelPropertyProxy::setName(QString str)
|
||||
{
|
||||
_pPanel->setPageName(str);
|
||||
}
|
||||
|
||||
QSize BasePannelPropertyProxy::getSize() const
|
||||
{
|
||||
return _pPanel->size();
|
||||
}
|
||||
|
||||
void BasePannelPropertyProxy::setSize(QSize size)
|
||||
{
|
||||
_pPanel->resize(size);
|
||||
}
|
||||
|
||||
/*QColor BasePannelPropertyProxy::getBackColor() const
|
||||
{
|
||||
return _pPanel->getScene()->getBackGoundColor();
|
||||
}
|
||||
|
||||
void BasePannelPropertyProxy::setBackColor(QColor color)
|
||||
{
|
||||
_pPanel->getScene()->setBackGoundColor(color);
|
||||
}
|
||||
|
||||
QColor BasePannelPropertyProxy::getGridColor() const
|
||||
{
|
||||
return _pPanel->getScene()->getGridColor();
|
||||
}
|
||||
|
||||
void BasePannelPropertyProxy::setGridColor(QColor color)
|
||||
{
|
||||
_pPanel->getScene()->setGridColor(color);
|
||||
}*/
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#include "basePropertyProxy.h"
|
||||
|
||||
BasePropertyProxy::BasePropertyProxy(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BasePropertyProxy::~BasePropertyProxy()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
#include "dataSourceDlg.h"
|
||||
#include "ui_dataSourceDlg.h"
|
||||
#include <QStandardItemModel>
|
||||
#include "structDataSource.h"
|
||||
#include "instance/extraPropertyManager.h"
|
||||
#include "global.h"
|
||||
|
||||
DataSourceDlg::DataSourceDlg(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::dataSourceDlg)
|
||||
,_treeModel(nullptr)
|
||||
,m_currentCategoryItem(nullptr)
|
||||
,_pExtraProManager(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setWindowFlags(Qt::FramelessWindowHint | windowFlags());
|
||||
initial();
|
||||
}
|
||||
|
||||
DataSourceDlg::~DataSourceDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DataSourceDlg::initial()
|
||||
{
|
||||
connect(ui->btn_ok,&QPushButton::clicked,this,&DataSourceDlg::onOkClicked);
|
||||
connect(ui->btn_cancel,&QPushButton::clicked,this,&DataSourceDlg::onCancelClicked);
|
||||
|
||||
m_dataSource = new StructDataSource(this);
|
||||
_treeModel = new QStandardItemModel(this);
|
||||
_treeModel->setHorizontalHeaderLabels(QStringList() << "属性层级结构");
|
||||
ui->treeView->setModel(_treeModel);
|
||||
}
|
||||
|
||||
void DataSourceDlg::loadData()
|
||||
{
|
||||
if(_pExtraProManager)
|
||||
m_dataSource->loadExtrapro(_pExtraProManager->geAlltProperty());
|
||||
}
|
||||
|
||||
void DataSourceDlg::showDlg()
|
||||
{
|
||||
if(_pExtraProManager)
|
||||
{
|
||||
show();
|
||||
clearItems();
|
||||
auto& mapExtra = m_dataSource->allProperties;
|
||||
QStandardItem* root = _treeModel->invisibleRootItem();
|
||||
for(auto& pro:mapExtra){
|
||||
QStandardItem* propertyItem = new QStandardItem();
|
||||
addItemToView(pro,"name",root,propertyItem);
|
||||
}
|
||||
|
||||
ui->treeView->expandAll();
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceDlg::addItemToView(const ExtraProperty& property,
|
||||
const QString& displayMode, // "name" 或 "tag"
|
||||
QStandardItem* root,
|
||||
QStandardItem* pItem)
|
||||
{
|
||||
// 设置叶子节点的显示文本(使用name或tag)
|
||||
if (displayMode == "name") {
|
||||
pItem->setText(property.name.isEmpty() ? "未命名属性" : property.name);
|
||||
} else {
|
||||
pItem->setText(property.tag.isEmpty() ? "unknown_property" : property.tag);
|
||||
}
|
||||
|
||||
// 在叶子节点存储完整的属性信息
|
||||
QVariantMap propertyData;
|
||||
propertyData["property"] = QVariant::fromValue(property);
|
||||
propertyData["displayMode"] = displayMode;
|
||||
propertyData["code"] = property.code;
|
||||
pItem->setData(propertyData, Qt::UserRole + 1);
|
||||
|
||||
QVector<ExtraPropertyLevelInfo> levels = {
|
||||
{(displayMode == "name") ? property.grid_name : property.grid_tag,
|
||||
property.grid_name, property.grid_tag, true,
|
||||
(displayMode == "name") ? "未命名电网" : "unknown_grid"},
|
||||
|
||||
{(displayMode == "name") ? property.zone_name : property.zone_tag,
|
||||
property.zone_name, property.zone_tag, true,
|
||||
(displayMode == "name") ? "未命名区域" : "unknown_zone"},
|
||||
|
||||
{(displayMode == "name") ? property.station_name : property.station_tag,
|
||||
property.station_name, property.station_tag, true,
|
||||
(displayMode == "name") ? "未命名站点" : "unknown_station"},
|
||||
|
||||
{property.currentLevel,
|
||||
property.currentLevel, property.currentLevel, false,
|
||||
(displayMode == "name") ? "通用层级" : "common_level"},
|
||||
|
||||
{(displayMode == "name") ? property.bay_name : property.bay_tag,
|
||||
property.bay_name, property.bay_tag, false,
|
||||
(displayMode == "name") ? "间隔" : "bay"},
|
||||
|
||||
{property.component_name.isEmpty() ?
|
||||
(displayMode == "name") ? "未命名设备" : property.component_uuid.toString() :
|
||||
(displayMode == "name") ? property.component_name : property.component_uuid.toString(),
|
||||
property.component_name, property.component_uuid.toString(), true,
|
||||
(displayMode == "name") ? "未命名设备" : "unknown_component"}
|
||||
};
|
||||
}
|
||||
|
||||
void DataSourceDlg::onOkClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void DataSourceDlg::onCancelClicked()
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
void DataSourceDlg::onTreeSelectionChanged(const QModelIndex& current, const QModelIndex& previous) {
|
||||
Q_UNUSED(previous);
|
||||
|
||||
if (!current.isValid()) {
|
||||
clearPropertyList();
|
||||
return;
|
||||
}
|
||||
|
||||
QStandardItem* item = _treeModel->itemFromIndex(current);
|
||||
if (!item) {
|
||||
clearPropertyList();
|
||||
return;
|
||||
}
|
||||
|
||||
QVariantMap itemData = item->data(Qt::UserRole + 1).toMap();
|
||||
QString levelType = itemData.value("levelType", "").toString();
|
||||
|
||||
if (levelType == "category") {
|
||||
// 点击分类节点,从category节点获取属性
|
||||
loadCategoryProperties(item);
|
||||
}else{
|
||||
clearPropertyList();
|
||||
}
|
||||
}
|
||||
|
||||
void DataSourceDlg::clearPropertyList()
|
||||
{
|
||||
ui->listWidget->clear();
|
||||
m_currentCategoryItem = nullptr;
|
||||
}
|
||||
|
||||
void DataSourceDlg::loadCategoryProperties(QStandardItem* categoryItem) {
|
||||
m_currentCategoryItem = categoryItem;
|
||||
|
||||
// 从category节点获取属性列表
|
||||
QVariantMap categoryData = categoryItem->data(Qt::UserRole + 1).toMap();
|
||||
QVector<ExtraProperty> properties = categoryData["properties"].value<QVector<ExtraProperty>>();
|
||||
|
||||
if (properties.isEmpty()) {
|
||||
// 如果没有属性,从DataManager重新获取
|
||||
properties = getCategoryPropertiesFromDataManager(categoryData);
|
||||
}
|
||||
|
||||
if (properties.isEmpty()) {
|
||||
clearItems();
|
||||
return;
|
||||
}
|
||||
|
||||
updatePropertyList(properties);
|
||||
}
|
||||
|
||||
QVector<ExtraProperty> DataSourceDlg::getCategoryPropertiesFromDataManager(const QVariantMap& categoryData) {
|
||||
QString groupTag = categoryData.value("groupTag").toString();
|
||||
QString modelName = categoryData.value("modelName").toString();
|
||||
QString paraType = categoryData.value("paraType").toString();
|
||||
QString sourceType = categoryData.value("sourceType").toString();
|
||||
QString componentUuid = categoryData.value("component_uuid").toString();
|
||||
|
||||
QVector<ExtraProperty> result;
|
||||
|
||||
for (auto it = m_dataSource->allProperties.begin();
|
||||
it != m_dataSource->allProperties.end(); ++it) {
|
||||
const ExtraProperty& prop = it.value();
|
||||
|
||||
bool match = (prop.group_tag == groupTag) &&
|
||||
(prop.sourceType == sourceType) &&
|
||||
(prop.type_tag == paraType) &&
|
||||
(prop.component_uuid.toString() == componentUuid);
|
||||
|
||||
if (sourceType == "property") {
|
||||
match = match && (prop.sourceConfig.value("modelName").toString() == modelName);
|
||||
}
|
||||
|
||||
if (match) {
|
||||
result.append(prop);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void DataSourceDlg::updatePropertyList(QVector<ExtraProperty> vec)
|
||||
{
|
||||
for(auto& pro:vec){
|
||||
QListWidgetItem* pItem = new QListWidgetItem(pro.code);
|
||||
pItem->setData(Qt::UserRole,pro.connect_para);
|
||||
ui->listWidget->addItem(pItem);
|
||||
}
|
||||
}
|
||||
|
||||
bool DataSourceDlg::expandToPropertyByCode(const QString& propertyCode,
|
||||
const QString& displayMode) {
|
||||
// 在树中搜索对应编码的节点
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(ui->treeView->model());
|
||||
if (!model) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QModelIndexList matches = model->match(
|
||||
model->index(0, 0),
|
||||
Qt::UserRole + 1, // 搜索用户数据
|
||||
QVariant(), // 任意值
|
||||
-1, // 搜索所有
|
||||
Qt::MatchRecursive | Qt::MatchContains
|
||||
);
|
||||
|
||||
for (const QModelIndex& index : matches) {
|
||||
QStandardItem* item = model->itemFromIndex(index);
|
||||
if (item) {
|
||||
QVariantMap itemData = item->data(Qt::UserRole + 1).toMap();
|
||||
|
||||
// 检查是否是属性节点
|
||||
if (itemData.contains("property")) {
|
||||
ExtraProperty property = itemData["property"].value<ExtraProperty>();
|
||||
if (property.code == propertyCode) {
|
||||
// 构建从根节点到该节点的路径
|
||||
QStringList nodeNames;
|
||||
QModelIndex currentIndex = index;
|
||||
|
||||
while (currentIndex.isValid()) {
|
||||
QStandardItem* currentItem = model->itemFromIndex(currentIndex);
|
||||
if (currentItem) {
|
||||
nodeNames.prepend(currentItem->text());
|
||||
}
|
||||
currentIndex = currentIndex.parent();
|
||||
}
|
||||
|
||||
// 去掉根节点
|
||||
if (!nodeNames.isEmpty()) {
|
||||
nodeNames.removeFirst();
|
||||
}
|
||||
|
||||
// 展开到该节点
|
||||
QStandardItem* rootItem = model->invisibleRootItem();
|
||||
return expandToNodeByNames(rootItem, nodeNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DataSourceDlg::expandToNodeByNames(QStandardItem* rootItem,
|
||||
const QStringList& nodeNames) {
|
||||
if (!rootItem || nodeNames.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QStandardItem* currentItem = rootItem;
|
||||
QTreeView* treeView = ui->treeView;
|
||||
|
||||
for (int i = 0; i < nodeNames.size(); ++i) {
|
||||
const QString& targetName = nodeNames[i];
|
||||
bool found = false;
|
||||
|
||||
// 在当前节点的子节点中查找
|
||||
for (int row = 0; row < currentItem->rowCount(); ++row) {
|
||||
QStandardItem* childItem = currentItem->child(row, 0);
|
||||
if (childItem && childItem->text() == targetName) {
|
||||
// 展开当前节点
|
||||
QModelIndex currentIndex = currentItem->index();
|
||||
treeView->expand(currentIndex);
|
||||
|
||||
// 如果是最后一层,选中该节点
|
||||
if (i == nodeNames.size() - 1) {
|
||||
QModelIndex childIndex = childItem->index();
|
||||
treeView->scrollTo(childIndex);
|
||||
treeView->selectionModel()->select(
|
||||
childIndex,
|
||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 继续查找下一层
|
||||
currentItem = childItem;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
// 没有找到对应的节点
|
||||
qWarning() << "Node not found at level" << i << ":" << targetName;
|
||||
|
||||
// 展开到已找到的层级
|
||||
if (currentItem != rootItem) {
|
||||
QModelIndex currentIndex = currentItem->index();
|
||||
treeView->expand(currentIndex);
|
||||
treeView->scrollTo(currentIndex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DataSourceDlg::clearItems()
|
||||
{
|
||||
if(_treeModel){
|
||||
QStandardItem *root = _treeModel->invisibleRootItem(); //先清空model
|
||||
int rowCount = root->rowCount();
|
||||
if (rowCount > 0) {
|
||||
_treeModel->removeRows(0, rowCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,8 @@ DesignerScene::DesignerScene(FixedPortsModel* graphModel, QObject *parent)
|
|||
m_bGridVisible = true;
|
||||
m_pView = nullptr;
|
||||
m_pDrawingPanel = dynamic_cast<BaseDrawingPanel*>(parent);
|
||||
m_backGroundColor = Qt::white;
|
||||
m_gridColor = Qt::darkCyan;
|
||||
}
|
||||
DesignerScene::~DesignerScene()
|
||||
{
|
||||
|
|
@ -40,13 +42,13 @@ DesignerScene::~DesignerScene()
|
|||
void DesignerScene::drawBackground(QPainter* painter, const QRectF& rect)
|
||||
{
|
||||
QGraphicsScene::drawBackground(painter, rect);
|
||||
painter->fillRect(sceneRect(), Qt::white);
|
||||
painter->fillRect(sceneRect(), m_backGroundColor);
|
||||
if(!m_bGridVisible)
|
||||
return;
|
||||
|
||||
QRectF sceneRect = this->sceneRect();
|
||||
QPen pen;
|
||||
pen.setBrush(Qt::darkCyan);//藏青色
|
||||
pen.setBrush(m_gridColor);//藏青色
|
||||
pen.setStyle(Qt::DashLine);
|
||||
pen.setWidthF(0.2);
|
||||
painter->setPen(pen);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "monitorConfigDlg.h"
|
||||
#include "structDataPreviewDlg.h"
|
||||
#include "instance/extraPropertyManager.h"
|
||||
#include "dataSourceDlg.h"
|
||||
|
||||
DiagramCavas::DiagramCavas(QWidget *parent)
|
||||
: QMdiArea(parent)
|
||||
|
|
@ -36,6 +37,7 @@ DiagramCavas::DiagramCavas(QWidget *parent)
|
|||
,_dataAccessor(nullptr)
|
||||
,_structDataPreviewDlg(nullptr)
|
||||
,_extraPropertyManager(nullptr)
|
||||
,_dataSourceDlg(nullptr)
|
||||
{
|
||||
_pageIndex = 0;
|
||||
}
|
||||
|
|
@ -173,6 +175,10 @@ void DiagramCavas::initial()
|
|||
_structDataPreviewDlg = new StructDataPreviewDlg(this);
|
||||
_structDataPreviewDlg->setExtraPropertyManager(_extraPropertyManager);
|
||||
_structDataPreviewDlg->loadData();
|
||||
|
||||
_dataSourceDlg = new DataSourceDlg(this);
|
||||
_dataSourceDlg->setExtraPropertyManager(_extraPropertyManager);
|
||||
_dataSourceDlg->loadData();
|
||||
}
|
||||
|
||||
void DiagramCavas::onSignal_addDrawingPanel(PowerEntity* pItem,DiagramMode mode,QString parent)
|
||||
|
|
@ -595,6 +601,11 @@ void DiagramCavas::resizeEvent(QResizeEvent* event)
|
|||
_cornerButton->positionAtCorner();
|
||||
}
|
||||
|
||||
void DiagramCavas::onTargetSelected(QObject* obj)
|
||||
{
|
||||
emit selectTarget(obj);
|
||||
}
|
||||
|
||||
/*******************************************************/
|
||||
|
||||
void DiagramCavas::onSignal_createEditPanel(QString sName,QUuid uid)
|
||||
|
|
|
|||
|
|
@ -580,6 +580,41 @@ void GraphicsProjectModelItem::syncRotationDataFromParent(const double& data)
|
|||
m_dSyncRotationByParent += 360;
|
||||
}
|
||||
|
||||
QString GraphicsProjectModelItem::getName() const
|
||||
{
|
||||
if(_property)
|
||||
return _property->name();
|
||||
return QString();
|
||||
}
|
||||
|
||||
void GraphicsProjectModelItem::setName(QString str)
|
||||
{
|
||||
if(_property)
|
||||
_property->setName(str);
|
||||
}
|
||||
|
||||
QPointF GraphicsProjectModelItem::getPosition() const
|
||||
{
|
||||
return pos();
|
||||
}
|
||||
|
||||
void GraphicsProjectModelItem::setPosition(QPointF pos)
|
||||
{
|
||||
setPos(pos);
|
||||
}
|
||||
|
||||
QRectF GraphicsProjectModelItem::getSize() const
|
||||
{
|
||||
return m_boundingRect;
|
||||
}
|
||||
|
||||
void GraphicsProjectModelItem::setSize(QRectF rec)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
m_boundingRect = rec;
|
||||
update();
|
||||
}
|
||||
|
||||
QVariant GraphicsProjectModelItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant& value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
#include "propertyType/pannelColorGadget.h"
|
||||
#include "baseDrawingPanel.h"
|
||||
|
||||
PannelColorGadget::PannelColorGadget(BaseDrawingPanel* pPanel)
|
||||
:_pPanel(pPanel)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QColor PannelColorGadget::getBackColor() const
|
||||
{
|
||||
return _pPanel->getScene()->getBackGoundColor();
|
||||
}
|
||||
|
||||
void PannelColorGadget::setBackColor(QColor color)
|
||||
{
|
||||
_pPanel->getScene()->setBackGoundColor(color);
|
||||
}
|
||||
|
||||
QColor PannelColorGadget::getGridColor() const
|
||||
{
|
||||
return _pPanel->getScene()->getGridColor();
|
||||
}
|
||||
|
||||
void PannelColorGadget::setGridColor(QColor color)
|
||||
{
|
||||
_pPanel->getScene()->setGridColor(color);
|
||||
}
|
||||
|
|
@ -0,0 +1,210 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>dataSourceDlg</class>
|
||||
<widget class="QDialog" name="dataSourceDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>698</width>
|
||||
<height>436</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="0,7,3,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(199, 199, 199);</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>数据源选择</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>层级关系</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="treeView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>包含属性</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_4" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>选中属性</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_2"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_ok">
|
||||
<property name="text">
|
||||
<string>确定</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn_cancel">
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -135,12 +135,15 @@ void CMainWindow::initializeDockUi()
|
|||
connect(&ProjectModelManager::instance(),&ProjectModelManager::modelChange,m_pElectricElementsBox,&ElectricElementsBox::onSignal_modelChanged);
|
||||
|
||||
m_pPropertiesEditorView = new QDetailsView();
|
||||
QDockWidget* PropertyEditorDock = new QDockWidget(QString::fromWCharArray(L"属性面板"),this);
|
||||
BaseDockWidget* PropertyEditorDock = new BaseDockWidget(QString::fromWCharArray(L"属性面板"),this);
|
||||
PropertyEditorDock->setWidget(m_pPropertiesEditorView);
|
||||
PropertyEditorDock->setMinimumSize(200,150);
|
||||
PropertyEditorDock->setMinimumSize(350,150);
|
||||
m_pPropertiesEditorView->setObject(m_pDiagramCavas);
|
||||
PropertyEditorDock->setAllowedAreas(Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
|
||||
this->addDockWidget(Qt::RightDockWidgetArea,PropertyEditorDock);
|
||||
connect(m_pDiagramCavas,&DiagramCavas::selectTarget,this,[&](QObject* obj){
|
||||
m_pPropertiesEditorView->setObject(obj);
|
||||
});
|
||||
}
|
||||
|
||||
void CMainWindow::initializeAction()
|
||||
|
|
|
|||
Loading…
Reference in New Issue