#ifndef P00_PUBLICPAGE_H #define P00_PUBLICPAGE_H #include #include #include #include #include #include #include #include #include #include #include "DataCenter/DataCenter.h" #include "DataCenter/OpcUaManager.h" // 前向声明 class DataCenter; class OpcUaManager; class CursorController; class QKeyEvent; namespace Ui { class P00_PublicPage; } class P00_PublicPage : public QWidget { Q_OBJECT Q_PROPERTY(QRect voiceGeometry READ voiceGeometry WRITE setVoiceGeometry) public: explicit P00_PublicPage(QWidget *parent = nullptr); ~P00_PublicPage() override; void smoothScrollTo(int targetX); void WinInit(); void CursorInit(); void SignalSlotInit(); void ChangePage(uint16_t PageIndex,uint16_t PageNum,QString PageNames); void VoiceWin(const QString &Info, bool shouldShow); protected: void keyPressEvent(QKeyEvent *e) override; private slots: void UIRefreshTimeOut(); void CursorScanTimerOut(); void onOpcStateChanged(QOpcUaClient::ClientState state); // 页面切换槽函数 void on_But_Close_clicked(); void on_But_Page_0_clicked(); void on_But_Page_1_clicked(); void on_But_Page_2_clicked(); void on_But_Page_3_clicked(); void on_But_Page_4_clicked(); void on_But_Page_5_clicked(); void on_But_Page_6_clicked(); void on_But_Page_7_clicked(); void on_But_Page_8_clicked(); void on_But_Page_9_clicked(); void on_But_Page_10_clicked(); void on_But_Page_11_clicked(); void on_But_Page_12_clicked(); void on_But_Page_13_clicked(); void on_But_Page_14_clicked(); void on_But_Page_15_clicked(); private: // 光标移动处理 void onCursorMoved(const QPoint &global); QRect voiceGeometry() const; void setVoiceGeometry(const QRect &g); void startGeometryAnim(const QRect &start, const QRect &end, int dur); bool m_realShow = false; Ui::P00_PublicPage *ui; QScrollBar* hScroll; QLabel *m_cursorLabel = nullptr; // 自绘光标 OpcUaManager *m_opcManager; // OPC通信实例 DataCenter *m_dataCenter; // 数据中心 QString m_currentNodeId; // 当前操作节点ID QTimer *UIRefresh_Timer; // UI刷新定时器 QTimer *CursorScan_Timer; // 光标扫描定时器 bool PLC_Started; // PLC运行状态标志 QMap m_widgetCache; // 页面缓存 QList slMotorCurColor; // 电机电流颜色列表 QList slMotorTempColor; // 电机温度颜色列表 // 光标状态变量(静态化避免重复定义) static bool OldUp; static bool OldDown; static bool OldLeft; static bool OldRight; static bool OldConfirm; bool OldShowVoice = false; }; #endif // P00_PUBLICPAGE_H