C++ 入門指南 4.01
encryptcontroller.h
#ifndef ENCRYPTCONTROLLER_H #define ENCRYPTCONTROLLER_H #include <QObject> #include <QString> #include <qqml.h> #include "encrypt.h" using namespace std; class EncryptController : public QObject { Q_OBJECT Q_PROPERTY(QString userInput READ userInput WRITE setUserInput NOTIFY userInputChanged) QML_ELEMENT public: EncryptController(QObject *parent = nullptr); QString userInput(); void setUserInput(const QString &userInput); QString s2q(const string &); string q2s(const QString &); Q_INVOKABLE void setEncryptObject(); Q_INVOKABLE QString getEncryptObject(); Q_INVOKABLE void encodeFunction(); Q_INVOKABLE QString getEncodeResult(); Q_INVOKABLE void decodeFunction(); Q_INVOKABLE QString getDecodeResult(); Q_INVOKABLE void save(); Q_INVOKABLE bool load(); Q_INVOKABLE void clear(); Q_INVOKABLE void copy(); signals: void userInputChanged(); private: QString m_userInput; QString m_encodeResult; QString m_decodeResult; Encrypt *encryptObject; }; /* 《程式語言教學誌》的範例程式 http://kaiching.org/ 檔名:encryptcontroller.h 功能:EncryptController 類別的標頭檔 作者:張凱慶 */ #endif // ENCRYPTCONTROLLER_H
相關教學影片