diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-21 12:39:29 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-21 12:39:29 (GMT) |
commit | e59ee48a8656d04339967ad99334bd0ddca0c956 (patch) | |
tree | 4fe72429115ae4a4171cd3f1f06d9a3a425973d0 /src/corelib | |
parent | 4aa6869877d4906fcfaac5388294748512cace25 (diff) | |
parent | 508b447075fb852e61ddf88c92c9099dad292747 (diff) | |
download | Qt-e59ee48a8656d04339967ad99334bd0ddca0c956.zip Qt-e59ee48a8656d04339967ad99334bd0ddca0c956.tar.gz Qt-e59ee48a8656d04339967ad99334bd0ddca0c956.tar.bz2 |
Merge commit 'qt/master'
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/global/qendian.qdoc | 2 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 10 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 18 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 41 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 5 | ||||
-rw-r--r-- | src/corelib/statemachine/qeventtransition.cpp | 6 | ||||
-rw-r--r-- | src/corelib/statemachine/qeventtransition.h | 6 | ||||
-rw-r--r-- | src/corelib/tools/qalgorithms.qdoc | 4 |
8 files changed, 66 insertions, 26 deletions
diff --git a/src/corelib/global/qendian.qdoc b/src/corelib/global/qendian.qdoc index e0ef662..949f7b8 100644 --- a/src/corelib/global/qendian.qdoc +++ b/src/corelib/global/qendian.qdoc @@ -42,7 +42,7 @@ /*! \headerfile <QtEndian> \title Endian Conversion Functions - \ingroup classlists + \ingroup funclists \brief The <QtEndian> header provides functions to convert between little and big endian representations of numbers. */ diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c4fbc49..d7ae78f 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -408,13 +408,13 @@ QT_BEGIN_NAMESPACE /*! \headerfile <QtGlobal> \title Global Qt Declarations - \ingroup classlists + \ingroup funclists - \brief The <QtGlobal> header provides basic declarations and - is included by all other Qt headers. + \brief The <QtGlobal> header file includes the fundamental global + declarations. It is included by most other Qt header files. - The declarations include \l {types}, \l functions and - \l macros. + The global declarations include \l{types}, \l{functions} and + \l{macros}. The type definitions are partly convenience definitions for basic types (some of which guarantee certain bit-sizes on all platforms diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 319e2ce..657e367 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2422,6 +2422,24 @@ */ /*! + \enum Qt::AnchorPoint + + Specifies a side of a layout item that can be anchored. This is used by + QGraphicsAnchorLayout. + + \value AnchorLeft The left side of a layout item. + \value AnchorHorizontalCenter A "virtual" side that is centered between the left and the + right side of a layout item. + \value AnchorRight The right side of a layout item. + \value AnchorTop The top side of a layout item. + \value AnchorVerticalCenter A "virtual" side that is centered between the top and the + bottom side of a layout item. + \value AnchorBottom The bottom side of a layout item. + + \sa QGraphicsAnchorLayout +*/ + +/*! \enum Qt::InputMethodHint \value ImhNone No hints. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 65df600..a16ece1 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -174,10 +174,13 @@ static void construct(QVariant::Private *x, const void *copy) case QVariant::UserType: break; default: - x->is_shared = true; - x->data.shared = new QVariant::PrivateShared(QMetaType::construct(x->type, copy)); - if (!x->data.shared->ptr) + void *ptr = QMetaType::construct(x->type, copy); + if (!ptr) { x->type = QVariant::Invalid; + } else { + x->is_shared = true; + x->data.shared = new QVariant::PrivateShared(ptr); + } break; } x->is_null = !copy; @@ -456,15 +459,17 @@ static bool compare(const QVariant::Private *a, const QVariant::Private *b) if (!QMetaType::isRegistered(a->type)) qFatal("QVariant::compare: type %d unknown to QVariant.", a->type); + const void *a_ptr = a->is_shared ? a->data.shared->ptr : &(a->data.ptr); + const void *b_ptr = b->is_shared ? b->data.shared->ptr : &(b->data.ptr); + /* The reason we cannot place this test in a case branch above for the types * QMetaType::VoidStar, QMetaType::QObjectStar and so forth, is that it wouldn't include * user defined pointer types. */ const char *const typeName = QMetaType::typeName(a->type); if (typeName[qstrlen(typeName) - 1] == '*') - return *static_cast<void **>(a->data.shared->ptr) == - *static_cast<void **>(b->data.shared->ptr); + return *static_cast<void *const *>(a_ptr) == *static_cast<void *const *>(b_ptr); - return a->data.shared->ptr == b->data.shared->ptr; + return a_ptr == b_ptr; } /*! @@ -1371,7 +1376,7 @@ void QVariant::create(int type, const void *copy) QVariant::~QVariant() { - if (d.type > Char && d.type != QMetaType::Float && d.type != QMetaType::QObjectStar && (!d.is_shared || !d.data.shared->ref.deref())) + if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared && d.type > Char && d.type < UserType)) handler->clear(&d); } @@ -1387,7 +1392,7 @@ QVariant::QVariant(const QVariant &p) { if (d.is_shared) { d.data.shared->ref.ref(); - } else if (p.d.type > Char && p.d.type != QMetaType::Float && p.d.type != QMetaType::QObjectStar) { + } else if (p.d.type > Char && p.d.type < QVariant::UserType) { handler->construct(&d, p.constData()); d.is_null = p.d.is_null; } @@ -1627,6 +1632,22 @@ QVariant::QVariant(Type type) { create(type, 0); } QVariant::QVariant(int typeOrUserType, const void *copy) { create(typeOrUserType, copy); d.is_null = false; } + +/*! \internal + flags is true if it is a pointer type + */ +QVariant::QVariant(int typeOrUserType, const void *copy, uint flags) +{ + if (flags) { //type is a pointer type + d.type = typeOrUserType; + d.data.ptr = *reinterpret_cast<void *const*>(copy); + d.is_null = false; + } else { + create(typeOrUserType, copy); + d.is_null = false; + } +} + QVariant::QVariant(int val) { d.is_null = false; d.type = Int; d.data.i = val; } QVariant::QVariant(uint val) @@ -1743,7 +1764,7 @@ QVariant& QVariant::operator=(const QVariant &variant) if (variant.d.is_shared) { variant.d.data.shared->ref.ref(); d = variant.d; - } else if (variant.d.type > Char && variant.d.type != QMetaType::Float && variant.d.type != QMetaType::QObjectStar) { + } else if (variant.d.type > Char && variant.d.type < UserType) { d.type = variant.d.type; handler->construct(&d, variant.constData()); d.is_null = variant.d.is_null; @@ -1797,7 +1818,7 @@ const char *QVariant::typeName() const */ void QVariant::clear() { - if (!d.is_shared || !d.data.shared->ref.deref()) + if ((d.is_shared && !d.data.shared->ref.deref()) || (!d.is_shared && d.type < UserType && d.type > Char)) handler->clear(&d); d.type = Invalid; d.is_null = true; diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index d6a704e..97af54b 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -174,6 +174,7 @@ class Q_CORE_EXPORT QVariant ~QVariant(); QVariant(Type type); QVariant(int typeOrUserType, const void *copy); + QVariant(int typeOrUserType, const void *copy, uint flags); QVariant(const QVariant &other); #ifndef QT_NO_DATASTREAM @@ -445,7 +446,7 @@ inline bool qvariant_cast_helper(const QVariant &v, QVariant::Type tp, void *ptr template <typename T> inline QVariant qVariantFromValue(const T &t) { - return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t); + return QVariant(qMetaTypeId<T>(reinterpret_cast<T *>(0)), &t, QTypeInfo<T>::isPointer); } template <> @@ -464,7 +465,7 @@ inline void qVariantSetValue(QVariant &v, const T &t) old->~T(); new (old) T(t); //call the copy constructor } else { - v = QVariant(type, &t); + v = QVariant(type, &t, QTypeInfo<T>::isPointer); } } diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index e2d1f69..89dabde 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE */ /*! - \property QEventTransition::eventObject + \property QEventTransition::eventSource \brief the event source that this event transition is associated with */ @@ -205,7 +205,7 @@ void QEventTransition::setEventType(QEvent::Type type) /*! Returns the event source associated with this event transition. */ -QObject *QEventTransition::eventObject() const +QObject *QEventTransition::eventSource() const { Q_D(const QEventTransition); return d->object; @@ -215,7 +215,7 @@ QObject *QEventTransition::eventObject() const Sets the event source associated with this event transition to be the given \a object. */ -void QEventTransition::setEventObject(QObject *object) +void QEventTransition::setEventSource(QObject *object) { Q_D(QEventTransition); if (d->object == object) diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h index 6cf6a96..941bfa5 100644 --- a/src/corelib/statemachine/qeventtransition.h +++ b/src/corelib/statemachine/qeventtransition.h @@ -57,15 +57,15 @@ class QEventTransitionPrivate; class Q_CORE_EXPORT QEventTransition : public QAbstractTransition { Q_OBJECT - Q_PROPERTY(QObject* eventObject READ eventObject WRITE setEventObject) + Q_PROPERTY(QObject* eventSource READ eventSource WRITE setEventSource) Q_PROPERTY(QEvent::Type eventType READ eventType WRITE setEventType) public: QEventTransition(QState *sourceState = 0); QEventTransition(QObject *object, QEvent::Type type, QState *sourceState = 0); ~QEventTransition(); - QObject *eventObject() const; - void setEventObject(QObject *object); + QObject *eventSource() const; + void setEventSource(QObject *object); QEvent::Type eventType() const; void setEventType(QEvent::Type type); diff --git a/src/corelib/tools/qalgorithms.qdoc b/src/corelib/tools/qalgorithms.qdoc index f7b7798..771c544 100644 --- a/src/corelib/tools/qalgorithms.qdoc +++ b/src/corelib/tools/qalgorithms.qdoc @@ -42,9 +42,9 @@ /*! \headerfile <QtAlgorithms> \title Generic Algorithms - \ingroup classlists + \ingroup funclists - \brief The <QtAlgorithms> header provides generic template-based algorithms. + \brief The <QtAlgorithms> header includes the generic, template-based algorithms. Qt provides a number of global template functions in \c <QtAlgorithms> that work on containers and perform well-know |