QColor: make nothrow move-assignable and -constructible
The move special members were inhibited by the presence of user-defined copy ctor and assignment operator, which we cannot remove since the class is exported. Change-Id: I54fe6c28351fe69ca4b75066adb76ea07c959dfe Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
b549758c61
commit
d348d40473
@ -481,6 +481,7 @@ QColor::QColor(Spec spec)
|
||||
\sa setNamedColor(), name(), isValid()
|
||||
*/
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
/*!
|
||||
\fn QColor::QColor(const QColor &color)
|
||||
|
||||
@ -488,6 +489,7 @@ QColor::QColor(Spec spec)
|
||||
|
||||
\sa isValid()
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn bool QColor::isValid() const
|
||||
@ -2385,6 +2387,7 @@ QColor QColor::dark(int factor) const
|
||||
return hsv.convertTo(cspec);
|
||||
}
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
/*!
|
||||
Assigns a copy of \a color to this color, and returns a reference to it.
|
||||
*/
|
||||
@ -2394,6 +2397,7 @@ QColor &QColor::operator=(const QColor &color)
|
||||
ct.argb = color.ct.argb;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! \overload
|
||||
Assigns a copy of \a color and returns a reference to this color.
|
||||
|
@ -67,9 +67,20 @@ public:
|
||||
QColor(QRgba64 rgba64);
|
||||
QColor(const QString& name);
|
||||
QColor(const char *name);
|
||||
QColor(const QColor &color); // ### Qt 6: remove, the trivial one is fine.
|
||||
QColor(Spec spec);
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
QColor(const QColor &color); // ### Qt 6: remove all of these, the trivial ones are fine.
|
||||
# ifdef Q_COMPILER_RVALUE_REFS
|
||||
QColor(QColor &&other) Q_DECL_NOTHROW : cspec(other.cspec), ct(other.ct) {}
|
||||
QColor &operator=(QColor &&other) Q_DECL_NOTHROW
|
||||
{ cspec = other.cspec; ct = other.ct; return *this; }
|
||||
# endif
|
||||
QColor &operator=(const QColor &);
|
||||
#endif // Qt < 6
|
||||
|
||||
QColor &operator=(Qt::GlobalColor color);
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
// ### Qt 6: merge overloads
|
||||
@ -195,9 +206,6 @@ public:
|
||||
QColor dark(int f = 200) const Q_REQUIRED_RESULT;
|
||||
QColor darker(int f = 200) const Q_REQUIRED_RESULT;
|
||||
|
||||
QColor &operator=(const QColor &);
|
||||
QColor &operator=(Qt::GlobalColor color);
|
||||
|
||||
bool operator==(const QColor &c) const;
|
||||
bool operator!=(const QColor &c) const;
|
||||
|
||||
@ -262,9 +270,11 @@ inline QColor::QColor(const char *aname)
|
||||
inline QColor::QColor(const QString& aname)
|
||||
{ setNamedColor(aname); }
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
inline QColor::QColor(const QColor &acolor)
|
||||
: cspec(acolor.cspec)
|
||||
{ ct.argb = acolor.ct.argb; }
|
||||
#endif
|
||||
|
||||
inline bool QColor::isValid() const
|
||||
{ return cspec != Invalid; }
|
||||
|
Loading…
Reference in New Issue
Block a user