summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-30 13:28:49 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-30 13:28:49 (GMT)
commita08b3f5336e5c819b33d922d3a809b5203d728f3 (patch)
tree952f42304d50f28ed6651bace587ab7935b29cd0 /src
parent813fc3574a006cb2687715ccf7bdb984a485b173 (diff)
parent188ac02e2fb6cc6437b776f8c5b69a508728fbdb (diff)
downloadQt-a08b3f5336e5c819b33d922d3a809b5203d728f3.zip
Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.gz
Qt-a08b3f5336e5c819b33d922d3a809b5203d728f3.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: demos/demos.pro src/gui/graphicsview/qgraphicsitem_p.h
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qglobal.h3
-rw-r--r--src/corelib/io/qprocess_unix.cpp4
-rw-r--r--src/corelib/tools/qsharedpointer.cpp113
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h37
-rw-r--r--src/gui/graphicsview/graphicsview.pri4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp346
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h49
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h39
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp479
-rw-r--r--src/gui/graphicsview/qgraphicstransform.h168
-rw-r--r--src/gui/graphicsview/qgraphicstransform_p.h73
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h8
-rw-r--r--src/gui/image/qimage.cpp15
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp152
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp322
-rw-r--r--src/gui/painting/qtransform.cpp36
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/qstyleoption.cpp25
-rw-r--r--src/gui/text/qtextformat.cpp101
-rw-r--r--src/gui/widgets/qmenubar.cpp7
-rw-r--r--src/opengl/qglframebufferobject.cpp5
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp4
-rw-r--r--src/qt3support/sql/q3sqlcursor.cpp2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp4
-rw-r--r--src/testlib/qtest.h25
-rw-r--r--src/xml/sax/qxml.cpp18
-rw-r--r--src/xml/sax/qxml.h1
29 files changed, 1403 insertions, 684 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 5e5ce49..dd876f5 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -681,6 +681,9 @@ namespace QT_NAMESPACE {}
// using CC 5.9: Warning: attribute visibility is unsupported and will be skipped..
//# define Q_DECL_EXPORT __attribute__((__visibility__("default")))
# endif
+# if __SUNPRO_CC < 0x5a0
+# define Q_NO_TEMPLATE_FRIENDS
+# endif
# if !defined(_BOOL)
# define Q_NO_BOOL_TYPE
# endif
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index fafce07..607b734 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1161,10 +1161,10 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a
// To catch the startup of the child
int startedPipe[2];
- ::pipe(startedPipe);
+ qt_safe_pipe(startedPipe);
// To communicate the pid of the child
int pidPipe[2];
- ::pipe(pidPipe);
+ qt_safe_pipe(pidPipe);
pid_t childPid = qt_fork();
if (childPid == 0) {
diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp
index 596a125..a186771 100644
--- a/src/corelib/tools/qsharedpointer.cpp
+++ b/src/corelib/tools/qsharedpointer.cpp
@@ -808,29 +808,19 @@
# endif
# endif
-# if !defined(BACKTRACE_SUPPORTED)
-// Dummy implementation of the functions.
-// Using QHashDummyValue also means that the QHash below is actually a QSet
-typedef QT_PREPEND_NAMESPACE(QHashDummyValue) Backtrace;
-
-static inline Backtrace saveBacktrace() { return Backtrace(); }
-static inline void printBacktrace(Backtrace) { }
-
-# else
+# if defined(BACKTRACE_SUPPORTED)
# include <sys/types.h>
# include <execinfo.h>
# include <stdio.h>
# include <unistd.h>
# include <sys/wait.h>
-typedef QT_PREPEND_NAMESPACE(QByteArray) Backtrace;
-
-static inline Backtrace saveBacktrace() __attribute__((always_inline));
-static inline Backtrace saveBacktrace()
+static inline QByteArray saveBacktrace() __attribute__((always_inline));
+static inline QByteArray saveBacktrace()
{
static const int maxFrames = 32;
- Backtrace stacktrace;
+ QByteArray stacktrace;
stacktrace.resize(sizeof(void*) * maxFrames);
int stack_size = backtrace((void**)stacktrace.data(), maxFrames);
stacktrace.resize(sizeof(void*) * stack_size);
@@ -838,7 +828,7 @@ static inline Backtrace saveBacktrace()
return stacktrace;
}
-static void printBacktrace(Backtrace stacktrace)
+static void printBacktrace(QByteArray stacktrace)
{
void *const *stack = (void *const *)stacktrace.constData();
int stack_size = stacktrace.size() / sizeof(void*);
@@ -889,11 +879,19 @@ static void printBacktrace(Backtrace stacktrace)
namespace {
QT_USE_NAMESPACE
+ struct Data {
+ const volatile void *pointer;
+# ifdef BACKTRACE_SUPPORTED
+ QByteArray backtrace;
+# endif
+ };
+
class KnownPointers
{
public:
QMutex mutex;
- QHash<void *, Backtrace> values;
+ QHash<const void *, Data> dPointers;
+ QHash<const volatile void *, const void *> dataPointers;
};
}
@@ -901,38 +899,101 @@ Q_GLOBAL_STATIC(KnownPointers, knownPointers)
QT_BEGIN_NAMESPACE
+namespace QtSharedPointer {
+ Q_CORE_EXPORT void internalSafetyCheckAdd(const volatile void *);
+ Q_CORE_EXPORT void internalSafetyCheckRemove(const volatile void *);
+}
+
+/*!
+ \internal
+*/
+void QtSharedPointer::internalSafetyCheckAdd(const volatile void *)
+{
+ // Qt 4.5 compatibility
+ // this function is broken by design, so it was replaced with internalSafetyCheckAdd2
+ //
+ // it's broken because we tracked the pointers added and
+ // removed from QSharedPointer, converted to void*.
+ // That is, this is supposed to track the "top-of-object" pointer in
+ // case of multiple inheritance.
+ //
+ // However, it doesn't work well in some compilers:
+ // if you create an object with a class of type A and the last reference
+ // is dropped of type B, then the value passed to internalSafetyCheckRemove could
+ // be different than was added. That would leave dangling addresses.
+ //
+ // So instead, we track the pointer by the d-pointer instead.
+}
+
/*!
\internal
*/
-void QtSharedPointer::internalSafetyCheckAdd(const volatile void *ptr)
+void QtSharedPointer::internalSafetyCheckRemove(const volatile void *)
{
+ // Qt 4.5 compatibility
+ // see comments above
+}
+
+/*!
+ \internal
+*/
+void QtSharedPointer::internalSafetyCheckAdd2(const void *d_ptr, const volatile void *ptr)
+{
+ // see comments above for the rationale for this function
KnownPointers *const kp = knownPointers();
if (!kp)
return; // end-game: the application is being destroyed already
QMutexLocker lock(&kp->mutex);
- void *actual = const_cast<void*>(ptr);
- if (kp->values.contains(actual)) {
- printBacktrace(knownPointers()->values.value(actual));
- qFatal("QSharedPointerData: internal self-check failed: pointer %p was already tracked "
- "by another QSharedPointerData object", actual);
+ Q_ASSERT(!kp->dPointers.contains(d_ptr));
+
+ //qDebug("Adding d=%p value=%p", d_ptr, ptr);
+
+ const void *other_d_ptr = kp->dataPointers.value(ptr, 0);
+ if (other_d_ptr) {
+# ifdef BACKTRACE_SUPPORTED
+ printBacktrace(knownPointers()->dPointers.value(other_d_ptr).backtrace);
+# endif
+ qFatal("QSharedPointer: internal self-check failed: pointer %p was already tracked "
+ "by another QSharedPointer object %p", ptr, other_d_ptr);
}
- kp->values.insert(actual, saveBacktrace());
+ Data data;
+ data.pointer = ptr;
+# ifdef BACKTRACE_SUPPORTED
+ data.backtrace = saveBacktrace();
+# endif
+
+ kp->dPointers.insert(d_ptr, data);
+ kp->dataPointers.insert(ptr, d_ptr);
}
/*!
\internal
*/
-void QtSharedPointer::internalSafetyCheckRemove(const volatile void *ptr)
+void QtSharedPointer::internalSafetyCheckRemove2(const void *d_ptr)
{
KnownPointers *const kp = knownPointers();
if (!kp)
return; // end-game: the application is being destroyed already
QMutexLocker lock(&kp->mutex);
- void *actual = const_cast<void*>(ptr);
- kp->values.remove(actual);
+
+ QHash<const void *, Data>::iterator it = kp->dPointers.find(d_ptr);
+ if (it == kp->dPointers.end()) {
+ qFatal("QSharedPointer: internal self-check inconsistency: pointer %p was not tracked. "
+ "To use QT_SHAREDPOINTER_TRACK_POINTERS, you have to enable it throughout "
+ "in your code.", d_ptr);
+ }
+
+ QHash<const volatile void *, const void *>::iterator it2 = kp->dataPointers.find(it->pointer);
+ Q_ASSERT(it2 != kp->dataPointers.end());
+
+ //qDebug("Removing d=%p value=%p", d_ptr, it->pointer);
+
+ // remove entries
+ kp->dataPointers.erase(it2);
+ kp->dPointers.erase(it);
}
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index d9fc73c..657c45a 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -98,9 +98,9 @@ namespace QtSharedPointer {
template <class X, class Y> QSharedPointer<X> copyAndSetPointer(X * ptr, const QSharedPointer<Y> &src);
// used in debug mode to verify the reuse of pointers
- Q_CORE_EXPORT void internalSafetyCheckAdd(const volatile void *);
- Q_CORE_EXPORT void internalSafetyCheckRemove(const volatile void *);
-
+ Q_CORE_EXPORT void internalSafetyCheckAdd2(const void *, const volatile void *);
+ Q_CORE_EXPORT void internalSafetyCheckRemove2(const void *);
+
template <class T, typename Klass, typename RetVal>
inline void executeDeleter(T *t, RetVal (Klass:: *memberDeleter)())
{ (t->*memberDeleter)(); }
@@ -152,17 +152,8 @@ namespace QtSharedPointer {
inline void internalConstruct(T *ptr)
{
-#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- if (ptr) internalSafetyCheckAdd(ptr);
-#endif
value = ptr;
}
- inline void internalDestroy()
- {
-#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
- if (value) internalSafetyCheckRemove(value);
-#endif
- }
#if defined(Q_NO_TEMPLATE_FRIENDS)
public:
@@ -241,7 +232,6 @@ namespace QtSharedPointer {
struct ExternalRefCountWithContiguousData: public ExternalRefCountWithDestroyFn
{
typedef ExternalRefCountWithDestroyFn Parent;
- typedef ExternalRefCountWithContiguousData Self;
T data;
static void deleter(ExternalRefCountData *self)
@@ -254,7 +244,8 @@ namespace QtSharedPointer {
static inline ExternalRefCountData *create(T **ptr)
{
DestroyerFn destroy = &deleter;
- Self *d = static_cast<Self *>(::operator new(sizeof(Self)));
+ ExternalRefCountWithContiguousData *d =
+ static_cast<ExternalRefCountWithContiguousData *>(::operator new(sizeof(ExternalRefCountWithContiguousData)));
// initialize the d-pointer sub-object
// leave d->data uninitialized
@@ -279,8 +270,9 @@ namespace QtSharedPointer {
inline void ref() const { d->weakref.ref(); d->strongref.ref(); }
inline bool deref()
{
- if (!d->strongref.deref())
- this->internalDestroy();
+ if (!d->strongref.deref()) {
+ internalDestroy();
+ }
return d->weakref.deref();
}
@@ -290,6 +282,9 @@ namespace QtSharedPointer {
Q_ASSERT(!d);
if (ptr)
d = new Data;
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
template <typename Deleter>
@@ -299,6 +294,9 @@ namespace QtSharedPointer {
Q_ASSERT(!d);
if (ptr)
d = ExternalRefCountWithCustomDeleter<T, Deleter>::create(ptr, deleter);
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
inline void internalCreate()
@@ -307,6 +305,9 @@ namespace QtSharedPointer {
d = ExternalRefCountWithContiguousData<T>::create(&ptr);
Basic<T>::internalConstruct(ptr);
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ if (ptr) internalSafetyCheckAdd2(d, ptr);
+#endif
}
inline ExternalRefCount() : d(0) { }
@@ -322,7 +323,9 @@ namespace QtSharedPointer {
inline void internalDestroy()
{
- Basic<T>::internalDestroy();
+#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
+ internalSafetyCheckRemove2(d);
+#endif
if (!d->destroy())
delete this->value;
}
diff --git a/src/gui/graphicsview/graphicsview.pri b/src/gui/graphicsview/graphicsview.pri
index 0c0747e..9d232e4 100644
--- a/src/gui/graphicsview/graphicsview.pri
+++ b/src/gui/graphicsview/graphicsview.pri
@@ -16,12 +16,13 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \
graphicsview/qgraphicssceneevent.h \
graphicsview/qgraphicssceneindex_p.h \
graphicsview/qgraphicsscenelinearindex_p.h \
+ graphicsview/qgraphicstransform.h \
+ graphicsview/qgraphicstransform_p.h \
graphicsview/qgraphicsview.h \
graphicsview/qgraphicsview_p.h \
graphicsview/qgraphicswidget.h \
graphicsview/qgraphicswidget_p.h \
graphicsview/qgridlayoutengine_p.h
-
SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qgraphicsitem.cpp \
graphicsview/qgraphicsitemanimation.cpp \
@@ -36,6 +37,7 @@ SOURCES += graphicsview/qgraphicsgridlayout.cpp \
graphicsview/qgraphicssceneevent.cpp \
graphicsview/qgraphicssceneindex.cpp \
graphicsview/qgraphicsscenelinearindex.cpp \
+ graphicsview/qgraphicstransform.cpp \
graphicsview/qgraphicsview.cpp \
graphicsview/qgraphicswidget.cpp \
graphicsview/qgraphicswidget_p.cpp \
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 5b769ab..731a9a9 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -303,11 +303,12 @@
drop shadow effects and for decoration objects that follow the parent
item's geometry without drawing on top of it.
- \value ItemUsesExtendedStyleOption The item makes use of either
- QStyleOptionGraphicsItem::exposedRect or QStyleOptionGraphicsItem::matrix.
+ \value ItemUsesExtendedStyleOption The item makes use of either the
+ exposedRect or matrix member of the QStyleOptionGraphicsItem. Implementers
+ of QGraphicsItem subclasses should set that flag if this data is required.
By default, the exposedRect is initialized to the item's boundingRect and
the matrix is untransformed. Enable this flag for more fine-grained values.
- Use QStyleOptionGraphicsItem::levelOfDetailFromTransform for a more
+ Use QStyleOptionGraphicsItem::levelOfDetailFromTransform() for a more
fine-grained value.
\value ItemHasNoContents The item does not paint anything (i.e., calling
@@ -1197,6 +1198,13 @@ QGraphicsItem::~QGraphicsItem()
else
d_ptr->setParentItemHelper(0);
+ if (d_ptr->transformData) {
+ for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) {
+ QGraphicsTransform *t = d_ptr->transformData->graphicsTransforms.at(i);
+ static_cast<QGraphicsTransformPrivate *>(t->d_ptr)->item = 0;
+ delete t;
+ }
+ }
delete d_ptr->transformData;
qt_dataStore()->data.remove(this);
@@ -2979,94 +2987,19 @@ QTransform QGraphicsItem::transform() const
/*!
\since 4.6
- Returns the rotation around the X axis.
-
- The default is 0
-
- \warning The value doesn't take in account any rotation set with
- the setTransform() method.
-
- \sa setXRotation(), {Transformations}
-*/
-qreal QGraphicsItem::xRotation() const
-{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->xRotation;
-}
-
-/*!
- \since 4.6
-
- Sets the rotation around the X axis to \a angle degrees.
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa xRotation(), setTransformOrigin(), {Transformations}
-*/
-void QGraphicsItem::setXRotation(qreal angle)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xRotation = angle;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- Returns the rotation around the Y axis.
-
- The default is 0
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa setYRotation(), {Transformations}
-*/
-qreal QGraphicsItem::yRotation() const
-{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->yRotation;
-}
-
-/*!
- \since 4.6
-
- Sets the rotation around the Y axis to \a angle degrees.
-
- \warning The value doesn't take in account any rotation set with the setTransform() method.
-
- \sa yRotation(), setTransformOrigin() {Transformations}
-*/
-void QGraphicsItem::setYRotation(qreal angle)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->yRotation = angle;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
Returns the rotation around the Z axis.
The default is 0
\warning The value doesn't take in account any rotation set with the setTransform() method.
- \sa setZRotation(), {Transformations}
+ \sa setRotation(), {Transformations}
*/
-qreal QGraphicsItem::zRotation() const
+qreal QGraphicsItem::rotation() const
{
if (!d_ptr->transformData)
return 0;
- return d_ptr->transformData->zRotation;
+ return d_ptr->transformData->rotation;
}
/*!
@@ -3076,224 +3009,107 @@ qreal QGraphicsItem::zRotation() const
\warning The value doesn't take in account any rotation set with the setTransform() method.
- \sa zRotation(), setTransformOrigin(), {Transformations}
+ \sa rotation(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setZRotation(qreal angle)
+void QGraphicsItem::setRotation(qreal angle)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->zRotation = angle;
+ d_ptr->transformData->rotation = angle;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
- This convenience function set the rotation angles around the 3 axes
- to \a x, \a y and \a z.
-
- \sa setXRotation(), setYRotation(), setZRotation(), {Transformations}
-*/
-void QGraphicsItem::setRotation(qreal x, qreal y, qreal z)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xRotation = x;
- d_ptr->transformData->yRotation = y;
- d_ptr->transformData->zRotation = z;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->rotationChanged();
}
/*!
\since 4.6
- Returns the scale factor on the X axis.
+ Returns the scale factor of the item.
The default is 1
\warning The value doesn't take in account any scaling set with the setTransform() method.
- \sa setXScale(), {Transformations}
+ \sa setScale(), {Transformations}
*/
-qreal QGraphicsItem::xScale() const
+qreal QGraphicsItem::scale() const
{
if (!d_ptr->transformData)
- return 1;
- return d_ptr->transformData->xScale;
+ return 1.;
+ return d_ptr->transformData->scale;
}
/*!
\since 4.6
- Sets the scale factor on the X axis to \a factor.
+ Sets the scale factor of the item to \a factor.
\warning The value doesn't take in account any scaling set with the setTransform() method.
- \sa xScale(), setTransformOrigin(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setXScale(qreal factor)
+void QGraphicsItem::setScale(qreal factor)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xScale = factor;
+ d_ptr->transformData->scale = factor;
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- Returns the scale factor on the Y axis.
-
- The default is 1
-
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa setYScale(), {Transformations}
-*/
-qreal QGraphicsItem::yScale() const
-{
- if (!d_ptr->transformData)
- return 1;
- return d_ptr->transformData->yScale;
-}
-
-/*!
- \since 4.6
-
- Sets the scale factor on the Y axis to \a factor.
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa yScale(), setTransformOrigin(), {Transformations}
-*/
-void QGraphicsItem::setYScale(qreal factor)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->yScale = factor;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ if (d_ptr->isObject)
+ emit static_cast<QGraphicsObject *>(this)->scaleChanged();
}
-/*!
- \since 4.6
-
- This convenience function set the scaling factors on X and Y axis to \a sx and \a sy.
-
- \warning The value doesn't take in account any scaling set with the setTransform() method.
-
- \sa setXScale(), setYScale(), {Transformations}
-*/
-void QGraphicsItem::setScale(qreal sx, qreal sy)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->xScale = sx;
- d_ptr->transformData->yScale = sy;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
/*!
\since 4.6
- Returns the horizontal shear.
-
- The default is 0
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
+ returns list of graphics transformations on the item.
- \sa setHorizontalShear(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-qreal QGraphicsItem::horizontalShear() const
+QList<QGraphicsTransform *> QGraphicsItem::transformations() const
{
if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->horizontalShear;
+ return QList<QGraphicsTransform *>();
+ return d_ptr->transformData->graphicsTransforms;
}
/*!
\since 4.6
- Sets the horizontal shear to \a shear.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
+ Sets a list of graphics transformations on the item to \a transformations.
- \sa horizontalShear(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setHorizontalShear(qreal shear)
+void QGraphicsItem::setTransformations(const QList<QGraphicsTransform *> &transformations)
{
prepareGeometryChange();
if (!d_ptr->transformData)
d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->horizontalShear = shear;
+ d_ptr->transformData->graphicsTransforms = transformations;
+ for (int i = 0; i < transformations.size(); ++i)
+ transformations.at(i)->d_func()->setItem(this);
d_ptr->transformData->onlyTransform = false;
d_ptr->dirtySceneTransform = 1;
}
-/*!
- \since 4.6
-
- Returns the vertical shear.
-
- The default is 0
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
- \sa setHorizontalShear(), {Transformations}
-*/
-qreal QGraphicsItem::verticalShear() const
+void QGraphicsItemPrivate::appendGraphicsTransform(QGraphicsTransform *t)
{
- if (!d_ptr->transformData)
- return 0;
- return d_ptr->transformData->verticalShear;
-}
+ if (!transformData)
+ transformData = new QGraphicsItemPrivate::TransformData;
+ if (!transformData->graphicsTransforms.contains(t))
+ transformData->graphicsTransforms.append(t);
-/*!
- \since 4.6
-
- Sets the vertical shear to \a shear.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
-
- \sa verticalShear(), {Transformations}
-*/
-void QGraphicsItem::setVerticalShear(qreal shear)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->verticalShear = shear;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
-}
-
-/*!
- \since 4.6
-
- This convenience function sets the horizontal shear to \a sh and the vertical shear to \a sv.
-
- \warning The value doesn't take in account any shearing set with the setTransform() method.
-
- \sa setHorizontalShear(), setVerticalShear()
-*/
-void QGraphicsItem::setShear(qreal sh, qreal sv)
-{
- prepareGeometryChange();
- if (!d_ptr->transformData)
- d_ptr->transformData = new QGraphicsItemPrivate::TransformData;
- d_ptr->transformData->horizontalShear = sh;
- d_ptr->transformData->verticalShear = sv;
- d_ptr->transformData->onlyTransform = false;
- d_ptr->dirtySceneTransform = 1;
+ Q_Q(QGraphicsItem);
+ t->d_func()->setItem(q);
+ transformData->onlyTransform = false;
+ dirtySceneTransform = 1;
}
/*!
@@ -3303,9 +3119,9 @@ void QGraphicsItem::setShear(qreal sh, qreal sv)
The default is QPointF(0,0).
- \sa setTransformOrigin(), {Transformations}
+ \sa setTransformOriginPoint(), {Transformations}
*/
-QPointF QGraphicsItem::transformOrigin() const
+QPointF QGraphicsItem::transformOriginPoint() const
{
if (!d_ptr->transformData)
return QPointF(0,0);
@@ -3317,9 +3133,9 @@ QPointF QGraphicsItem::transformOrigin() const
Sets the \a origin point for the transformation in item coordinates.
- \sa transformOrigin(), {Transformations}
+ \sa transformOriginPoint(), {Transformations}
*/
-void QGraphicsItem::setTransformOrigin(const QPointF &origin)
+void QGraphicsItem::setTransformOriginPoint(const QPointF &origin)
{
prepareGeometryChange();
if (!d_ptr->transformData)
@@ -3331,15 +3147,15 @@ void QGraphicsItem::setTransformOrigin(const QPointF &origin)
}
/*!
- \fn void QGraphicsItem::setTransformOrigin(qreal x, qreal y)
+ \fn void QGraphicsItem::setTransformOriginPoint(qreal x, qreal y)
\since 4.6
\overload
Sets the origin point for the transformation in item coordinates.
- This is equivalent to calling setTransformOrigin(QPointF(\a x, \a y)).
+ This is equivalent to calling setTransformOriginPoint(QPointF(\a x, \a y)).
- \sa setTransformOrigin(), {Transformations}
+ \sa setTransformOriginPoint(), {Transformations}
*/
@@ -3618,7 +3434,7 @@ void QGraphicsItem::setMatrix(const QMatrix &matrix, bool combine)
\warning using this function doesnt affect the value of the transformation properties
- \sa transform(), setRotation(), setScale(), setShear(), setTransformOrigin(), {The Graphics View Coordinate System}, {Transformations}
+ \sa transform(), setRotation(), setScale(), setTransformOriginPoint(), {The Graphics View Coordinate System}, {Transformations}
*/
void QGraphicsItem::setTransform(const QTransform &matrix, bool combine)
{
@@ -3732,7 +3548,7 @@ void QGraphicsItem::shear(qreal sh, qreal sv)
/*!
\obsolete
- Use setPos() or setTransformOrigin() instead.
+ Use setPos() or setTransformOriginPoint() instead.
Translates the current item transformation by (\a dx, \a dy).
@@ -6856,6 +6672,41 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
\sa pos()
*/
+/*!
+ \property QGraphicsObject::rotation
+ This property holds the rotation of the item in degrees.
+
+ This specifies how many degrees to rotate the item around its transformOrigin.
+ The default rotation is 0 degrees (i.e. not rotated at all).
+*/
+
+/*!
+ \fn QGraphicsObject::rotationChanged()
+
+ This signal gets emitted whenever the roation of the item changes.
+*/
+
+/*!
+ \property QGraphicsObject::scale
+ This property holds the scale of the item.
+
+ A scale of less than 1 means the item will be displayed smaller than
+ normal, and a scale of greater than 1 means the item will be
+ displayed larger than normal. A negative scale means the item will
+ be mirrored.
+
+ By default, items are displayed at a scale of 1 (i.e. at their
+ normal size).
+
+ Scaling is from the item's transformOrigin.
+*/
+
+/*!
+ \fn void QGraphicsObject::scaleChanged()
+
+ This signal is emitted when the scale of the item changes.
+*/
+
/*!
\property QGraphicsObject::enabled
@@ -6895,6 +6746,15 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent
\sa visible
*/
+/*!
+ \property QGraphicsObject::transformOriginPoint
+ \brief the transformation origin
+
+ This property sets a specific point in the items coordiante system as the
+ origin for scale and rotation.
+
+ \sa scale, rotation, QGraphicsItem::transformOriginPoint()
+*/
/*!
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index f8e74f3..3e7224d 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -72,6 +72,7 @@ class QGraphicsSceneHoverEvent;
class QGraphicsSceneMouseEvent;
class QGraphicsSceneWheelEvent;
class QGraphicsScene;
+class QGraphicsTransform;
class QGraphicsWidget;
class QInputMethodEvent;
class QKeyEvent;
@@ -269,34 +270,19 @@ public:
void shear(qreal sh, qreal sv); // ### obsolete
void translate(qreal dx, qreal dy); // ### obsolete
- qreal xRotation() const;
- void setXRotation(qreal angle);
+ void setRotation(qreal angle);
+ qreal rotation() const;
- qreal yRotation() const;
- void setYRotation(qreal angle);
+ void setScale(qreal scale);
+ qreal scale() const;
- qreal zRotation() const;
- void setZRotation(qreal angle);
- void setRotation(qreal x, qreal y, qreal z);
+ QList<QGraphicsTransform *> transformations() const;
+ void setTransformations(const QList<QGraphicsTransform *> &transformations);
- qreal xScale() const;
- void setXScale(qreal factor);
-
- qreal yScale() const;
- void setYScale(qreal factor);
- void setScale(qreal sx, qreal sy);
-
- qreal horizontalShear() const;
- void setHorizontalShear(qreal shear);
-
- qreal verticalShear() const;
- void setVerticalShear(qreal shear);
- void setShear(qreal sh, qreal sv);
-
- QPointF transformOrigin() const;
- void setTransformOrigin(const QPointF &origin);
- inline void setTransformOrigin(qreal x, qreal y)
- { setTransformOrigin(QPointF(x,y)); }
+ QPointF transformOriginPoint() const;
+ void setTransformOriginPoint(const QPointF &origin);
+ inline void setTransformOriginPoint(qreal x, qreal y)
+ { setTransformOriginPoint(QPointF(x,y)); }
virtual void advance(int phase);
@@ -457,6 +443,7 @@ private:
friend class QGraphicsSceneIndexPrivate;
friend class QGraphicsSceneBspTreeIndex;
friend class QGraphicsSceneBspTreeIndexPrivate;
+ friend class QGraphicsTransformPrivate;
friend class ::tst_QGraphicsItem;
friend bool qt_closestLeaf(const QGraphicsItem *, const QGraphicsItem *);
friend bool qt_closestItemFirst(const QGraphicsItem *, const QGraphicsItem *);
@@ -522,9 +509,19 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(qreal z READ zValue WRITE setZValue NOTIFY zChanged)
+ Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged)
+ Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint)
public:
QGraphicsObject(QGraphicsItem *parent = 0);
+ // ### Qt 5: Disambiguate
+#ifdef Q_NO_USING_KEYWORD
+ const QObjectList &children() const { return QObject::children(); }
+#else
+ using QObject::children;
+#endif
+
Q_SIGNALS:
void parentChanged();
void opacityChanged();
@@ -533,6 +530,8 @@ Q_SIGNALS:
void xChanged();
void yChanged();
void zChanged();
+ void rotationChanged();
+ void scaleChanged();
protected:
QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent, QGraphicsScene *scene);
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index 8097519..aa2cf40 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -57,6 +57,8 @@
#include "qset.h"
#include "qpixmapcache.h"
#include <private/qgraphicsview_p.h>
+#include "qgraphicstransform.h"
+#include <private/qgraphicstransform_p.h>
#include <QtCore/qpoint.h>
@@ -192,7 +194,7 @@ public:
void combineTransformToParent(QTransform *x, const QTransform *viewTransform = 0) const;
void combineTransformFromParent(QTransform *x, const QTransform *viewTransform = 0) const;
- void updateSceneTransformFromParent();
+ virtual void updateSceneTransformFromParent();
// ### Qt 5: Remove. Workaround for reimplementation added after Qt 4.4.
virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const;
@@ -200,6 +202,7 @@ public:
void setPosHelper(const QPointF &pos);
void setTransformHelper(const QTransform &transform);
+ void appendGraphicsTransform(QGraphicsTransform *t);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false,
@@ -467,45 +470,35 @@ public:
struct QGraphicsItemPrivate::TransformData {
QTransform transform;
- qreal xScale;
- qreal yScale;
- qreal xRotation;
- qreal yRotation;
- qreal zRotation;
- qreal horizontalShear;
- qreal verticalShear;
+ qreal scale;
+ qreal rotation;
qreal xOrigin;
qreal yOrigin;
+ QList<QGraphicsTransform *> graphicsTransforms;
bool onlyTransform;
TransformData() :
- xScale(1.0), yScale(1.0), xRotation(0.0), yRotation(0.0), zRotation(0.0),
- horizontalShear(0.0), verticalShear(0.0), xOrigin(0.0), yOrigin(0.0),
+ scale(1.0), rotation(0.0),
+ xOrigin(0.0), yOrigin(0.0),
onlyTransform(true)
{}
QTransform computedFullTransform(QTransform *postmultiplyTransform = 0) const
{
if (onlyTransform) {
- if (!postmultiplyTransform)
- return transform;
- if (postmultiplyTransform->isIdentity())
+ if (!postmultiplyTransform || postmultiplyTransform->isIdentity())
return transform;
if (transform.isIdentity())
return *postmultiplyTransform;
- QTransform x(transform);
- x *= *postmultiplyTransform;
- return x;
+ return transform * *postmultiplyTransform;
}
QTransform x(transform);
- if (xOrigin != 0 || yOrigin != 0)
- x *= QTransform::fromTranslate(xOrigin, yOrigin);
- x.rotate(xRotation, Qt::XAxis);
- x.rotate(yRotation, Qt::YAxis);
- x.rotate(zRotation, Qt::ZAxis);
- x.shear(horizontalShear, verticalShear);
- x.scale(xScale, yScale);
+ for (int i = 0; i < graphicsTransforms.size(); ++i)
+ graphicsTransforms.at(i)->applyTo(&x);
+ x.translate(xOrigin, yOrigin);
+ x.rotate(rotation, Qt::ZAxis);
+ x.scale(scale, scale);
x.translate(-xOrigin, -yOrigin);
if (postmultiplyTransform)
x *= *postmultiplyTransform;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 7e2f7c8..e6727af 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2356,6 +2356,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+ // Auto-activate the first inactive window if the scene is active.
+ if (d->activationRefCount > 0 && !d->activeWindow && item->isWindow())
+ setActiveWindow(static_cast<QGraphicsWidget *>(item));
+
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
if (!d->focusItem && item->focusItem())
@@ -3678,6 +3682,13 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
Q_D(QGraphicsScene);
+ if (d->mouseGrabberItems.isEmpty()) {
+ // Dispatch hover events
+ QGraphicsSceneHoverEvent hover;
+ _q_hoverFromMouseEvent(&hover, mouseEvent);
+ d->dispatchHoverEvent(&hover);
+ }
+
d->mousePressEventHandler(mouseEvent);
}
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
new file mode 100644
index 0000000..b55d78e
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qgraphicstransform.h"
+#include "qgraphicsitem_p.h"
+#include "qgraphicstransform_p.h"
+#include <QDebug>
+
+#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+QT_BEGIN_NAMESPACE
+
+
+void QGraphicsTransformPrivate::setItem(QGraphicsItem *i)
+{
+ if (item == i)
+ return;
+
+ if (item) {
+ Q_Q(QGraphicsTransform);
+ QGraphicsItemPrivate *d_ptr = item->d_ptr;
+
+ item->prepareGeometryChange();
+ Q_ASSERT(d_ptr->transformData);
+ d_ptr->transformData->graphicsTransforms.removeAll(q);
+ d_ptr->dirtySceneTransform = 1;
+ item = 0;
+ }
+
+ item = i;
+}
+
+void QGraphicsTransformPrivate::updateItem(QGraphicsItem *item)
+{
+ item->prepareGeometryChange();
+ item->d_ptr->dirtySceneTransform = 1;
+}
+
+void QGraphicsTransform::update()
+{
+ Q_D(QGraphicsTransform);
+ if (d->item)
+ d->updateItem(d->item);
+}
+
+/*!
+ returns this object as a QTransform.
+*/
+QTransform QGraphicsTransform::transform() const
+{
+ QTransform t;
+ applyTo(&t);
+ return t;
+}
+
+/*!
+ \class QGraphicsTransform
+ \brief The QGraphicsTransform class is an abstract base class for tranformations on QGraphicsItems.
+ \since 4.6
+
+ The classes that inherit QGraphicsTransform express different types of transformations
+ that can be applied to graphics items.
+
+ A list of these transformations can be applied to any graphics item. These
+ transformations are then easily modifyable and usable from e.g. within animations.
+
+ QGraphicsTransform is an abstract base class that is implemented by QGraphicsScale,
+ QGraphicsRotation and QGraphicsRotation3D. Subclasses have to implement the applyTo method.
+
+ \sa QGraphicsItem::transform(), QGraphicsScale, QGraphicsRotation, QGraphicsRotation3D
+*/
+
+/*!
+ Constructs a new QGraphicsTransform with \a parent.
+*/
+QGraphicsTransform::QGraphicsTransform(QObject *parent) :
+ QObject(*new QGraphicsTransformPrivate, parent)
+{
+}
+
+/*!
+ Destructs the graphics transform.
+*/
+QGraphicsTransform::~QGraphicsTransform()
+{
+ Q_D(QGraphicsTransform);
+ d->setItem(0);
+}
+
+/*!
+ \internal
+*/
+QGraphicsTransform::QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent)
+ : QObject(p, parent)
+{
+}
+
+/*! \fn void QGraphicsTransform::applyTo(QTransform *transform) const
+
+ This pure virtual method has to be reimplemented in derived classes.
+
+ It applies this transformation to \a transform.
+*/
+
+
+/*!
+ \class QGraphicsScale
+ \brief The QGraphicsScale class provides a way to scale a graphics item in 2 dimensions.
+ \since 4.6
+
+ QGraphicsScale contains an \a origin around which the scaling happens, and two
+ scale factors, xScale and yScale, the x and one for the y axis.
+*/
+
+class QGraphicsScalePrivate : public QGraphicsTransformPrivate
+{
+public:
+ QGraphicsScalePrivate()
+ : xScale(1), yScale(1) {}
+ QPointF origin;
+ qreal xScale;
+ qreal yScale;
+};
+
+/*!
+ Constructs a new graphics scale object with \a parent.
+*/
+QGraphicsScale::QGraphicsScale(QObject *parent)
+ : QGraphicsTransform(*new QGraphicsScalePrivate, parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QGraphicsScale::~QGraphicsScale()
+{
+}
+
+/*!
+ \property QGraphicsScale::origin
+ The origin of the scale. All scaling will be done relative to this point.
+
+ The \a origin is in other words the fixed point for the transformation.
+*/
+QPointF QGraphicsScale::origin() const
+{
+ Q_D(const QGraphicsScale);
+ return d->origin;
+}
+
+void QGraphicsScale::setOrigin(const QPointF &point)
+{
+ Q_D(QGraphicsScale);
+ d->origin = point;
+ update();
+ emit originChanged();
+}
+
+/*!
+ \fn QGraphicsScale::originChanged()
+
+ This signal is emitted whenever the origin of the object
+ changes.
+*/
+
+/*!
+ \property QGraphicsScale::xScale
+
+ The scale factor in x direction. The x direction is
+ in the graphics items logical coordinates.
+
+ \sa yScale
+*/
+qreal QGraphicsScale::xScale() const
+{
+ Q_D(const QGraphicsScale);
+ return d->xScale;
+}
+
+void QGraphicsScale::setXScale(qreal scale)
+{
+ Q_D(QGraphicsScale);
+ if (d->xScale == scale)
+ return;
+ d->xScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+/*!
+ \property QGraphicsScale::yScale
+
+ The scale factor in y direction. The y direction is
+ in the graphics items logical coordinates.
+
+ \sa xScale
+*/
+qreal QGraphicsScale::yScale() const
+{
+ Q_D(const QGraphicsScale);
+ return d->yScale;
+}
+
+void QGraphicsScale::setYScale(qreal scale)
+{
+ Q_D(QGraphicsScale);
+ if (d->yScale == scale)
+ return;
+ d->yScale = scale;
+ update();
+ emit scaleChanged();
+}
+
+/*!
+ \fn QGraphicsScale::scaleChanged()
+
+ This signal is emitted whenever the xScale or yScale of the object
+ changes.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsScale::applyTo(QTransform *transform) const
+{
+ Q_D(const QGraphicsScale);
+ transform->translate(d->origin.x(), d->origin.y());
+ transform->scale(d->xScale, d->yScale);
+ transform->translate(-d->origin.x(), -d->origin.y());
+}
+
+/*!
+ \class QGraphicsRotation
+ \brief The QGraphicsRotation class provides a way to rotate a graphics item in 2 dimensions.
+ \since 4.6
+
+ QGraphicsRotation contains an \a origin around which the rotation happens, and one
+ angle in degrees describing the amount of the rotation.
+*/
+
+class QGraphicsRotationPrivate : public QGraphicsTransformPrivate
+{
+public:
+ QGraphicsRotationPrivate()
+ : angle(0) {}
+ QPointF origin;
+ qreal originY;
+ qreal angle;
+};
+
+/*!
+ Constructs a new graphics rotation with \a parent.
+*/
+QGraphicsRotation::QGraphicsRotation(QObject *parent)
+ : QGraphicsTransform(*new QGraphicsRotationPrivate, parent)
+{
+}
+
+/*!
+ \internal
+*/
+QGraphicsRotation::QGraphicsRotation(QGraphicsRotationPrivate &p, QObject *parent)
+ : QGraphicsTransform(p, parent)
+{
+}
+
+/*!
+ Destructs the object
+*/
+QGraphicsRotation::~QGraphicsRotation()
+{
+}
+
+/*!
+ \property QGraphicsRotation::origin
+ The origin around which this object will rotate the graphics item.
+
+ The \a origin is in other words the fixed point for the transformation.
+*/
+QPointF QGraphicsRotation::origin() const
+{
+ Q_D(const QGraphicsRotation);
+ return d->origin;
+}
+
+void QGraphicsRotation::setOrigin(const QPointF &point)
+{
+ Q_D(QGraphicsRotation);
+ d->origin = point;
+ update();
+ emit originChanged();
+}
+
+/*!
+ \fn QGraphicsRotation::originChanged()
+
+ This signal is emitted whenever the origin of the object
+ changes.
+*/
+
+/*!
+ \property QGraphicsRotation::angle
+ The angle, in degrees, of the rotation.
+*/
+qreal QGraphicsRotation::angle() const
+{
+ Q_D(const QGraphicsRotation);
+ return d->angle;
+}
+
+void QGraphicsRotation::setAngle(qreal angle)
+{
+ Q_D(QGraphicsRotation);
+ if (d->angle == angle)
+ return;
+ d->angle = angle;
+ update();
+ emit angleChanged();
+}
+
+/*!
+ \fn void QGraphicsRotation::angleChanged()
+
+ This signal is emitted whenever the angle of the object
+ changes.
+*/
+
+/*!
+ \reimp
+*/
+void QGraphicsRotation::applyTo(QTransform *t) const
+{
+ Q_D(const QGraphicsRotation);
+ if(d->angle) {
+ t->translate(d->origin.x(), d->origin.y());
+ t->rotate(d->angle);
+ t->translate(-d->origin.x(), -d->origin.y());
+ }
+}
+
+
+/*!
+ \class QGraphicsRotation3D
+ \brief The QGraphicsRotation3D class provides a way to rotate a graphics item in 3 dimensions.
+ \since 4.6
+
+ In addition to the origin and angle of a simple QGraphicsRotation, QGraphicsRotation3D contains
+ also an axis that describes around which axis in space the rotation is supposed to happen.
+*/
+
+class QGraphicsRotation3DPrivate : public QGraphicsRotationPrivate
+{
+public:
+ QGraphicsRotation3DPrivate() {}
+
+ QVector3D axis;
+};
+
+/*!
+ Constructs a new 3D rotation with \a parent.
+*/
+QGraphicsRotation3D::QGraphicsRotation3D(QObject *parent)
+ : QGraphicsRotation(*new QGraphicsRotation3DPrivate, parent)
+{
+}
+
+/*!
+ Destroys the object
+*/
+QGraphicsRotation3D::~QGraphicsRotation3D()
+{
+}
+
+/*!
+ \property QGraphicsRotation3D::axis
+
+ A rotation axis is specified by a vector in 3D space.
+*/
+QVector3D QGraphicsRotation3D::axis()
+{
+ Q_D(QGraphicsRotation3D);
+ return d->axis;
+}
+
+void QGraphicsRotation3D::setAxis(const QVector3D &axis)
+{
+ Q_D(QGraphicsRotation3D);
+ d->axis = axis;
+ update();
+}
+
+/*!
+ \fn void QGraphicsRotation3D::axisChanged()
+
+ This signal is emitted whenever the axis of the object
+ changes.
+*/
+
+const qreal inv_dist_to_plane = 1. / 1024.;
+
+/*!
+ \reimp
+*/
+void QGraphicsRotation3D::applyTo(QTransform *t) const
+{
+ Q_D(const QGraphicsRotation3D);
+
+ if (d->angle == 0. ||
+ (d->axis.z() == 0. && d->axis.y() == 0 && d->axis.x() == 0))
+ return;
+
+ qreal rad = d->angle * 2. * M_PI / 360.;
+ qreal c = ::cos(rad);
+ qreal s = ::sin(rad);
+
+ qreal x = d->axis.x();
+ qreal y = d->axis.y();
+ qreal z = d->axis.z();
+
+ qreal len = x * x + y * y + z * z;
+ if (len != 1.) {
+ len = 1./::sqrt(len);
+ x *= len;
+ y *= len;
+ z *= len;
+ }
+
+ t->translate(d->origin.x(), d->origin.y());
+ *t = QTransform(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane,
+ y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane,
+ 0, 0, 1) * *t;
+ t->translate(-d->origin.x(), -d->origin.y());
+}
+
+#include "moc_qgraphicstransform.cpp"
+
+QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/gui/graphicsview/qgraphicstransform.h
new file mode 100644
index 0000000..adf9438
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform.h
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSTRANSFORM_H
+#define QGRAPHICSTRANSFORM_H
+
+#include <QtCore/QObject>
+#include <QtGui/QTransform>
+#include <QtGui/QVector3D>
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Gui)
+
+class QGraphicsItem;
+class QGraphicsTransformPrivate;
+
+class Q_GUI_EXPORT QGraphicsTransform : public QObject
+{
+ Q_OBJECT
+public:
+ QGraphicsTransform(QObject *parent = 0);
+ ~QGraphicsTransform();
+
+ QTransform transform() const;
+ virtual void applyTo(QTransform *transform) const = 0;
+
+protected slots:
+ void update();
+
+protected:
+ QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *parent);
+private:
+ friend class QGraphicsItem;
+ friend class QGraphicsItemPrivate;
+ Q_DECLARE_PRIVATE(QGraphicsTransform)
+};
+
+class QGraphicsScalePrivate;
+
+class Q_GUI_EXPORT QGraphicsScale : public QGraphicsTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPointF origin READ origin WRITE setOrigin NOTIFY originChanged)
+ Q_PROPERTY(qreal xScale READ xScale WRITE setXScale NOTIFY scaleChanged)
+ Q_PROPERTY(qreal yScale READ yScale WRITE setYScale NOTIFY scaleChanged)
+public:
+ QGraphicsScale(QObject *parent = 0);
+ ~QGraphicsScale();
+
+ QPointF origin() const;
+ void setOrigin(const QPointF &point);
+
+ qreal xScale() const;
+ void setXScale(qreal);
+
+ qreal yScale() const;
+ void setYScale(qreal);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void originChanged();
+ void scaleChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsScale)
+};
+
+class QGraphicsRotationPrivate;
+
+class Q_GUI_EXPORT QGraphicsRotation : public QGraphicsTransform
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QPointF origin READ origin WRITE setOrigin NOTIFY originChanged)
+ Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
+public:
+ QGraphicsRotation(QObject *parent = 0);
+ ~QGraphicsRotation();
+
+ QPointF origin() const;
+ void setOrigin(const QPointF &point);
+
+ qreal angle() const;
+ void setAngle(qreal);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void originChanged();
+ void angleChanged();
+
+protected:
+ QGraphicsRotation(QGraphicsRotationPrivate &p, QObject *parent);
+private:
+ Q_DECLARE_PRIVATE(QGraphicsRotation)
+};
+
+class QGraphicsRotation3DPrivate;
+
+class Q_GUI_EXPORT QGraphicsRotation3D : public QGraphicsRotation
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QVector3D axis READ axis WRITE setAxis NOTIFY axisChanged)
+public:
+ QGraphicsRotation3D(QObject *parent = 0);
+ ~QGraphicsRotation3D();
+
+ QVector3D axis();
+ void setAxis(const QVector3D &axis);
+
+ void applyTo(QTransform *transform) const;
+
+Q_SIGNALS:
+ void axisChanged();
+
+private:
+ Q_DECLARE_PRIVATE(QGraphicsRotation3D)
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QFXTRANSFORM_H
diff --git a/src/gui/graphicsview/qgraphicstransform_p.h b/src/gui/graphicsview/qgraphicstransform_p.h
new file mode 100644
index 0000000..2d36eda
--- /dev/null
+++ b/src/gui/graphicsview/qgraphicstransform_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QGRAPHICSTRANSFORM_P_H
+#define QGRAPHICSTRANSFORM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
+// file may change from version to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "private/qobject_p.h"
+
+class QGraphicsItem;
+
+class QGraphicsTransformPrivate : public QObjectPrivate {
+public:
+ Q_DECLARE_PUBLIC(QGraphicsTransform)
+
+ QGraphicsTransformPrivate()
+ : QObjectPrivate(), item(0) {}
+
+ QGraphicsItem *item;
+
+ void setItem(QGraphicsItem *item);
+ static void updateItem(QGraphicsItem *item);
+};
+
+#endif // QGRAPHICSTRANSFORM_P_H
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 5e5c826..bf0acc9 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1728,39 +1728,6 @@ QGraphicsWidget *QGraphicsWidget::focusWidget() const
return 0;
}
-/*! \property QGraphicsWidget::horizontalShear
- \brief This property holds the horizontal shear value for the item.
- */
-
-/*! \property QGraphicsWidget::transformOrigin
- \brief This property holds the origin point used for transformations
- in item coordinates.
- */
-
-/*! \property QGraphicsWidget::verticalShear
- \brief This property holds the vertical shear value for the item.
- */
-
-/*! \property QGraphicsWidget::xRotation
- \brief This property holds the value for rotation around the x axis.
- */
-
-/*! \property QGraphicsWidget::xScale
- \brief This property holds the scale factor for the x axis.
- */
-
-/*! \property QGraphicsWidget::yRotation
- \brief This property holds the value for rotation around the y axis.
- */
-
-/*! \property QGraphicsWidget::yScale
- \brief This property holds the scale factor for the y axis.
- */
-
-/*! \property QGraphicsWidget::zRotation
- \brief This property holds the value for rotation around the z axis.
- */
-
#ifndef QT_NO_SHORTCUT
/*!
\since 4.5
@@ -2286,6 +2253,7 @@ bool QGraphicsWidget::close()
#ifdef Q_NO_USING_KEYWORD
/*!
\fn const QObjectList &QGraphicsWidget::children() const
+ \internal
This function returns the same value as QObject::children(). It's
provided to differentiate between the obsolete member
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index 9047310..cb5490a 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -77,14 +77,6 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay
Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
- Q_PROPERTY(QPointF transformOrigin READ transformOrigin WRITE setTransformOrigin)
- Q_PROPERTY(qreal xRotation READ xRotation WRITE setXRotation)
- Q_PROPERTY(qreal yRotation READ yRotation WRITE setYRotation)
- Q_PROPERTY(qreal zRotation READ zRotation WRITE setZRotation)
- Q_PROPERTY(qreal xScale READ xScale WRITE setXScale)
- Q_PROPERTY(qreal yScale READ yScale WRITE setYScale)
- Q_PROPERTY(qreal horizontalShear READ horizontalShear WRITE setHorizontalShear)
- Q_PROPERTY(qreal verticalShear READ verticalShear WRITE setVerticalShear)
public:
QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
~QGraphicsWidget();
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d71aef3..9a1380e 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4639,12 +4639,19 @@ bool QImage::loadFromData(const uchar *data, int len, const char *format)
binary \a data. The loader attempts to read the image using the
specified \a format. If \a format is not specified (which is the default),
the loader probes the file for a header to guess the file format.
+ binary \a data. The loader attempts to read the image, either using the
+ optional image \a format specified or by determining the image format from
+ the data.
- If the loading of the image failed, this object is a null image.
+ If \a format is not specified (which is the default), the loader probes the
+ file for a header to determine the file format. If \a format is specified,
+ it must be one of the values returned by QImageReader::supportedImageFormats().
+
+ If the loading of the image fails, the image returned will be a null image.
+
+ \sa load(), save(), {QImage#Reading and Writing Image Files}{Reading and Writing Image Files}
+ */
- \sa load(), save(), {QImage#Reading and Writing Image
- Files}{Reading and Writing Image Files}
-*/
QImage QImage::fromData(const uchar *data, int size, const char *format)
{
QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(data), size);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 759ee1a..afcb918 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -852,8 +852,8 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) cons
}
/*!
- Returns the item delegate used by this view and model for
- the given \a index.
+ Returns the item delegate used by this view and model for
+ the given \a index.
*/
QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const
{
@@ -862,14 +862,14 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index)
}
/*!
- \property QAbstractItemView::selectionMode
- \brief which selection mode the view operates in
+ \property QAbstractItemView::selectionMode
+ \brief which selection mode the view operates in
- This property controls whether the user can select one or many items
- and, in many-item selections, whether the selection must be a
- continuous range of items.
+ This property controls whether the user can select one or many items
+ and, in many-item selections, whether the selection must be a
+ continuous range of items.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionMode(SelectionMode mode)
{
@@ -884,13 +884,13 @@ QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const
}
/*!
- \property QAbstractItemView::selectionBehavior
- \brief which selection behavior the view uses
+ \property QAbstractItemView::selectionBehavior
+ \brief which selection behavior the view uses
- This property holds whether selections are done
- in terms of single items, rows or columns.
+ This property holds whether selections are done
+ in terms of single items, rows or columns.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
@@ -991,11 +991,11 @@ QModelIndex QAbstractItemView::rootIndex() const
}
/*!
- Selects all item in the view.
- This function wil use the selection selection behavior
- set on the view when selecting.
+ Selects all items in the view.
+ This function will use the selection behavior
+ set on the view when selecting.
- \sa setSelection(), selectedIndexes(), clearSelection()
+ \sa setSelection(), selectedIndexes(), clearSelection()
*/
void QAbstractItemView::selectAll()
{
@@ -1224,10 +1224,10 @@ bool QAbstractItemView::tabKeyNavigation() const
#ifndef QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::showDropIndicator
- \brief whether the drop indicator is shown when dragging items and dropping.
+ \property QAbstractItemView::showDropIndicator
+ \brief whether the drop indicator is shown when dragging items and dropping.
- \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
+ \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDropIndicatorShown(bool enable)
@@ -1243,10 +1243,10 @@ bool QAbstractItemView::showDropIndicator() const
}
/*!
- \property QAbstractItemView::dragEnabled
- \brief whether the view supports dragging of its own items
+ \property QAbstractItemView::dragEnabled
+ \brief whether the view supports dragging of its own items
- \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
+ \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDragEnabled(bool enable)
@@ -1282,11 +1282,11 @@ bool QAbstractItemView::dragEnabled() const
*/
/*!
- \property QAbstractItemView::dragDropMode
- \brief the drag and drop event the view will act upon
+ \property QAbstractItemView::dragDropMode
+ \brief the drag and drop event the view will act upon
- \since 4.2
- \sa showDropIndicator dragDropOverwriteMode
+ \since 4.2
+ \sa showDropIndicator dragDropOverwriteMode
*/
void QAbstractItemView::setDragDropMode(DragDropMode behavior)
{
@@ -1322,14 +1322,14 @@ QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const
#endif // QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::alternatingRowColors
- \brief whether to draw the background using alternating colors
+ \property QAbstractItemView::alternatingRowColors
+ \brief whether to draw the background using alternating colors
- If this property is true, the item background will be drawn using
- QPalette::Base and QPalette::AlternateBase; otherwise the background
- will be drawn using the QPalette::Base color.
+ If this property is true, the item background will be drawn using
+ QPalette::Base and QPalette::AlternateBase; otherwise the background
+ will be drawn using the QPalette::Base color.
- By default, this property is false.
+ By default, this property is false.
*/
void QAbstractItemView::setAlternatingRowColors(bool enable)
{
@@ -2261,8 +2261,8 @@ void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event)
\value BelowItem The item will be dropped below the index.
\value OnViewport The item will be dropped onto a region of the viewport with
-no items. The way each view handles items dropped onto the viewport depends on
-the behavior of the underlying model in use.
+ no items. The way each view handles items dropped onto the viewport depends on
+ the behavior of the underlying model in use.
*/
@@ -2279,11 +2279,11 @@ QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPositio
#endif
/*!
- This convenience function returns a list of all selected and
- non-hidden item indexes in the view. The list contains no
- duplicates, and is not sorted.
+ This convenience function returns a list of all selected and
+ non-hidden item indexes in the view. The list contains no
+ duplicates, and is not sorted.
- \sa QItemSelectionModel::selectedIndexes()
+ \sa QItemSelectionModel::selectedIndexes()
*/
QModelIndexList QAbstractItemView::selectedIndexes() const
{
@@ -2365,8 +2365,8 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
}
/*!
- \internal
- Updates the data shown in the open editor widgets in the view.
+ \internal
+ Updates the data shown in the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorData()
{
@@ -2375,8 +2375,8 @@ void QAbstractItemView::updateEditorData()
}
/*!
- \internal
- Updates the geometry of the open editor widgets in the view.
+ \internal
+ Updates the geometry of the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorGeometries()
{
@@ -2425,7 +2425,7 @@ void QAbstractItemView::updateGeometries()
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::verticalScrollbarValueChanged(int value)
{
@@ -2436,7 +2436,7 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::horizontalScrollbarValueChanged(int value)
{
@@ -2538,9 +2538,9 @@ void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE
}
/*!
- Commit the data in the \a editor to the model.
+ Commit the data in the \a editor to the model.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::commitData(QWidget *editor)
{
@@ -2559,9 +2559,9 @@ void QAbstractItemView::commitData(QWidget *editor)
}
/*!
- This function is called when the given \a editor has been destroyed.
+ This function is called when the given \a editor has been destroyed.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::editorDestroyed(QObject *editor)
{
@@ -2632,12 +2632,12 @@ int QAbstractItemView::verticalStepsPerItem() const
}
/*!
- Moves to and selects the item best matching the string \a search.
- If no item is found nothing happens.
+ Moves to and selects the item best matching the string \a search.
+ If no item is found nothing happens.
- In the default implementation, the search is reset if \a search is empty, or
- the time interval since the last search has exceeded
- QApplication::keyboardInputInterval().
+ In the default implementation, the search is reset if \a search is empty, or
+ the time interval since the last search has exceeded
+ QApplication::keyboardInputInterval().
*/
void QAbstractItemView::keyboardSearch(const QString &search)
{
@@ -2691,9 +2691,9 @@ void QAbstractItemView::keyboardSearch(const QString &search)
setCurrentIndex(firstMatch);
break;
}
- int row = firstMatch.row() + 1;
- if (row >= d->model->rowCount(firstMatch.parent()))
- row = 0;
+ int row = firstMatch.row() + 1;
+ if (row >= d->model->rowCount(firstMatch.parent()))
+ row = 0;
current = firstMatch.sibling(row, firstMatch.column());
}
} while (current != start && firstMatch.isValid());
@@ -2800,9 +2800,9 @@ void QAbstractItemView::openPersistentEditor(const QModelIndex &index)
}
/*!
- Closes the persistent editor for the item at the given \a index.
+ Closes the persistent editor for the item at the given \a index.
- \sa openPersistentEditor()
+ \sa openPersistentEditor()
*/
void QAbstractItemView::closePersistentEditor(const QModelIndex &index)
{
@@ -3337,14 +3337,14 @@ void QAbstractItemView::setDirtyRegion(const QRegion &region)
}
/*!
- Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
- opposite direction. You only need to call this function if you are implementing a scrolling
- viewport in your view subclass.
+ Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
+ opposite direction. You only need to call this function if you are implementing a scrolling
+ viewport in your view subclass.
- If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
- before you call QWidget::scroll() on the viewport. Alternatively, just call update().
+ If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
+ before you call QWidget::scroll() on the viewport. Alternatively, just call update().
- \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
+ \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
*/
void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
{
@@ -3353,13 +3353,13 @@ void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
}
/*!
- Returns the offset of the dirty regions in the view.
+ Returns the offset of the dirty regions in the view.
- If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
- QAbstractItemView, you should translate the area given by the paint event with
- the offset returned from this function.
+ If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
+ QAbstractItemView, you should translate the area given by the paint event with
+ the offset returned from this function.
- \sa scrollDirtyRegion(), setDirtyRegion()
+ \sa scrollDirtyRegion(), setDirtyRegion()
*/
QPoint QAbstractItemView::dirtyRegionOffset() const
{
@@ -3531,7 +3531,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
const bool controlKeyPressed = modifiers & Qt::ControlModifier;
if (((index == pressedIndex && selectionModel->isSelected(index))
- || !index.isValid()) && state != QAbstractItemView::DragSelectingState
+ || !index.isValid()) && state != QAbstractItemView::DragSelectingState
&& !shiftKeyPressed && !controlKeyPressed && !rightButtonPressed)
return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
return QItemSelectionModel::NoUpdate;
@@ -3763,7 +3763,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo
but the behavior is view dependant (table just clears the selected indexes for example).
Either remove the selected rows or clear them
- */
+*/
void QAbstractItemViewPrivate::clearOrRemove()
{
#ifndef QT_NO_DRAGANDDROP
@@ -3799,7 +3799,7 @@ void QAbstractItemViewPrivate::clearOrRemove()
When persistent aeditor gets/loses focus, we need to check
and setcorrectly the current index.
- */
+*/
void QAbstractItemViewPrivate::checkPersistentEditorFocus()
{
Q_Q(QAbstractItemView);
@@ -3886,10 +3886,10 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
}
/*
- \internal
+ \internal
- returns the pair QRect/QModelIndex that should be painted on the viewports's rect
- */
+ returns the pair QRect/QModelIndex that should be painted on the viewports's rect
+*/
QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
{
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 87825d9..9dad95f 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -303,45 +303,44 @@ QModelIndexList QItemSelectionRange::indexes() const
}
/*!
- \class QItemSelection
+ \class QItemSelection
- \brief The QItemSelection class manages information about selected items in a model.
+ \brief The QItemSelection class manages information about selected items in a model.
- \ingroup model-view
-
- A QItemSelection describes the items in a model that have been
- selected by the user. A QItemSelection is basically a list of
- selection ranges, see QItemSelectionRange. It provides functions for
- creating and manipulating selections, and selecting a range of items
- from a model.
+ \ingroup model-view
- The QItemSelection class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ A QItemSelection describes the items in a model that have been
+ selected by the user. A QItemSelection is basically a list of
+ selection ranges, see QItemSelectionRange. It provides functions for
+ creating and manipulating selections, and selecting a range of items
+ from a model.
- An item selection can be constructed and initialized to contain a
- range of items from an existing model. The following example constructs
- a selection that contains a range of items from the given \c model,
- beginning at the \c topLeft, and ending at the \c bottomRight.
+ The QItemSelection class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
+ An item selection can be constructed and initialized to contain a
+ range of items from an existing model. The following example constructs
+ a selection that contains a range of items from the given \c model,
+ beginning at the \c topLeft, and ending at the \c bottomRight.
- An empty item selection can be constructed, and later populated as
- required. So, if the model is going to be unavailable when we construct
- the item selection, we can rewrite the above code in the following way:
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
+ An empty item selection can be constructed, and later populated as
+ required. So, if the model is going to be unavailable when we construct
+ the item selection, we can rewrite the above code in the following way:
- QItemSelection saves memory, and avoids unnecessary work, by working with
- selection ranges rather than recording the model item index for each
- item in the selection. Generally, an instance of this class will contain
- a list of non-overlapping selection ranges.
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
- Use merge() to merge one item selection into another without making
- overlapping ranges. Use split() to split one selection range into
- smaller ranges based on a another selection range.
+ QItemSelection saves memory, and avoids unnecessary work, by working with
+ selection ranges rather than recording the model item index for each
+ item in the selection. Generally, an instance of this class will contain
+ a list of non-overlapping selection ranges.
- \sa {Model/View Programming}, QItemSelectionModel
+ Use merge() to merge one item selection into another without making
+ overlapping ranges. Use split() to split one selection range into
+ smaller ranges based on a another selection range.
+ \sa {Model/View Programming}, QItemSelectionModel
*/
/*!
@@ -420,14 +419,14 @@ QModelIndexList QItemSelection::indexes() const
}
/*!
- Merges the \a other selection with this QItemSelection using the
- \a command given. This method guarantees that no ranges are overlapping.
+ Merges the \a other selection with this QItemSelection using the
+ \a command given. This method guarantees that no ranges are overlapping.
- Note that only QItemSelectionModel::Select,
- QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
- supported.
+ Note that only QItemSelectionModel::Select,
+ QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
+ supported.
- \sa split()
+ \sa split()
*/
void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
{
@@ -479,10 +478,10 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel
}
/*!
- Splits the selection \a range using the selection \a other range.
- Removes all items in \a other from \a range and puts the result in \a result.
- This can be compared with the semantics of the \e subtract operation of a set.
- \sa merge()
+ Splits the selection \a range using the selection \a other range.
+ Removes all items in \a other from \a range and puts the result in \a result.
+ This can be compared with the semantics of the \e subtract operation of a set.
+ \sa merge()
*/
void QItemSelection::split(const QItemSelectionRange &range,
@@ -529,11 +528,11 @@ void QItemSelection::split(const QItemSelectionRange &range,
}
/*!
- \internal
+ \internal
- returns a QItemSelection where all ranges have been expanded to:
- Rows: left: 0 and right: columnCount()-1
- Columns: top: 0 and bottom: rowCount()-1
+ returns a QItemSelection where all ranges have been expanded to:
+ Rows: left: 0 and right: columnCount()-1
+ Columns: top: 0 and bottom: rowCount()-1
*/
QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection &selection,
@@ -568,7 +567,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -599,7 +598,7 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -630,9 +629,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &p
}
/*!
- \internal
+ \internal
- Split selection ranges if columns are about to be inserted in the middle.
+ Split selection ranges if columns are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -659,9 +658,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &
}
/*!
- \internal
+ \internal
- Split selection ranges if rows are about to be inserted in the middle.
+ Split selection ranges if rows are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -688,11 +687,11 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &par
}
/*!
- \internal
+ \internal
- Split selection into individual (persistent) indexes. This is done in
- preparation for the layoutChanged() signal, where the indexes can be
- merged again.
+ Split selection into individual (persistent) indexes. This is done in
+ preparation for the layoutChanged() signal, where the indexes can be
+ merged again.
*/
void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
{
@@ -726,10 +725,10 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
}
/*!
- \internal
+ \internal
- Merges \a indexes into an item selection made up of ranges.
- Assumes that the indexes are sorted.
+ Merges \a indexes into an item selection made up of ranges.
+ Assumes that the indexes are sorted.
*/
static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
{
@@ -774,9 +773,9 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
}
/*!
- \internal
+ \internal
- Merge the selected indexes into selection ranges again.
+ Merge the selected indexes into selection ranges again.
*/
void QItemSelectionModelPrivate::_q_layoutChanged()
{
@@ -818,41 +817,41 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
}
/*!
- \class QItemSelectionModel
+ \class QItemSelectionModel
- \brief The QItemSelectionModel class keeps track of a view's selected items.
+ \brief The QItemSelectionModel class keeps track of a view's selected items.
- \ingroup model-view
+ \ingroup model-view
- A QItemSelectionModel keeps track of the selected items in a view, or
- in several views onto the same model. It also keeps track of the
- currently selected item in a view.
+ A QItemSelectionModel keeps track of the selected items in a view, or
+ in several views onto the same model. It also keeps track of the
+ currently selected item in a view.
- The QItemSelectionModel class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ The QItemSelectionModel class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- The selected items are stored using ranges. Whenever you want to
- modify the selected items use select() and provide either a
- QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
+ The selected items are stored using ranges. Whenever you want to
+ modify the selected items use select() and provide either a
+ QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
- The QItemSelectionModel takes a two layer approach to selection
- management, dealing with both selected items that have been committed
- and items that are part of the current selection. The current
- selected items are part of the current interactive selection (for
- example with rubber-band selection or keyboard-shift selections).
+ The QItemSelectionModel takes a two layer approach to selection
+ management, dealing with both selected items that have been committed
+ and items that are part of the current selection. The current
+ selected items are part of the current interactive selection (for
+ example with rubber-band selection or keyboard-shift selections).
- To update the currently selected items, use the bitwise OR of
- QItemSelectionModel::Current and any of the other SelectionFlags.
- If you omit the QItemSelectionModel::Current command, a new current
- selection will be created, and the previous one added to the whole
- selection. All functions operate on both layers; for example,
- selectedItems() will return items from both layers.
+ To update the currently selected items, use the bitwise OR of
+ QItemSelectionModel::Current and any of the other SelectionFlags.
+ If you omit the QItemSelectionModel::Current command, a new current
+ selection will be created, and the previous one added to the whole
+ selection. All functions operate on both layers; for example,
+ selectedItems() will return items from both layers.
- \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
+ \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
*/
/*!
- Constructs a selection model that operates on the specified item \a model.
+ Constructs a selection model that operates on the specified item \a model.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
: QObject(*new QItemSelectionModelPrivate, model)
@@ -875,7 +874,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
}
/*!
- Constructs a selection model that operates on the specified item \a model with \a parent.
+ Constructs a selection model that operates on the specified item \a model with \a parent.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)
: QObject(*new QItemSelectionModelPrivate, parent)
@@ -898,7 +897,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *par
}
/*!
- \internal
+ \internal
*/
QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model)
: QObject(dd, model)
@@ -921,7 +920,7 @@ QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstra
}
/*!
- Destroys the selection model.
+ Destroys the selection model.
*/
QItemSelectionModel::~QItemSelectionModel()
{
@@ -943,10 +942,10 @@ QItemSelectionModel::~QItemSelectionModel()
}
/*!
- Selects the model item \a index using the specified \a command, and emits
- selectionChanged().
+ Selects the model item \a index using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlags
+ \sa QItemSelectionModel::SelectionFlags
*/
void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -955,37 +954,37 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
}
/*!
- \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted whenever the current item changes. The \a previous
- model item index is replaced by the \a current index as the selection's
- current item.
+ This signal is emitted whenever the current item changes. The \a previous
+ model item index is replaced by the \a current index as the selection's
+ current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentIndex() setCurrentIndex() selectionChanged()
+ \sa currentIndex() setCurrentIndex() selectionChanged()
*/
/*!
- \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its column is
- different to the column of the \a previous current item.
+ This signal is emitted if the \a current item changes and its column is
+ different to the column of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
*/
/*!
- \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its row is
- different to the row of the \a previous current item.
+ This signal is emitted if the \a current item changes and its row is
+ different to the row of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
*/
/*!
@@ -1002,32 +1001,32 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
*/
/*!
- \enum QItemSelectionModel::SelectionFlag
+ \enum QItemSelectionModel::SelectionFlag
- This enum describes the way the selection model will be updated.
+ This enum describes the way the selection model will be updated.
- \value NoUpdate No selection will be made.
- \value Clear The complete selection will be cleared.
- \value Select All specified indexes will be selected.
- \value Deselect All specified indexes will be deselected.
- \value Toggle All specified indexes will be selected or
- deselected depending on their current state.
- \value Current The current selection will be updated.
- \value Rows All indexes will be expanded to span rows.
- \value Columns All indexes will be expanded to span columns.
- \value SelectCurrent A combination of Select and Current, provided for
- convenience.
- \value ToggleCurrent A combination of Toggle and Current, provided for
- convenience.
- \value ClearAndSelect A combination of Clear and Select, provided for
- convenience.
+ \value NoUpdate No selection will be made.
+ \value Clear The complete selection will be cleared.
+ \value Select All specified indexes will be selected.
+ \value Deselect All specified indexes will be deselected.
+ \value Toggle All specified indexes will be selected or
+ deselected depending on their current state.
+ \value Current The current selection will be updated.
+ \value Rows All indexes will be expanded to span rows.
+ \value Columns All indexes will be expanded to span columns.
+ \value SelectCurrent A combination of Select and Current, provided for
+ convenience.
+ \value ToggleCurrent A combination of Toggle and Current, provided for
+ convenience.
+ \value ClearAndSelect A combination of Clear and Select, provided for
+ convenience.
*/
/*!
- Selects the item \a selection using the specified \a command, and emits
- selectionChanged().
+ Selects the item \a selection using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlag
+ \sa QItemSelectionModel::SelectionFlag
*/
void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
{
@@ -1067,7 +1066,7 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection
}
/*!
- Clears the selection model. Emits selectionChanged() and currentChanged().
+ Clears the selection model. Emits selectionChanged() and currentChanged().
*/
void QItemSelectionModel::clear()
{
@@ -1083,7 +1082,7 @@ void QItemSelectionModel::clear()
}
/*!
- Clears the selection model. Does not emit any signals.
+ Clears the selection model. Does not emit any signals.
*/
void QItemSelectionModel::reset()
{
@@ -1093,8 +1092,8 @@ void QItemSelectionModel::reset()
}
/*!
- \since 4.2
- Clears the selection in the selection model. Emits selectionChanged().
+ \since 4.2
+ Clears the selection in the selection model. Emits selectionChanged().
*/
void QItemSelectionModel::clearSelection()
{
@@ -1110,14 +1109,14 @@ void QItemSelectionModel::clearSelection()
/*!
- Sets the model item \a index to be the current item, and emits
- currentChanged(). The current item is used for keyboard navigation and
- focus indication; it is independent of any selected items, although a
- selected item can also be the current item.
+ Sets the model item \a index to be the current item, and emits
+ currentChanged(). The current item is used for keyboard navigation and
+ focus indication; it is independent of any selected items, although a
+ selected item can also be the current item.
- Depending on the specified \a command, the \a index can also become part
- of the current selection.
- \sa select()
+ Depending on the specified \a command, the \a index can also become part
+ of the current selection.
+ \sa select()
*/
void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -1141,8 +1140,8 @@ void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelecti
}
/*!
- Returns the model item index for the current item, or an invalid index
- if there is no current item.
+ Returns the model item index for the current item, or an invalid index
+ if there is no current item.
*/
QModelIndex QItemSelectionModel::currentIndex() const
{
@@ -1150,7 +1149,7 @@ QModelIndex QItemSelectionModel::currentIndex() const
}
/*!
- Returns true if the given model item \a index is selected.
+ Returns true if the given model item \a index is selected.
*/
bool QItemSelectionModel::isSelected(const QModelIndex &index) const
{
@@ -1187,12 +1186,12 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const
}
/*!
- Returns true if all items are selected in the \a row with the given
- \a parent.
+ Returns true if all items are selected in the \a row with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same row and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same row and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) const
{
@@ -1247,12 +1246,12 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
}
/*!
- Returns true if all items are selected in the \a column with the given
- \a parent.
+ Returns true if all items are selected in the \a column with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same column and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same column and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const
{
@@ -1307,8 +1306,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
}
/*!
- Returns true if there are any items selected in the \a row with the given
- \a parent.
+ Returns true if there are any items selected in the \a row with the given
+ \a parent.
*/
bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &parent) const
{
@@ -1336,8 +1335,8 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
}
/*!
- Returns true if there are any items selected in the \a column with the given
- \a parent.
+ Returns true if there are any items selected in the \a column with the given
+ \a parent.
*/
bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelIndex &parent) const
{
@@ -1377,15 +1376,14 @@ bool QItemSelectionModel::hasSelection() const
QItemSelection sel = d->ranges;
sel.merge(d->currentSelection, d->currentCommand);
return !sel.isEmpty();
- }
- else {
+ } else {
return !(d->ranges.isEmpty() && d->currentSelection.isEmpty());
}
}
/*!
- Returns a list of all selected model item indexes. The list contains no
- duplicates, and is not sorted.
+ Returns a list of all selected model item indexes. The list contains no
+ duplicates, and is not sorted.
*/
QModelIndexList QItemSelectionModel::selectedIndexes() const
{
@@ -1396,10 +1394,10 @@ QModelIndexList QItemSelectionModel::selectedIndexes() const
}
/*!
- \since 4.2
- Returns the indexes in the given \a column for the rows where all columns are selected.
+ \since 4.2
+ Returns the indexes in the given \a column for the rows where all columns are selected.
- \sa selectedIndexes(), selectedColumns()
+ \sa selectedIndexes(), selectedColumns()
*/
QModelIndexList QItemSelectionModel::selectedRows(int column) const
@@ -1460,7 +1458,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const
}
/*!
- Returns the selection ranges stored in the selection model.
+ Returns the selection ranges stored in the selection model.
*/
const QItemSelection QItemSelectionModel::selection() const
{
@@ -1480,7 +1478,7 @@ const QItemSelection QItemSelectionModel::selection() const
}
/*!
- Returns the item model operated on by the selection model.
+ Returns the item model operated on by the selection model.
*/
const QAbstractItemModel *QItemSelectionModel::model() const
{
@@ -1488,8 +1486,8 @@ const QAbstractItemModel *QItemSelectionModel::model() const
}
/*!
- Compares the two selections \a newSelection and \a oldSelection
- and emits selectionChanged() with the deselected and selected items.
+ Compares the two selections \a newSelection and \a oldSelection
+ and emits selectionChanged() with the deselected and selected items.
*/
void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection,
const QItemSelection &oldSelection)
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 45939c1..a322fe4 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE
allowing perspective transformations. QTransform's toAffine()
method allows casting QTransform to QMatrix. If a perspective
transformation has been specified on the matrix, then the
- conversion to an affine QMatrix will cause loss of data.
+ conversion will cause loss of data.
QTransform is the recommended transformation class in Qt.
@@ -125,11 +125,13 @@ QT_BEGIN_NAMESPACE
which returns true if the matrix is non-singular (i.e. AB = BA =
I). The inverted() function returns an inverted copy of \e this
matrix if it is invertible (otherwise it returns the identity
- matrix). In addition, QTransform provides the det() function
- returning the matrix's determinant.
+ matrix), and adjoint() returns the matrix's classical adjoint.
+ In addition, QTransform provides the determinant() function which
+ returns the matrix's determinant.
- Finally, the QTransform class supports matrix multiplication, and
- objects of the class can be streamed as well as compared.
+ Finally, the QTransform class supports matrix multiplication, addition
+ and subtraction, and objects of the class can be streamed as well
+ as compared.
\tableofcontents
@@ -191,7 +193,7 @@ QT_BEGIN_NAMESPACE
The various matrix elements can be set when constructing the
matrix, or by using the setMatrix() function later on. They can also
be manipulated using the translate(), rotate(), scale() and
- shear() convenience functions, The currently set values can be
+ shear() convenience functions. The currently set values can be
retrieved using the m11(), m12(), m13(), m21(), m22(), m23(),
m31(), m32(), m33(), dx() and dy() functions.
@@ -204,9 +206,9 @@ QT_BEGIN_NAMESPACE
to 0) mapping a point to itself. Shearing is controlled by \c m12
and \c m21. Setting these elements to values different from zero
will twist the coordinate system. Rotation is achieved by
- carefully setting both the shearing factors and the scaling
- factors. Perspective transformation is achieved by carefully setting
- both the projection factors and the scaling factors.
+ setting both the shearing factors and the scaling factors. Perspective
+ transformation is achieved by setting both the projection factors and
+ the scaling factors.
Here's the combined transformations example using basic matrix
operations:
@@ -958,8 +960,8 @@ QTransform & QTransform::operator=(const QTransform &matrix)
/*!
Resets the matrix to an identity matrix, i.e. all elements are set
- to zero, except \c m11 and \c m22 (specifying the scale) which are
- set to 1.
+ to zero, except \c m11 and \c m22 (specifying the scale) and \c m33
+ which are set to 1.
\sa QTransform(), isIdentity(), {QTransform#Basic Matrix
Operations}{Basic Matrix Operations}
@@ -1773,7 +1775,7 @@ bool QTransform::quadToQuad(const QPolygonF &one,
Sets the matrix elements to the specified values, \a m11,
\a m12, \a m13 \a m21, \a m22, \a m23 \a m31, \a m32 and
\a m33. Note that this function replaces the previous values.
- QMatrix provides the translate(), rotate(), scale() and shear()
+ QTransform provides the translate(), rotate(), scale() and shear()
convenience functions to manipulate the various matrix elements
based on the currently defined coordinate system.
@@ -1951,8 +1953,11 @@ void QTransform::map(int x, int y, int *tx, int *ty) const
}
/*!
- Returns the QTransform cast to a QMatrix.
- */
+ Returns the QTransform as an affine matrix.
+
+ \warning If a perspective transformation has been specified,
+ then the conversion will cause loss of data.
+*/
const QMatrix &QTransform::toAffine() const
{
return affine;
@@ -2030,8 +2035,9 @@ QTransform::operator QVariant() const
/*!
\fn qreal QTransform::det() const
+ \obsolete
- Returns the matrix's determinant.
+ Returns the matrix's determinant. Use determinant() instead.
*/
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index c869976..598fe6b 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -564,7 +564,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
/*!
\enum QStyle::PrimitiveElement
- This enum describes that various primitive elements. A
+ This enum describes the various primitive elements. A
primitive element is a common GUI element, such as a checkbox
indicator or button bevel.
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index 7547dda..0ff7995 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -5007,11 +5007,6 @@ QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
of the painter used to draw the item. By default, if no
transformations are applied, its value is 1. If zoomed out 1:2, the level
of detail will be 0.5, and if zoomed in 2:1, its value is 2.
-
- For more advanced level-of-detail metrics, use
- QStyleOptionGraphicsItem::matrix directly.
-
- \sa QStyleOptionGraphicsItem::matrix
*/
qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
{
@@ -5038,20 +5033,32 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
Make use of this rectangle to speed up item drawing when only parts of the
item are exposed. If the whole item is exposed, this rectangle will be the
same as QGraphicsItem::boundingRect().
+
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
*/
/*!
\variable QStyleOptionGraphicsItem::matrix
\brief the complete transformation matrix for the item
+ \obsolete
- This matrix is the sum of the item's scene matrix and the matrix of the
- painter used for drawing the item. It is provided for convenience,
+ The QMatrix provided through this member does include information about
+ any perspective transformations applied to the view or item. To get the
+ correct transformation matrix, use QPainter::transform() on the painter
+ passed into the QGraphicsItem::paint() implementation.
+
+ This matrix is the combination of the item's scene matrix and the matrix
+ of the painter used for drawing the item. It is provided for convenience,
allowing anvanced level-of-detail metrics that can be used to speed up
item drawing.
- To find the dimentions of an item in screen coordinates (i.e., pixels),
+ To find the dimensions of an item in screen coordinates (i.e., pixels),
you can use the mapping functions of QMatrix, such as QMatrix::map().
+ This member is only initialized for items that have the
+ QGraphicsItem::ItemUsesExtendedStyleOption flag set.
+
\sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
*/
@@ -5059,7 +5066,7 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
\variable QStyleOptionGraphicsItem::levelOfDetail
\obsolete
- Use QStyleOptionGraphicsItem::levelOfDetailFromTransform
+ Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
together with QPainter::worldTransform() instead.
*/
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 4e43418..a3dd83e 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -89,7 +89,7 @@ QT_BEGIN_NAMESPACE
/*!
\fn Type QTextLength::type() const
- Returns the type of length.
+ Returns the type of this length object.
\sa QTextLength::Type
*/
@@ -129,9 +129,15 @@ QT_BEGIN_NAMESPACE
/*!
\enum QTextLength::Type
- \value VariableLength
- \value FixedLength
- \value PercentageLength
+ This enum describes the different types a length object can
+ have.
+
+ \value VariableLength The width of the object is variable
+ \value FixedLength The width of the object is fixed
+ \value PercentageLength The width of the object is in
+ percentage of the maximum width
+
+ \sa type()
*/
/*!
@@ -417,7 +423,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
more useful, and describe the formatting that is applied to
specific parts of the document.
- A format has a \c FormatType which specifies the kinds of thing it
+ A format has a \c FormatType which specifies the kinds of text item it
can format; e.g. a block of text, a list, a table, etc. A format
also has various properties (some specific to particular format
types), as described by the Property enum. Every property has a
@@ -447,24 +453,32 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
/*!
\enum QTextFormat::FormatType
- \value InvalidFormat
- \value BlockFormat
- \value CharFormat
- \value ListFormat
- \value TableFormat
- \value FrameFormat
+ This enum describes the text item a QTextFormat object is formatting.
+
+ \value InvalidFormat An invalid format as created by the default
+ constructor
+ \value BlockFormat The object formats a text block
+ \value CharFormat The object formats a single character
+ \value ListFormat The object formats a list
+ \value TableFormat The object formats a table
+ \value FrameFormat The object formats a frame
\value UserFormat
+
+ \sa QTextCharFormat, QTextBlockFormat, QTextListFormat,
+ QTextTableFormat, type()
*/
/*!
\enum QTextFormat::Property
- \value ObjectIndex
+ This enum describes the different properties a format can have.
+
+ \value ObjectIndex The index of the formatted object. See objectIndex().
Paragraph and character properties
- \value CssFloat
+ \value CssFloat How a frame is located relative to the surrounding text
\value LayoutDirection The layout direction of the text in the document
(Qt::LayoutDirection).
@@ -482,25 +496,25 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value BlockRightMargin
\value TextIndent
\value TabPositions Specifies the tab positions. The tab positions are structs of QTextOption::Tab which are stored in
- a QList (internally, in a QList<QVariant>).
+ a QList (internally, in a QList<QVariant>).
\value BlockIndent
\value BlockNonBreakableLines
- \value BlockTrailingHorizontalRulerWidth
+ \value BlockTrailingHorizontalRulerWidth The width of a horizontal ruler element.
Character properties
\value FontFamily
\value FontPointSize
+ \value FontPixelSize
\value FontSizeAdjustment Specifies the change in size given to the fontsize already set using
FontPointSize or FontPixelSize.
+ \value FontFixedPitch
\omitvalue FontSizeIncrement
\value FontWeight
\value FontItalic
\value FontUnderline \e{This property has been deprecated.} Use QTextFormat::TextUnderlineStyle instead.
\value FontOverline
\value FontStrikeOut
- \value FontFixedPitch
- \value FontPixelSize
\value FontCapitalization Specifies the capitalization type that is to be applied to the text.
\value FontLetterSpacing Changes the default spacing between individual letters in the font. The value is
specified in percentage, with 100 as the default value.
@@ -512,7 +526,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\omitvalue FirstFontProperty
\omitvalue LastFontProperty
-
+
\value TextUnderlineColor
\value TextVerticalAlignment
\value TextOutline
@@ -533,7 +547,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
\value FrameBorder
\value FrameBorderBrush
- \value FrameBorderStyle
+ \value FrameBorderStyle See the \l{QTextFrameFormat::BorderStyle}{BorderStyle} enum.
\value FrameBottomMargin
\value FrameHeight
\value FrameLeftMargin
@@ -565,33 +579,46 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
Selection properties
- \value FullWidthSelection When set on the characterFormat of a selection, the whole width of the text will be shown selected
+ \value FullWidthSelection When set on the characterFormat of a selection,
+ the whole width of the text will be shown selected.
Page break properties
- \value PageBreakPolicy
+ \value PageBreakPolicy Specifies how pages are broken. See the PageBreakFlag enum.
\value UserProperty
+
+ \sa property(), setProperty()
*/
/*!
\enum QTextFormat::ObjectTypes
+ This enum describes what kind of QTextObject this format is associated with.
+
\value NoObject
\value ImageObject
\value TableObject
\value TableCellObject
\value UserObject The first object that can be used for application-specific purposes.
+
+ \sa QTextObject, QTextTable, QTextObject::format()
*/
/*!
\enum QTextFormat::PageBreakFlag
\since 4.2
+ This enum describes how page breaking is performed when printing. It maps to the
+ corresponding css properties.
+
\value PageBreak_Auto The page break is determined automatically depending on the
available space on the current page
\value PageBreak_AlwaysBefore The page is always broken before the paragraph/table
\value PageBreak_AlwaysAfter A new page is always started after the paragraph/table
+
+ \sa QTextBlockFormat::pageBreakPolicy(), QTextFrameFormat::pageBreakPolicy(),
+ PageBreakPolicy
*/
/*!
@@ -971,6 +998,8 @@ QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const
/*!
Returns the property specified by the given \a propertyId.
+
+ \sa Property
*/
QVariant QTextFormat::property(int propertyId) const
{
@@ -979,6 +1008,8 @@ QVariant QTextFormat::property(int propertyId) const
/*!
Sets the property specified by the \a propertyId to the given \a value.
+
+ \sa Property
*/
void QTextFormat::setProperty(int propertyId, const QVariant &value)
{
@@ -1006,8 +1037,10 @@ void QTextFormat::setProperty(int propertyId, const QVector<QTextLength> &value)
}
/*!
- Clears the value of the property given by \a propertyId
- */
+ Clears the value of the property given by \a propertyId
+
+ \sa Property
+*/
void QTextFormat::clearProperty(int propertyId)
{
if (!d)
@@ -1019,14 +1052,18 @@ void QTextFormat::clearProperty(int propertyId)
/*!
\fn void QTextFormat::setObjectType(int type)
- Sets the text format's object \a type. See \c{ObjectTypes}.
+ Sets the text format's object type to \a type.
+
+ \sa ObjectTypes, objectType()
*/
/*!
\fn int QTextFormat::objectType() const
- Returns the text format's object type. See \c{ObjectTypes}.
+ Returns the text format's object type.
+
+ \sa ObjectTypes, setObjectType()
*/
@@ -2116,17 +2153,17 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
/*!
\fn void QTextListFormat::setStyle(Style style)
- Sets the list format's \a style. See \c{Style} for the available styles.
+ Sets the list format's \a style.
- \sa style()
+ \sa style() Style
*/
/*!
\fn Style QTextListFormat::style() const
- Returns the list format's style. See \c{Style}.
+ Returns the list format's style.
- \sa setStyle()
+ \sa setStyle() Style
*/
@@ -2188,16 +2225,21 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
/*!
\enum QTextFrameFormat::Position
+ This enum describes how a frame is located relative to the surrounding text.
+
\value InFlow
\value FloatLeft
\value FloatRight
+ \sa position() CssFloat
*/
/*!
\enum QTextFrameFormat::BorderStyle
\since 4.3
+ This enum describes different border styles for the text frame.
+
\value BorderStyle_None
\value BorderStyle_Dotted
\value BorderStyle_Dashed
@@ -2210,6 +2252,7 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt)
\value BorderStyle_Inset
\value BorderStyle_Outset
+ \sa borderStyle() FrameBorderStyle
*/
/*!
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index 3f7675b..6be30cd 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -446,13 +446,12 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
continue; //we don't really position these!
} else {
const QString s = action->text();
- if(!s.isEmpty()) {
- sz = fm.size(Qt::TextShowMnemonic, s);
- }
-
QIcon is = action->icon();
+ // If an icon is set, only the icon is visible
if (!is.isNull())
sz = sz.expandedTo(QSize(icone, icone));
+ else if (!s.isEmpty())
+ sz = fm.size(Qt::TextShowMnemonic, s);
}
//let the style modify the above size..
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index f8607cc..0577f9a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -745,8 +745,11 @@ QGLFramebufferObject::~QGLFramebufferObject()
The framebuffer can become invalid if the initialization process
fails, the user attaches an invalid buffer to the framebuffer
- object, or a non-power of 2 width/height is specified as the
+ object, or a non-power of two width/height is specified as the
texture size if the texture target is \c{GL_TEXTURE_2D}.
+ The non-power of two limitation does not apply if the OpenGL version
+ is 2.0 or higher, or if the GL_ARB_texture_non_power_of_two extension
+ is present.
*/
bool QGLFramebufferObject::isValid() const
{
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 4b76ef6..030e51f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -745,6 +745,7 @@ QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ
return new QDirectFBPixmapData(type);
}
+#if (Q_DIRECTFB_VERSION >= 0x000923)
#ifdef QT_NO_DEBUG
struct FlagDescription;
static const FlagDescription *accelerationDescriptions = 0;
@@ -802,9 +803,6 @@ static const FlagDescription drawDescriptions[] = {
};
#endif
-
-
-#if (Q_DIRECTFB_VERSION >= 0x000923)
static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags)
{
#ifdef QT_NO_DEBUG
diff --git a/src/qt3support/sql/q3sqlcursor.cpp b/src/qt3support/sql/q3sqlcursor.cpp
index 6b0c69f..aa6aae2 100644
--- a/src/qt3support/sql/q3sqlcursor.cpp
+++ b/src/qt3support/sql/q3sqlcursor.cpp
@@ -879,7 +879,7 @@ QString Q3SqlCursor::toString(const QString& prefix, QSqlField* field, const QSt
{
QString f;
if (field && driver()) {
- f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + field->name();
+ f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + driver()->escapeIdentifier(field->name(), QSqlDriver::FieldName);
f += QLatin1Char(' ') + fieldSep + QLatin1Char(' ');
if (field->isNull()) {
f += QLatin1String("NULL");
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 474c53d..a32b3aa 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -868,11 +868,13 @@ bool QDB2Result::fetch(int i)
SQL_FETCH_ABSOLUTE,
actualIdx);
}
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
setLastError(qMakeError(QCoreApplication::translate("QDB2Result",
"Unable to fetch record %1").arg(i), QSqlError::StatementError, d));
return false;
}
+ else if (r == SQL_NO_DATA)
+ return false;
setAt(i);
return true;
}
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 6d57d2f..7a6e268 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -53,6 +53,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qobject.h>
+#include <QtCore/qvariant.h>
#include <QtCore/qurl.h>
#include <QtCore/qpoint.h>
@@ -146,6 +147,30 @@ template<> inline char *toString(const QUrl &uri)
return qstrdup(uri.toEncoded().constData());
}
+template<> inline char *toString(const QVariant &v)
+{
+ QByteArray vstring("QVariant(");
+ if (v.isValid()) {
+ QByteArray type(v.typeName());
+ if (type.isEmpty()) {
+ type = QByteArray::number(v.userType());
+ }
+ vstring.append(type);
+ if (!v.isNull()) {
+ vstring.append(',');
+ if (v.canConvert(QVariant::String)) {
+ vstring.append(qVariantValue<QString>(v).toLatin1());
+ }
+ else {
+ vstring.append("<value not representable as string>");
+ }
+ }
+ }
+ vstring.append(')');
+
+ return qstrdup(vstring.constData());
+}
+
#ifndef QTEST_NO_SPECIALIZATIONS
template<>
#endif
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp
index dac2c8a..9177490 100644
--- a/src/xml/sax/qxml.cpp
+++ b/src/xml/sax/qxml.cpp
@@ -244,6 +244,16 @@ public:
class QXmlParseExceptionPrivate
{
public:
+ QXmlParseExceptionPrivate()
+ : column(-1), line(-1)
+ {
+ }
+ QXmlParseExceptionPrivate(const QXmlParseExceptionPrivate &other)
+ : msg(other.msg), column(other.column), line(other.line),
+ pub(other.pub), sys(other.sys)
+ {
+ }
+
QString msg;
int column;
int line;
@@ -556,6 +566,14 @@ QXmlParseException::QXmlParseException(const QString& name, int c, int l,
}
/*!
+ Creates a copy of \a other.
+*/
+QXmlParseException::QXmlParseException(const QXmlParseException& other)
+{
+ d = new QXmlParseExceptionPrivate(*other.d);
+}
+
+/*!
Destroys the QXmlParseException.
*/
QXmlParseException::~QXmlParseException()
diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h
index 5b1592c..18dc332 100644
--- a/src/xml/sax/qxml.h
+++ b/src/xml/sax/qxml.h
@@ -194,6 +194,7 @@ class Q_XML_EXPORT QXmlParseException
public:
explicit QXmlParseException(const QString &name = QString(), int c = -1, int l = -1,
const QString &p = QString(), const QString &s = QString());
+ QXmlParseException(const QXmlParseException &other);
~QXmlParseException();
int columnNumber() const;