您现在的位置是:网站首页> C/C++
QT类属性介绍
- C/C++
- 2021-04-21
- 813人已阅读
摘要
class Device: public QObject
{
Q_OBJECT
Q_PROPERTY(QString update READ getUpdate WRITE setUpdate NOTIFY updateChanged)
public:
Device();
~Device();
QString getUpdate();
Q_SIGNALS:
void updateChanged();
private:
void setUpdate(const QString &message);
QString m_message;
实现部分:
QString Device::getUpdate()
{
return m_message;
}
void Device::setUpdate(const QString &message)
{
m_message = message;
emit updateChanged();
}