|
|
#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#1(23.5m, 12.5%)
|
|
|
,其中括号内,以斜体浅灰显示。
|
|
|
|
|
|
5.左侧表格更改了,右侧要实时刷新。
|
|
|
当然,最后可以拖动颜色块边界,调整颜色块高度,同样,需要刷新到 左侧表格。
|
|
|
|
|
|
6.左中右布局,可以拖动调整宽度(当中间按钮 保持不变),比如当右侧颜色块宽度比较小了,显示
|
|
|
Layer#1(23.5m, 12.5%)显示不全时,就可以不显示了。iWxLayer对话框整体Resize,各个
|
|
|
部分也要响应Resize
|
|
|
|
|
|
7.iWxLayer最右下角有“确定”、“取消”
|
|
|
提供俩接口,setLayerInfo和getLayerInfo,把设置的层信息暴露出来。其中,iWxLayer如果用
|
|
|
户调用了setLayerInfo,那么对话框初始化时候,应该按照用户设定的把表格和颜色块显示出来。
|
|
|
然后用户可以在此基础上进行修改。
|
|
|
|
|
|
添加必要的注释。
|
|
|
|
|
|
谢谢。
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////*/
|