Obsolete Members for QVariant
The following members of class QVariant are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.
Public Types
(obsolete) enum | Type { Invalid, BitArray, Bitmap, Bool, Brush, …, UserType } |
Public Functions
(obsolete) bool | operator<(const QVariant &v) const |
(obsolete) bool | operator<=(const QVariant &v) const |
(obsolete) bool | operator>(const QVariant &v) const |
(obsolete) bool | operator>=(const QVariant &v) const |
Related Non-Members
(obsolete) bool | qVariantCanConvert(const QVariant &value) |
(obsolete) QVariant | qVariantFromValue(const T &value) |
(obsolete) void | qVariantSetValue(QVariant &variant, const T &value) |
(obsolete) T | qVariantValue(const QVariant &value) |
Member Type Documentation
enum QVariant::Type
This enum is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Use QMetaType::Type instead
This enum type defines the types of variable that a QVariant can contain.
Constant | Value | Description |
---|---|---|
QVariant::Invalid | QMetaType::UnknownType | no type |
QVariant::BitArray | QMetaType::QBitArray | a QBitArray |
QVariant::Bitmap | QMetaType::QBitmap | a QBitmap |
QVariant::Bool | QMetaType::Bool | a bool |
QVariant::Brush | QMetaType::QBrush | a QBrush |
QVariant::ByteArray | QMetaType::QByteArray | a QByteArray |
QVariant::Char | QMetaType::QChar | a QChar |
QVariant::Color | QMetaType::QColor | a QColor |
QVariant::Cursor | QMetaType::QCursor | a QCursor |
QVariant::Date | QMetaType::QDate | a QDate |
QVariant::DateTime | QMetaType::QDateTime | a QDateTime |
QVariant::Double | QMetaType::Double | a double |
QVariant::EasingCurve | QMetaType::QEasingCurve | a QEasingCurve |
QVariant::Uuid | QMetaType::QUuid | a QUuid |
QVariant::ModelIndex | QMetaType::QModelIndex | a QModelIndex |
QVariant::PersistentModelIndex | QMetaType::QPersistentModelIndex | a QPersistentModelIndex (since 5.5) |
QVariant::Font | QMetaType::QFont | a QFont |
QVariant::Hash | QMetaType::QVariantHash | a QVariantHash |
QVariant::Icon | QMetaType::QIcon | a QIcon |
QVariant::Image | QMetaType::QImage | a QImage |
QVariant::Int | QMetaType::Int | an int |
QVariant::KeySequence | QMetaType::QKeySequence | a QKeySequence |
QVariant::Line | QMetaType::QLine | a QLine |
QVariant::LineF | QMetaType::QLineF | a QLineF |
QVariant::List | QMetaType::QVariantList | a QVariantList |
QVariant::Locale | QMetaType::QLocale | a QLocale |
QVariant::LongLong | QMetaType::LongLong | a qlonglong |
QVariant::Map | QMetaType::QVariantMap | a QVariantMap |
QVariant::Matrix | QMetaType::QMatrix | a QMatrix |
QVariant::Transform | QMetaType::QTransform | a QTransform |
QVariant::Matrix4x4 | QMetaType::QMatrix4x4 | a QMatrix4x4 |
QVariant::Palette | QMetaType::QPalette | a QPalette |
QVariant::Pen | QMetaType::QPen | a QPen |
QVariant::Pixmap | QMetaType::QPixmap | a QPixmap |
QVariant::Point | QMetaType::QPoint | a QPoint |
QVariant::PointF | QMetaType::QPointF | a QPointF |
QVariant::Polygon | QMetaType::QPolygon | a QPolygon |
QVariant::PolygonF | QMetaType::QPolygonF | a QPolygonF |
QVariant::Quaternion | QMetaType::QQuaternion | a QQuaternion |
QVariant::Rect | QMetaType::QRect | a QRect |
QVariant::RectF | QMetaType::QRectF | a QRectF |
QVariant::RegExp | QMetaType::QRegExp | a QRegExp |
QVariant::RegularExpression | QMetaType::QRegularExpression | a QRegularExpression |
QVariant::Region | QMetaType::QRegion | a QRegion |
QVariant::Size | QMetaType::QSize | a QSize |
QVariant::SizeF | QMetaType::QSizeF | a QSizeF |
QVariant::SizePolicy | QMetaType::QSizePolicy | a QSizePolicy |
QVariant::String | QMetaType::QString | a QString |
QVariant::StringList | QMetaType::QStringList | a QStringList |
QVariant::TextFormat | QMetaType::QTextFormat | a QTextFormat |
QVariant::TextLength | QMetaType::QTextLength | a QTextLength |
QVariant::Time | QMetaType::QTime | a QTime |
QVariant::UInt | QMetaType::UInt | a uint |
QVariant::ULongLong | QMetaType::ULongLong | a qulonglong |
QVariant::Url | QMetaType::QUrl | a QUrl |
QVariant::Vector2D | QMetaType::QVector2D | a QVector2D |
QVariant::Vector3D | QMetaType::QVector3D | a QVector3D |
QVariant::Vector4D | QMetaType::QVector4D | a QVector4D |
QVariant::UserType | QMetaType::User | Base value for user-defined types. |
Member Function Documentation
bool QVariant::operator<(const QVariant &v) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Compares this QVariant with v and returns true
if this is less than v.
Note: Comparability might not be availabe for the type stored in this QVariant or in v.
Warning: To make this function work with a custom type registered with qRegisterMetaType(), its comparison operator must be registered using QMetaType::registerComparators().
This operator is deprecated as it cannot establish a total order required for most use of this operator, which is the reason you cannot use QVariant as the key of a QMap.
bool QVariant::operator<=(const QVariant &v) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Compares this QVariant with v and returns true
if this is less or equal than v.
Note: Comparability might not be available for the type stored in this QVariant or in v.
Warning: To make this function work with a custom type registered with qRegisterMetaType(), its comparison operator must be registered using QMetaType::registerComparators().
This operator is deprecated as it cannot establish a total order.
bool QVariant::operator>(const QVariant &v) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Compares this QVariant with v and returns true
if this is larger than v.
Note: Comparability might not be available for the type stored in this QVariant or in v.
Warning: To make this function work with a custom type registered with qRegisterMetaType(), its comparison operator must be registered using QMetaType::registerComparators().
This operator is deprecated as it cannot establish a total order.
bool QVariant::operator>=(const QVariant &v) const
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Compares this QVariant with v and returns true
if this is larger or equal than v.
Note: Comparability might not be available for the type stored in this QVariant or in v.
Warning: To make this function work with a custom type registered with qRegisterMetaType(), its comparison operator must be registered using QMetaType::registerComparators().
This operator is deprecated as it cannot establish a total order.
Related Non-Members
template <typename T> bool qVariantCanConvert(const QVariant &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns true
if the given value can be converted to the template type specified; otherwise returns false
.
This function is equivalent to QVariant::canConvert(value).
Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.
See also QVariant::canConvert().
template <typename T> QVariant qVariantFromValue(const T &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns a variant containing a copy of the given value with template type T
.
This function is equivalent to QVariant::fromValue(value).
Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.
For example, a QObject pointer can be stored in a variant with the following code:
QObject *object = getObjectFromSomewhere(); QVariant data = QVariant::fromValue(object);
See also QVariant::fromValue().
template <typename T> void qVariantSetValue(QVariant &variant, const T &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Sets the contents of the given variant to a copy of the value with the specified template type T
.
This function is equivalent to QVariant::setValue(value).
Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.
See also QVariant::setValue().
template <typename T> T qVariantValue(const QVariant &value)
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
Returns the given value converted to the template type T
.
This function is equivalent to QVariant::value<T>(value).
Note: This function was provided as a workaround for MSVC 6 which did not support member template functions. It is advised to use the other form in new code.
See also QVariant::value() and qvariant_cast().