我的印象是 QObject 禁用了复制构造函数和赋值运算符......为什么我能够编译包含这两者的 QObject 派生?
#ifndef QVERSION_H
#define QVERSION_H
#include "silverlocklib_global.h"
#include <QtCore>
struct SILVERLOCKLIBSHARED_EXPORT QVersion : public QObject
{
Q_OBJECT
Q_PROPERTY(bool valid READ isValid)
Q_PROPERTY(long major READ major)
Q_PROPERTY(long minor READ minor)
Q_PROPERTY(long build READ build)
Q_PROPERTY(long revision READ revision)
public:
QVersion(long major = 0, long minor = 0, long build = -1, long revision = -1, QObject *parent = NULL);
QVersion(const QString &version, QObject *parent = NULL);
QVersion(const QVersion &version);
static QVersion parse(const QString& version, bool *ok = NULL);
bool isValid() const;
long compareTo(const QVersion &other) const;
bool equals(const QVersion &other) const;
QString toString() const;
QString toString(int fieldCount) const;
long major() const;
inline int majorRevision() const { return (qint16)(this->m_revision >> 16); }
long minor() const;
inline int minorRevision() const { return (qint16)(this->m_revision & 65535); }
long build() const;
long revision() const;
QVersion& operator=(const QVersion &version);
friend bool operator==(const QVersion &v1, const QVersion &v2);
friend bool operator!=(const QVersion &v1, const QVersion &v2);
friend bool operator<(const QVersion &v1, const QVersion &v2);
friend bool operator<=(const QVersion &v1, const QVersion &v2);
friend bool operator>(const QVersion &v1, const QVersion &v2);
friend bool operator>=(const QVersion &v1, const QVersion &v2);
private:
inline static void copy(QVersion *const destination, const QVersion &source);
static bool tryParseComponent(const QString &component, long *parsedComponent);
long m_major;
long m_minor;
long m_build;
long m_revision;
};
#endif // QVERSION_H