You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/mGui/mGuiAnal/iLayerWx.h

151 lines
4.3 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#pragma once
////////////////////////////////////////////////////////////////////
// 特别说明由于进度限制并且为了测试AI编码对于多层的对话框设置功能相对比
// 较单一而且有对标软件的效果所以采用了AI直接编码模式基本没有做大的改动。
// 效果功能优先暂不予iFramework框架进行集成。
// 涉及类库及文件:iLayerColorBand.h/cpp
// iLayerTableModel.h/cpp
// iLayerTableView.h/cpp
// iLayerWx.h/cpp
// 创建日期2026-01-08
// 作者AI大模型
// 整合者wangzg
// 后附:具体交互见 本文件末尾部分
////////////////////////////////////////////////////////////////////
#include <QDialog>
#include <QPushButton>
#include <QSpinBox>
#include <QSplitter>
#include "iDlgBase.h"
#include "iLayerTableModel.h"
#include "iLayerTableView.h"
#include "iLayerColorBand.h"
#include "mGuiAnal_global.h"
class M_GUI_ANAL_EXPORT iLayerWx : public iDlgBase
{
Q_OBJECT
public:
explicit iLayerWx(QWidget *parent = 0);
~iLayerWx();
// Set layer information
void setLayerInfo(const QList<LayerData>& layers);
// Get layer information
QList<LayerData> getLayerInfo() const;
signals:
void sigLayerInfoOK(QList<LayerData>& );
private slots:
void onAddLayer();
void onInsertLayer();
void onDeleteLayer();
void onSetRowCount();
void onRowCountChanged(int value);
void onTableViewAdd();
void onTableViewInsert(int row);
void onTableViewDelete(int row);
void onTableViewSetRowCount();
void onLayerColorChanged(int index, const QColor& color);
void onLayerRatioChanged(int index, double newRatio, double newThick);
void onAccept();
void onReject();
void updateVisualization();
void updateVisualizationEx(QModelIndex, QModelIndex);
private:
void setupUI();
void setupConnections();
private:
iLayerTableModel *m_model;
iLayerTableView *m_tableView;
iLayerColorBand *m_visualWidget;
QPushButton *m_btnAdd;
QPushButton *m_btnInsert;
QPushButton *m_btnDelete;
QSpinBox *m_spinRowCount;
QPushButton *m_btnOk;
QPushButton *m_btnCancel;
QSplitter *m_mainSplitter;
};
////////////////////////////////////////////////////////////////////
/* 附:具体交互文本
我现在有这样一个需求,请帮我实现
开发语言Qt
版本4.8.2,请一定要注意版本。
功能描述实现一个iWxLayer的对话框其功能如下
1.界面布局包括三部分左侧是个ZxTableView基于QTableView的表格
中间是,竖排的几个按钮
右侧是,绘图区
2.按钮从上往下Add/添加Insert/插入、Delete/删除、RowCount指定行数
Add/添加,在表格中追加添加一行,默认 “LayerNo。。”、“10”、计算出来的比例
Insert/插入,在表格当前行位置插入一行,默认 “LayerNo。。”、“10”、计算出来的比例
Delete/删除,在表格删除所选行一行,默认 “LayerNo。。”、“10”、计算出来的比例
RowCount指定固定的行数2-50之间的数据如果需要添加就用的 默认 “LayerNo。。
”、“10”、计算出来的比例
3.表格,分四列,层名称 LayerName字符串、层厚度 Thickness小数单位 m保留
三位小数、百分比Ratio、小数就是当前行厚度所占全部行厚度的百分比、备注字符串
表格,默认给两行数据。
第三列百分比,只读(因为能够实时计算出来)
其它列,可以双击编辑修改(比如名称可以随便改,但厚度就只能是小数)修改之后,实时更新
百分比列
额外增加一行(最后的一行,汇总行,只读,显示合计内容,不能删除改行)
当然,表格添加几个右键,实现与 Add/添加Insert/插入、Delete/删除、RowCount指定
行数 完全相同的功能。
4.右侧绘图区,
按照给定的绘图区域大小,从上到下,按照表格行数,以及每一行的百分比,汇总不同颜色为背景
的颜色块。
默认配置不同的颜色。
每种颜色块的高度,与表格中的,百分比是对应的。
双击每个颜色块,可以调整该块的颜色。
每个颜色块中间显示 对应左侧表格行的 LayerName以及厚度比如 Layer#123.5m, 12.5%
,其中括号内,以斜体浅灰显示。
5.左侧表格更改了,右侧要实时刷新。
当然,最后可以拖动颜色块边界,调整颜色块高度,同样,需要刷新到 左侧表格。
6.左中右布局,可以拖动调整宽度(当中间按钮 保持不变),比如当右侧颜色块宽度比较小了,显示
Layer#123.5m, 12.5%显示不全时就可以不显示了。iWxLayer对话框整体Resize各个
部分也要响应Resize
7.iWxLayer最右下角有“确定”、“取消”
提供俩接口setLayerInfo和getLayerInfo把设置的层信息暴露出来。其中iWxLayer如果用
户调用了setLayerInfo那么对话框初始化时候应该按照用户设定的把表格和颜色块显示出来。
然后用户可以在此基础上进行修改。
添加必要的注释。
谢谢。
//////////////////////////////////////////////////////////////////*/