#ifndef NUMPADDIALOG_H #define NUMPADDIALOG_H #include class QLineEdit; // ===================== 数字键盘弹窗(模态) ===================== // 半透明遮罩 + 键盘面板:顶部输入回显,数字键 1-9、0,退格、清除,确认/取消 class NumPadDialog : public QDialog { Q_OBJECT public: explicit NumPadDialog(QWidget* parent = nullptr); void setMaxLen(int n) { m_maxLen = n; } void setValue(const QString& v); QString value() const { return m_value; } void clear(); private slots: void onDigit(const QString& d); void onBackspace(); void onClear(); private: void refreshEcho(); QLineEdit* m_echo = nullptr; QString m_value; int m_maxLen = 4; }; #endif // NUMPADDIALOG_H