Rabbit Remote Control 0.0.35
Loading...
Searching...
No Matches
Parameter.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef CPARAMETER_H_KL_2022_07_27
4#define CPARAMETER_H_KL_2022_07_27
5
6#pragma once
7
8#include <QSettings>
9#include <QString>
10#include <QVector>
11#include "client_export.h"
12
168class CLIENT_EXPORT CParameter : public QObject
169{
170 Q_OBJECT
171 Q_PROPERTY(bool Modified READ GetModified WRITE SetModified FINAL)
172
173public:
191 explicit CParameter(QObject *parent = nullptr,
192 const QString& szPrefix = QString());
193 virtual ~CParameter();
194
196 virtual int Load(QString szFile = QString());
198 virtual int Save(QString szFile = QString(), bool bForce = true);
199
201 virtual int Load(QSettings &set);
203 virtual int Save(QSettings &set, bool bForce = true);
204
224 virtual bool CheckValidity();
225
226Q_SIGNALS:
236
237protected:
238 virtual int OnLoad(QSettings &set) = 0;
239 virtual int OnSave(QSettings &set) = 0;
253 virtual bool OnCheckValidity();
254
263 int SetModified(bool bModified = true);
273 bool GetModified();
274
275private:
281 int AddCategory(CParameter* p);
282 QString GetPrefix() const;
283 int SetPrefix(const QString& szPrefix);
284
285private:
286 QString m_szPrefix;
287
295
300 QVector<CParameter*> m_Category;
301};
302
303#endif // CPARAMETER_H_KL_2022_07_27
Parameter interface.
Definition Parameter.h:169
QVector< CParameter * > m_Category
Category.
Definition Parameter.h:300
bool m_bModified
If false, then don't save when save.
Definition Parameter.h:294
void sigChanged()
emit when the parameter changes Usually if required, the corresponding parameter corresponds to a cha...
CParameter(QObject *parent=nullptr, const QString &szPrefix=QString())