first commit
This commit is contained in:
111
widgets/tableoverlaywidget.h
Normal file
111
widgets/tableoverlaywidget.h
Normal file
@@ -0,0 +1,111 @@
|
||||
#ifndef TABLEOVERLAYWIDGET_H
|
||||
#define TABLEOVERLAYWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QPushButton>
|
||||
#include <QStackedWidget>
|
||||
#include <QMap>
|
||||
#include <QScrollArea>
|
||||
#include <QLabel>
|
||||
#include "../procedure/proceduredata.h"
|
||||
|
||||
/**
|
||||
* @class TableOverlayWidget
|
||||
* @brief 表格浮层组件
|
||||
*
|
||||
* 在页面上显示浮层,支持多个表格的标签页切换
|
||||
* 特点:
|
||||
* - 浮层形式,不阻塞主界面
|
||||
* - 左侧垂直标签页导航
|
||||
* - 可关闭
|
||||
*/
|
||||
class TableOverlayWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TableOverlayWidget(QWidget *parent = nullptr);
|
||||
|
||||
/**
|
||||
* @brief 添加表格到浮层
|
||||
* @param tableId 表格ID
|
||||
* @param tableName 表格名称
|
||||
* @param tableWidget 表格组件
|
||||
*/
|
||||
void addTable(const QString &tableId, const QString &tableName, QWidget *tableWidget);
|
||||
|
||||
/**
|
||||
* @brief 显示特定表格
|
||||
* @param tableId 表格ID
|
||||
*/
|
||||
void showTable(const QString &tableId);
|
||||
|
||||
/**
|
||||
* @brief 移除表格
|
||||
* @param tableId 表格ID
|
||||
*/
|
||||
void removeTable(const QString &tableId);
|
||||
|
||||
/**
|
||||
* @brief 清除所有表格
|
||||
*/
|
||||
void clearTables();
|
||||
|
||||
/**
|
||||
* @brief 显示浮层
|
||||
*/
|
||||
void showOverlay();
|
||||
|
||||
/**
|
||||
* @brief 隐藏浮层
|
||||
*/
|
||||
void hideOverlay();
|
||||
|
||||
/**
|
||||
* @brief 切换浮层显示状态
|
||||
*/
|
||||
void toggleOverlay();
|
||||
|
||||
/**
|
||||
* @brief 是否显示
|
||||
*/
|
||||
bool isOverlayVisible() const { return m_isVisible; }
|
||||
|
||||
signals:
|
||||
void closed();
|
||||
void tableChanged(const QString &tableId);
|
||||
|
||||
private slots:
|
||||
void onTabButtonClicked();
|
||||
void onCloseButtonClicked();
|
||||
|
||||
private:
|
||||
void setupUI();
|
||||
void updateTabButtons();
|
||||
void animateShow();
|
||||
void animateHide();
|
||||
|
||||
struct TableTab
|
||||
{
|
||||
QString id;
|
||||
QString name;
|
||||
QWidget *widget;
|
||||
QPushButton *tabButton;
|
||||
};
|
||||
|
||||
QWidget *m_container; // 浮层容器
|
||||
QScrollArea *m_tabScrollArea; // 标签栏滚动区域
|
||||
QWidget *m_tabBar; // 标签栏容器
|
||||
QVBoxLayout *m_tabLayout; // 标签栏布局
|
||||
QStackedWidget *m_contentStack; // 内容堆栈
|
||||
QPushButton *m_closeBtn; // 关闭按钮
|
||||
QLabel *m_titleLabel; // 标题标签
|
||||
|
||||
QMap<QString, TableTab> m_tables; // 表格映射
|
||||
QString m_currentTableId; // 当前显示的表格ID
|
||||
bool m_isVisible; // 是否可见
|
||||
};
|
||||
|
||||
#endif // TABLEOVERLAYWIDGET_H
|
||||
Reference in New Issue
Block a user