diff options
author | David Boddie <dboddie@trolltech.com> | 2010-08-24 16:08:28 +0200 |
---|---|---|
committer | David Boddie <dboddie@trolltech.com> | 2010-08-24 16:08:28 +0200 |
commit | c408dd8a80d509f18ec3c3bc8a74891f541f6fdd (patch) | |
tree | a29369b3d1e03f8f688b128e231c004081028bb6 /src | |
parent | ef9cc109f1a6fe84ca27a6c8a53f1783b8bdf14d (diff) | |
parent | a8030e0c543e538652605557843b845f89b11589 (diff) | |
download | qt4-tools-c408dd8a80d509f18ec3c3bc8a74891f541f6fdd.tar.gz |
Merge branch '4.7' into qmldocs
Diffstat (limited to 'src')
61 files changed, 975 insertions, 435 deletions
diff --git a/src/corelib/codecs/qtextcodec_symbian.cpp b/src/corelib/codecs/qtextcodec_symbian.cpp index e4db9d73f6..20e0cfc4bd 100644 --- a/src/corelib/codecs/qtextcodec_symbian.cpp +++ b/src/corelib/codecs/qtextcodec_symbian.cpp @@ -53,8 +53,10 @@ struct QSymbianCodecInitData { const char *aliases; }; -/* This table contains the known Symbian codecs aliases. It is ordered by charsetId. - It is required as symbian does not provide have aliases. +/* This table contains the known Symbian codecs aliases. + It is required because symbian does not provide aliases for codecs. + It is also faster to have a name here than asking the system. + It is ordered by charsetId to allow binary search lookup */ static const QSymbianCodecInitData codecsData[] = { { /*268439485*/ KCharacterSetIdentifierShiftJis, 17, "Shift_JIS\0MS_Kanji\0csShiftJIS\0MS_KANJI\0SJIS\0" }, diff --git a/src/corelib/concurrent/qtconcurrentrun.cpp b/src/corelib/concurrent/qtconcurrentrun.cpp index 5a9c755a32..e80a204b47 100644 --- a/src/corelib/concurrent/qtconcurrentrun.cpp +++ b/src/corelib/concurrent/qtconcurrentrun.cpp @@ -99,7 +99,7 @@ functions; passing by pointer is useful for calling non-const member functions that modify the instance. - For example, calling QString::split() (a const member function) in a + For example, calling QByteArray::split() (a const member function) in a separate thread is done like this: \snippet doc/src/snippets/code/src_corelib_concurrent_qtconcurrentrun.cpp 4 diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index 0777f069ec..c7e4bc14d5 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -589,10 +589,11 @@ template <class Key, class T> Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::operator=(const QHash<Key, T> &other) { if (d != other.d) { - other.d->ref.ref(); + QHashData *o = other.d; + o->ref.ref(); if (!d->ref.deref()) freeData(d); - d = other.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index d145fe3a38..9b3efa3aeb 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -312,10 +312,11 @@ template <typename T> QLinkedList<T> &QLinkedList<T>::operator=(const QLinkedList<T> &l) { if (d != l.d) { - l.d->ref.ref(); + QLinkedListData *o = l.d; + o->ref.ref(); if (!d->ref.deref()) free(d); - d = l.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 722744cc0c..d843cbeb32 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -424,10 +424,11 @@ template <typename T> Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l) { if (d != l.d) { - l.d->ref.ref(); + QListData::Data *o = l.d; + o->ref.ref(); if (!d->ref.deref()) free(d); - d = l.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index e4b73a1aef..1c2aad3dda 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -426,10 +426,11 @@ template <class Key, class T> Q_INLINE_TEMPLATE QMap<Key, T> &QMap<Key, T>::operator=(const QMap<Key, T> &other) { if (d != other.d) { - other.d->ref.ref(); + QMapData* o = other.d; + o->ref.ref(); if (!d->ref.deref()) freeData(d); - d = other.d; + d = o; if (!d->sharable) detach_helper(); } diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 7e9934d552..6483c90fa5 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -95,9 +95,10 @@ public: if (o.d != d) { if (o.d) o.d->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o.d; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -105,9 +106,10 @@ public: if (o != d) { if (o) o->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -174,9 +176,10 @@ public: if (o.d != d) { if (o.d) o.d->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o.d; + if (old && !old->ref.deref()) + delete old; } return *this; } @@ -184,9 +187,10 @@ public: if (o != d) { if (o) o->ref.ref(); - if (d && !d->ref.deref()) - delete d; + T *old = d; d = o; + if (old && !old->ref.deref()) + delete old; } return *this; } diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c2e24852fe..b762b8a77a 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -377,10 +377,11 @@ inline void QVector<T>::replace(int i, const T &t) template <typename T> QVector<T> &QVector<T>::operator=(const QVector<T> &v) { - v.d->ref.ref(); + QVectorData *o = v.d; + o->ref.ref(); if (!d->ref.deref()) free(p); - d = v.d; + d = o; if (!d->sharable) detach_helper(); return *this; diff --git a/src/declarative/graphicsitems/qdeclarativeloader.cpp b/src/declarative/graphicsitems/qdeclarativeloader.cpp index 4c6268ff76..2fde4c82a4 100644 --- a/src/declarative/graphicsitems/qdeclarativeloader.cpp +++ b/src/declarative/graphicsitems/qdeclarativeloader.cpp @@ -115,53 +115,76 @@ void QDeclarativeLoaderPrivate::initResize() \brief The Loader item allows dynamically loading an Item-based subtree from a URL or Component. - The Loader element instantiates an item from a component. The component to - be instantiated may be specified directly by the \l sourceComponent - property, or loaded from a URL via the \l source property. + Loader is used to dynamically load visual QML components. It can load a + QML file (using the \l source property) or a \l Component object (using + the \l sourceComponent property). It is useful for delaying the creation + of a component until it is required: for example, when a component should + be created on demand, or when a component should not be created + unnecessarily for performance reasons. - Loader can be used to delay the creation of a component until it - is required. For example, this loads "Page1.qml" as a component - into the Loader element, when the \l MouseArea is clicked: + Here is a Loader that loads "Page1.qml" as a component when the + \l MouseArea is clicked: - \code - import Qt 4.7 + \snippet doc/src/snippets/declarative/loader/simple.qml 0 - Item { - width: 200; height: 200 + The loaded item can be accessed using the \l item property. - MouseArea { - anchors.fill: parent - onClicked: pageLoader.source = "Page1.qml" - } + Loader is like any other visual item and must be positioned and sized + accordingly to become visible. Once the component is loaded, the Loader + is automatically resized to the size of the component. - Loader { id: pageLoader } - } - \endcode + If the \l source or \l sourceComponent changes, any previously instantiated + items are destroyed. Setting \l source to an empty string or setting + \l sourceComponent to \c undefined destroys the currently loaded item, + freeing resources and leaving the Loader empty. + + + \section2 Receiving signals from loaded items - Note that Loader is like any other graphical Item and needs to be positioned - and sized accordingly to become visible. When a component is loaded, the - Loader is automatically resized to the size of the component. + Any signals emitted from the loaded item can be received using the + \l Connections element. For example, the following \c application.qml + loads \c MyItem.qml, and is able to receive the \c message signal from + the loaded item through a \l Connections object: - If the Loader source is changed, any previous items instantiated - will be destroyed. Setting \l source to an empty string, or setting - sourceComponent to \e undefined - will destroy the currently instantiated items, freeing resources - and leaving the Loader empty. For example: + \table + \row + \o application.qml + \o MyItem.qml + \row + \o \snippet doc/src/snippets/declarative/loader/connections.qml 0 + \o \snippet doc/src/snippets/declarative/loader/MyItem.qml 0 + \endtable - \code - pageLoader.source = "" - \endcode + Alternatively, since \c MyItem.qml is loaded within the scope of the + Loader, it could also directly call any function defined in the Loader or + its parent \l Item. - or - \code - pageLoader.sourceComponent = undefined - \endcode + \section2 Focus and key events - unloads "Page1.qml" and frees resources consumed by it. + Loader is a focus scope. Its \l {Item::}{focus} property must be set to + \c true for any of its children to get the \e {active focus}. (See + \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} + for more details.) Any key events received in the loaded item should likely + also be \l {KeyEvent::}{accepted} so they are not propagated to the Loader. - Note that Loader is a focus scope. Its \c focus property must be set to \c true for any of its children - to get the \e {active focus} (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details). + For example, the following \c application.qml loads \c KeyReader.qml when + the \l MouseArea is clicked. Notice the \l {Item::}{focus} property is + set to \c true for the Loader as well as the \l Item in the dynamically + loaded object: + + \table + \row + \o application.qml + \o KeyReader.qml + \row + \o \snippet doc/src/snippets/declarative/loader/focus.qml 0 + \o \snippet doc/src/snippets/declarative/loader/KeyReader.qml 0 + \endtable + + Once \c KeyReader.qml is loaded, it accepts key events and sets + \c event.accepted to \c true so that the event is not propagated to the + parent \l Rectangle. \sa {dynamic-object-creation}{Dynamic Object Creation} */ @@ -198,8 +221,13 @@ QDeclarativeLoader::~QDeclarativeLoader() /*! \qmlproperty url Loader::source - This property holds the URL of the QML component to - instantiate. + This property holds the URL of the QML component to instantiate. + + Note the QML component must be an \l Item-based component. Loader cannot + load non-visual components. + + To unload the currently loaded item, set this property to an empty string, + or set \l sourceComponent to \c undefined. \sa sourceComponent, status, progress */ @@ -258,7 +286,8 @@ void QDeclarativeLoader::setSource(const QUrl &url) } \endqml - Note this value must hold a \l Component object; it cannot be a \l Item. + To unload the currently loaded item, set this property to an empty string, + or set \l sourceComponent to \c undefined. \sa source, progress */ @@ -477,7 +506,7 @@ void QDeclarativeLoaderPrivate::_q_updateSize(bool loaderGeometryChanged) /*! \qmlproperty Item Loader::item - This property holds the top-level item created from source. + This property holds the top-level item that is currently loaded. */ QGraphicsObject *QDeclarativeLoader::item() const { diff --git a/src/declarative/graphicsitems/qdeclarativepath_p.h b/src/declarative/graphicsitems/qdeclarativepath_p.h index 5ab5cfd635..195057c91a 100644 --- a/src/declarative/graphicsitems/qdeclarativepath_p.h +++ b/src/declarative/graphicsitems/qdeclarativepath_p.h @@ -190,7 +190,7 @@ private: class Q_AUTOTEST_EXPORT QDeclarativePathPercent : public QDeclarativePathElement { Q_OBJECT - Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY changed) + Q_PROPERTY(qreal value READ value WRITE setValue) public: QDeclarativePathPercent(QObject *parent=0) : QDeclarativePathElement(parent) {} diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 535fb909db..4b97505e52 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -480,7 +480,8 @@ void QDeclarativePathView::setModel(const QVariant &model) connect(d->model, SIGNAL(modelReset()), this, SLOT(modelReset())); connect(d->model, SIGNAL(createdItem(int, QDeclarativeItem*)), this, SLOT(createdItem(int,QDeclarativeItem*))); } - d->offset = qmlMod(d->offset, qreal(d->model->count())); + if (d->model->count()) + d->offset = qmlMod(d->offset, qreal(d->model->count())); if (d->offset < 0) d->offset = d->model->count() + d->offset; d->regenerate(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index bd8d404a54..b4f36f4d45 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -277,8 +277,10 @@ void QDeclarativeTextInput::setSelectionColor(const QColor &color) QPalette p = d->control->palette(); p.setColor(QPalette::Highlight, d->selectionColor); d->control->setPalette(p); - clearCache(); - update(); + if (d->control->hasSelectedText()) { + clearCache(); + update(); + } emit selectionColorChanged(color); } @@ -303,8 +305,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) QPalette p = d->control->palette(); p.setColor(QPalette::HighlightedText, d->selectedTextColor); d->control->setPalette(p); - clearCache(); - update(); + if (d->control->hasSelectedText()) { + clearCache(); + update(); + } emit selectedTextColorChanged(color); } @@ -1233,8 +1237,12 @@ void QDeclarativeTextInput::setPasswordCharacter(const QString &str) Q_D(QDeclarativeTextInput); if(str.length() < 1) return; - emit passwordCharacterChanged(); d->control->setPasswordCharacter(str.constData()[0]); + EchoMode echoMode_ = echoMode(); + if (echoMode_ == Password || echoMode_ == PasswordEchoOnEdit) { + updateSize(); + } + emit passwordCharacterChanged(); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 764676a2ee..50a0a33b62 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -238,20 +238,6 @@ QString QDeclarativeVisualItemModel::stringValue(int index, const QString &name) return QDeclarativeEngine::contextForObject(d->children.at(index).item)->contextProperty(name).toString(); } -QVariant QDeclarativeVisualItemModel::evaluate(int index, const QString &expression, QObject *objectContext) -{ - Q_D(QDeclarativeVisualItemModel); - if (index < 0 || index >= d->children.count()) - return QVariant(); - QDeclarativeContext *ccontext = qmlContext(this); - QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext); - ctxt->setContextObject(d->children.at(index).item); - QDeclarativeExpression e(ctxt, objectContext, expression); - QVariant value = e.evaluate(); - delete ctxt; - return value; -} - int QDeclarativeVisualItemModel::indexOf(QDeclarativeItem *item, QObject *) const { Q_D(const QDeclarativeVisualItemModel); @@ -728,6 +714,7 @@ void QDeclarativeVisualDataModel::setModel(const QVariant &model) QObject::disconnect(d->m_abstractItemModel, SIGNAL(rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int)), this, SLOT(_q_rowsMoved(const QModelIndex&,int,int,const QModelIndex&,int))); QObject::disconnect(d->m_abstractItemModel, SIGNAL(modelReset()), this, SLOT(_q_modelReset())); + d->m_abstractItemModel = 0; } else if (d->m_visualItemModel) { QObject::disconnect(d->m_visualItemModel, SIGNAL(itemsInserted(int,int)), this, SIGNAL(itemsInserted(int,int))); @@ -1167,38 +1154,6 @@ QString QDeclarativeVisualDataModel::stringValue(int index, const QString &name) return val; } -QVariant QDeclarativeVisualDataModel::evaluate(int index, const QString &expression, QObject *objectContext) -{ - Q_D(QDeclarativeVisualDataModel); - if (d->m_visualItemModel) - return d->m_visualItemModel->evaluate(index, expression, objectContext); - - if ((!d->m_listModelInterface && !d->m_abstractItemModel) || !d->m_delegate) - return QVariant(); - - QVariant value; - QObject *nobj = d->m_cache.item(index); - if (nobj) { - QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(nobj); - if (item) { - QDeclarativeExpression e(qmlContext(item), objectContext, expression); - value = e.evaluate(); - } - } else { - QDeclarativeContext *ccontext = d->m_context; - if (!ccontext) ccontext = qmlContext(this); - QDeclarativeContext *ctxt = new QDeclarativeContext(ccontext); - QDeclarativeVisualDataModelData *data = new QDeclarativeVisualDataModelData(index, this); - ctxt->setContextObject(data); - QDeclarativeExpression e(ctxt, objectContext, expression); - value = e.evaluate(); - delete data; - delete ctxt; - } - - return value; -} - int QDeclarativeVisualDataModel::indexOf(QDeclarativeItem *item, QObject *) const { QVariant val = QDeclarativeEngine::contextForObject(item)->contextProperty(QLatin1String("index")); diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h index d5c0de2cf5..50d2c53c3f 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel_p.h @@ -79,7 +79,6 @@ public: virtual ReleaseFlags release(QDeclarativeItem *item) = 0; virtual bool completePending() const = 0; virtual void completeItem() = 0; - virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext) = 0; virtual QString stringValue(int, const QString &) { return QString(); } virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const = 0; @@ -122,7 +121,6 @@ public: virtual bool completePending() const; virtual void completeItem(); virtual QString stringValue(int index, const QString &role); - virtual QVariant evaluate(int index, const QString &expression, QObject *objectContext); virtual int indexOf(QDeclarativeItem *item, QObject *objectContext) const; @@ -177,7 +175,6 @@ public: bool completePending() const; void completeItem(); virtual QString stringValue(int index, const QString &role); - QVariant evaluate(int index, const QString &expression, QObject *objectContext); int indexOf(QDeclarativeItem *item, QObject *objectContext) const; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 513fc658c8..cedf9d5ca5 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -551,7 +551,7 @@ QDeclarativeEngine::~QDeclarativeEngine() } /*! \fn void QDeclarativeEngine::quit() - This signal is emitted when the QDeclarativeEngine quits. + This signal is emitted when the QML loaded by the engine would like to quit. */ /*! \fn void QDeclarativeEngine::warnings(const QList<QDeclarativeError> &warnings) @@ -674,7 +674,7 @@ void QDeclarativeEngine::addImageProvider(const QString &providerId, QDeclarativ { Q_D(QDeclarativeEngine); QMutexLocker locker(&d->mutex); - d->imageProviders.insert(providerId, provider); + d->imageProviders.insert(providerId, QSharedPointer<QDeclarativeImageProvider>(provider)); } /*! @@ -684,7 +684,7 @@ QDeclarativeImageProvider *QDeclarativeEngine::imageProvider(const QString &prov { Q_D(const QDeclarativeEngine); QMutexLocker locker(&d->mutex); - return d->imageProviders.value(providerId); + return d->imageProviders.value(providerId).data(); } /*! @@ -698,13 +698,14 @@ void QDeclarativeEngine::removeImageProvider(const QString &providerId) { Q_D(QDeclarativeEngine); QMutexLocker locker(&d->mutex); - delete d->imageProviders.take(providerId); + d->imageProviders.take(providerId); } QDeclarativeImageProvider::ImageType QDeclarativeEnginePrivate::getImageProviderType(const QUrl &url) { QMutexLocker locker(&mutex); - QDeclarativeImageProvider *provider = imageProviders.value(url.host()); + QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host()); + locker.unlock(); if (provider) return provider->imageType(); return static_cast<QDeclarativeImageProvider::ImageType>(-1); @@ -714,7 +715,8 @@ QImage QDeclarativeEnginePrivate::getImageFromProvider(const QUrl &url, QSize *s { QMutexLocker locker(&mutex); QImage image; - QDeclarativeImageProvider *provider = imageProviders.value(url.host()); + QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host()); + locker.unlock(); if (provider) image = provider->requestImage(url.path().mid(1), size, req_size); return image; @@ -724,7 +726,8 @@ QPixmap QDeclarativeEnginePrivate::getPixmapFromProvider(const QUrl &url, QSize { QMutexLocker locker(&mutex); QPixmap pixmap; - QDeclarativeImageProvider *provider = imageProviders.value(url.host()); + QSharedPointer<QDeclarativeImageProvider> provider = imageProviders.value(url.host()); + locker.unlock(); if (provider) pixmap = provider->requestPixmap(url.path().mid(1), size, req_size); return pixmap; diff --git a/src/declarative/qml/qdeclarativeengine_p.h b/src/declarative/qml/qdeclarativeengine_p.h index 3b5dd5a3f9..db2db350ed 100644 --- a/src/declarative/qml/qdeclarativeengine_p.h +++ b/src/declarative/qml/qdeclarativeengine_p.h @@ -232,7 +232,7 @@ public: mutable QNetworkAccessManager *networkAccessManager; mutable QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory; - QHash<QString,QDeclarativeImageProvider*> imageProviders; + QHash<QString,QSharedPointer<QDeclarativeImageProvider> > imageProviders; QDeclarativeImageProvider::ImageType getImageProviderType(const QUrl &url); QImage getImageFromProvider(const QUrl &url, QSize *size, const QSize& req_size); QPixmap getPixmapFromProvider(const QUrl &url, QSize *size, const QSize& req_size); diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index ed98e3ce65..688e0fc797 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -264,8 +264,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla QDeclarativeContextData *child = p->childContexts; while (child) { - if (!child->isInternal) - ++count; + ++count; child = child->nextChild; } @@ -273,8 +272,7 @@ void QDeclarativeEngineDebugServer::buildObjectList(QDataStream &message, QDecla child = p->childContexts; while (child) { - if (!child->isInternal) - buildObjectList(message, child->asQDeclarativeContext()); + buildObjectList(message, child->asQDeclarativeContext()); child = child->nextChild; } diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp index ea68327656..ef31be7232 100644 --- a/src/declarative/qml/qdeclarativeimageprovider.cpp +++ b/src/declarative/qml/qdeclarativeimageprovider.cpp @@ -161,7 +161,9 @@ QDeclarativeImageProvider::QDeclarativeImageProvider(ImageType type) } /*! - \internal + Destroys the QDeclarativeImageProvider + + \note The destructor of your derived class need to be thread safe. */ QDeclarativeImageProvider::~QDeclarativeImageProvider() { diff --git a/src/declarative/util/qdeclarativeanimation_p.h b/src/declarative/util/qdeclarativeanimation_p.h index 481c36c224..d15d1f69cd 100644 --- a/src/declarative/util/qdeclarativeanimation_p.h +++ b/src/declarative/util/qdeclarativeanimation_p.h @@ -74,7 +74,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeAbstractAnimation : public QObject, public Q Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged) Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged) Q_PROPERTY(bool alwaysRunToEnd READ alwaysRunToEnd WRITE setAlwaysRunToEnd NOTIFY alwaysRunToEndChanged) - Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopsChanged) + Q_PROPERTY(int loops READ loops WRITE setLoops NOTIFY loopCountChanged) Q_CLASSINFO("DefaultMethod", "start()") public: @@ -301,8 +301,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeColorAnimation : public QDeclarativeProperty { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation) - Q_PROPERTY(QColor from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QColor to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(QColor from READ from WRITE setFrom) + Q_PROPERTY(QColor to READ to WRITE setTo) public: QDeclarativeColorAnimation(QObject *parent=0); @@ -320,8 +320,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeNumberAnimation : public QDeclarativePropert Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation) - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(qreal from READ from WRITE setFrom) + Q_PROPERTY(qreal to READ to WRITE setTo) public: QDeclarativeNumberAnimation(QObject *parent=0); @@ -345,8 +345,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeVector3dAnimation : public QDeclarativePrope Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativePropertyAnimation) - Q_PROPERTY(QVector3D from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(QVector3D to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(QVector3D from READ from WRITE setFrom) + Q_PROPERTY(QVector3D to READ to WRITE setTo) public: QDeclarativeVector3dAnimation(QObject *parent=0); @@ -366,8 +366,8 @@ class Q_AUTOTEST_EXPORT QDeclarativeRotationAnimation : public QDeclarativePrope Q_DECLARE_PRIVATE(QDeclarativeRotationAnimation) Q_ENUMS(RotationDirection) - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) + Q_PROPERTY(qreal from READ from WRITE setFrom) + Q_PROPERTY(qreal to READ to WRITE setTo) Q_PROPERTY(RotationDirection direction READ direction WRITE setDirection NOTIFY directionChanged) public: diff --git a/src/declarative/util/qdeclarativefontloader_p.h b/src/declarative/util/qdeclarativefontloader_p.h index 6947547352..a5fbb8fea7 100644 --- a/src/declarative/util/qdeclarativefontloader_p.h +++ b/src/declarative/util/qdeclarativefontloader_p.h @@ -60,7 +60,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeFontLoader : public QObject Q_DECLARE_PRIVATE(QDeclarativeFontLoader) Q_ENUMS(Status) - Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged) + Q_PROPERTY(QUrl source READ source WRITE setSource) Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(Status status READ status NOTIFY statusChanged) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 64fc0ee0fa..87850a75e4 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -119,6 +119,7 @@ QT_USE_NAMESPACE - (QString)removeExtensions:(const QString &)filter; - (void)createTextField; - (void)createPopUpButton:(const QString &)selectedFilter hideDetails:(BOOL)hideDetails; +- (QStringList)findStrippedFilterWithVisualFilterName:(QString)name; - (void)createAccessory; @end @@ -127,8 +128,6 @@ QT_USE_NAMESPACE - (id)initWithAcceptMode:(QT_PREPEND_NAMESPACE(QFileDialog::AcceptMode))acceptMode title:(const QString &)title - nameFilters:(const QStringList &)nameFilters - selectedNameFilter:(const QString &)selectedNameFilter hideNameFilterDetails:(bool)hideNameFilterDetails qDirFilter:(QT_PREPEND_NAMESPACE(QDir::Filters))qDirFilter fileOptions:(QT_PREPEND_NAMESPACE(QFileDialog::Options))fileOptions @@ -158,8 +157,10 @@ QT_USE_NAMESPACE mPriv = priv; mLastFilterCheckPath = new QString; mQDirFilterEntryList = new QStringList; - mNameFilterDropDownList = new QStringList(nameFilters); - mSelectedNameFilter = new QStringList(qt_clean_filter_list(selectedNameFilter)); + mNameFilterDropDownList = new QStringList(priv->nameFilters); + QString selectedVisualNameFilter = priv->qFileDialogUi->fileTypeCombo->currentText(); + mSelectedNameFilter = new QStringList([self findStrippedFilterWithVisualFilterName:selectedVisualNameFilter]); + QFileInfo sel(selectFile); if (sel.isDir()){ mCurrentDir = [qt_mac_QStringToNSString(sel.absoluteFilePath()) retain]; @@ -168,8 +169,9 @@ QT_USE_NAMESPACE mCurrentDir = [qt_mac_QStringToNSString(sel.absolutePath()) retain]; mCurrentSelection = new QString(sel.absoluteFilePath()); } + [mSavePanel setTitle:qt_mac_QStringToNSString(title)]; - [self createPopUpButton:selectedNameFilter hideDetails:hideNameFilterDetails]; + [self createPopUpButton:selectedVisualNameFilter hideDetails:hideNameFilterDetails]; [self createTextField]; [self createAccessory]; [mSavePanel setAccessoryView:mNameFilterDropDownList->size() > 1 ? mAccessoryView : nil]; @@ -350,7 +352,7 @@ QT_USE_NAMESPACE // This mDelegate function is called when the _name_ filter changes. Q_UNUSED(sender); QString selection = mNameFilterDropDownList->value([mPopUpButton indexOfSelectedItem]); - *mSelectedNameFilter = QT_PREPEND_NAMESPACE(qt_clean_filter_list)(selection); + *mSelectedNameFilter = [self findStrippedFilterWithVisualFilterName:selection]; [mSavePanel validateVisibleColumns]; [self updateProperties]; if (mPriv) @@ -499,6 +501,15 @@ QT_USE_NAMESPACE } } +- (QStringList) findStrippedFilterWithVisualFilterName:(QString)name +{ + for (int i=0; i<mNameFilterDropDownList->size(); ++i) { + if (mNameFilterDropDownList->at(i).startsWith(name)) + return qt_clean_filter_list(mNameFilterDropDownList->at(i)); + } + return QStringList(); +} + - (void)createAccessory { NSRect accessoryRect = { { 0.0, 0.0 }, { 450.0, 33.0 } }; @@ -1039,8 +1050,6 @@ void QFileDialogPrivate::createNSOpenSavePanelDelegate() QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = [[QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) alloc] initWithAcceptMode:acceptMode title:q->windowTitle() - nameFilters:q->nameFilters() - selectedNameFilter:q->selectedNameFilter() hideNameFilterDetails:q->testOption(QFileDialog::HideNameFilterDetails) qDirFilter:model->filter() fileOptions:opts diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index a98ce6fa8d..3c23884b7a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -5126,7 +5126,9 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool q->update(itemBoundingRect.translated(item->d_ptr->sceneTransform.dx(), item->d_ptr->sceneTransform.dy())); } else { - q->update(item->d_ptr->sceneTransform.mapRect(itemBoundingRect)); + QRectF rect = item->d_ptr->sceneTransform.mapRect(itemBoundingRect); + if (!rect.isEmpty()) + q->update(rect); } } else { QRectF dirtyRect; diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 067461002a..c8aca80930 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2596,9 +2596,11 @@ void QGraphicsView::updateScene(const QList<QRectF> &rects) // Convert scene rects to viewport rects. foreach (const QRectF &rect, rects) { - QRect xrect = transform.mapRect(rect).toRect(); + QRect xrect = transform.mapRect(rect).toAlignedRect(); if (!(d->optimizationFlags & DontAdjustForAntialiasing)) xrect.adjust(-2, -2, 2, 2); + else + xrect.adjust(-1, -1, 1, 1); if (!viewportRect.intersects(xrect)) continue; dirtyViewportRects << xrect; diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index ef9be8f703..c039ca86ae 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -830,15 +830,17 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers return false; QFileInfo info(fileName); - if (!info.exists()) - return false; - QString key = QLatin1Literal("qt_pixmap") % info.absoluteFilePath() % HexString<uint>(info.lastModified().toTime_t()) % HexString<quint64>(info.size()) % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType); + // Note: If no extension is provided, we try to match the + // file against known plugin extensions + if (!info.completeSuffix().isEmpty() && !info.exists()) + return false; + if (QPixmapCache::find(key, *this)) return true; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index e164baf2fb..3d3a749856 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1055,6 +1055,18 @@ QApplication::~QApplication() QApplicationPrivate::is_app_closing = true; QApplicationPrivate::is_app_running = false; + // delete all widgets + if (QWidgetPrivate::allWidgets) { + QWidgetSet *mySet = QWidgetPrivate::allWidgets; + QWidgetPrivate::allWidgets = 0; + for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { + register QWidget *w = *it; + if (!w->parent()) // window + w->destroy(true, true); + } + delete mySet; + } + delete qt_desktopWidget; qt_desktopWidget = 0; @@ -1075,18 +1087,6 @@ QApplication::~QApplication() delete QWidgetPrivate::mapper; QWidgetPrivate::mapper = 0; - // delete all widgets - if (QWidgetPrivate::allWidgets) { - QWidgetSet *mySet = QWidgetPrivate::allWidgets; - QWidgetPrivate::allWidgets = 0; - for (QWidgetSet::ConstIterator it = mySet->constBegin(); it != mySet->constEnd(); ++it) { - register QWidget *w = *it; - if (!w->parent()) // window - w->destroy(true, true); - } - delete mySet; - } - delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; delete QApplicationPrivate::sys_pal; diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 559bb6aa00..7c5e7909b6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -135,6 +135,38 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo } #endif +void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) +{ + if (QWidgetPrivate::mapper && QWidgetPrivate::mapper->contains(control)) { + QWidget *const widget = QWidgetPrivate::mapper->value(control); + QWidget *const window = widget->window(); + if (QTLWExtra *topData = qt_widget_private(window)->maybeTopData()) { + QWidgetBackingStoreTracker &backingStore = topData->backingStore; + if (visible) { + if (backingStore.data()) { + backingStore.registerWidget(widget); + } else { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); +#endif + backingStore.create(window); + backingStore.registerWidget(widget); + qt_widget_private(widget)->invalidateBuffer(widget->rect()); + widget->repaint(); + } + } else { +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); +#endif + backingStore.unregisterWidget(widget); + // In order to ensure that any resources used by the window surface + // are immediately freed, we flush the WSERV command buffer. + S60->wsSession().Flush(); + } + } + } +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -1075,17 +1107,19 @@ void QSymbianControl::Draw(const TRect& controlRect) const CFbsBitmap *bitmap = s60Surface->symbianBitmap(); CWindowGc &gc = SystemGc(); - switch(qwidget->d_func()->extraData()->nativePaintMode) { + QWExtra::NativePaintMode nativePaintMode = qwidget->d_func()->extraData()->nativePaintMode; + if(qwidget->d_func()->paintOnScreen()) + nativePaintMode = QWExtra::Disable; + + switch(nativePaintMode) { case QWExtra::Disable: // Do nothing break; - case QWExtra::Blit: if (qwidget->d_func()->isOpaque) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); break; - case QWExtra::ZeroFill: if (Window().DisplayMode() == EColor16MA || Window().DisplayMode() == Q_SYMBIAN_ECOLOR16MAP) { @@ -1098,7 +1132,6 @@ void QSymbianControl::Draw(const TRect& controlRect) const gc.Clear(controlRect); }; break; - default: Q_ASSERT(false); } @@ -1922,35 +1955,10 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent if (callSymbianEventFilters(symbianEvent)) return 1; const TWsVisibilityChangedEvent *visChangedEvent = event->VisibilityChanged(); - QWidget *w = QWidgetPrivate::mapper->value(control); - QWidget *const window = w->window(); - if (!window->d_func()->maybeTopData()) - break; - QRefCountedWidgetBackingStore &backingStore = window->d_func()->maybeTopData()->backingStore; - if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdDeallocateLayer); -#endif - // Decrement backing store reference count - backingStore.deref(); - // In order to ensure that any resources used by the window surface - // are immediately freed, we flush the WSERV command buffer. - S60->wsSession().Flush(); - } else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) { - if (backingStore.data()) { - // Increment backing store reference count - backingStore.ref(); - } else { -#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS - S60->wsSession().SendEffectCommand(ETfxCmdRestoreLayer); -#endif - // Create backing store with an initial reference count of 1 - backingStore.create(window); - backingStore.ref(); - w->d_func()->invalidateBuffer(w->rect()); - w->repaint(); - } - } + if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::ENotVisible) + S60->controlVisibilityChanged(control, false); + else if (visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible) + S60->controlVisibilityChanged(control, true); return 1; } break; diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp index 9fcc718f3e..4b75f0a18d 100644 --- a/src/gui/kernel/qclipboard_x11.cpp +++ b/src/gui/kernel/qclipboard_x11.cpp @@ -456,7 +456,8 @@ QClipboard::QClipboard(QObject *parent) XCheckIfEvent(X11->display, &ev, &qt_init_timestamp_scanner, (XPointer)&data); if (data.timestamp == CurrentTime) { setupOwner(); - int dummy = 0; + // We need this value just for completeness, we don't use it. + long dummy = 0; Window ownerId = owner->internalWinId(); XChangeProperty(X11->display, ownerId, ATOM(CLIP_TEMPORARY), XA_INTEGER, 32, diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index fe9dd8af6c..e768a21f30 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -129,7 +129,12 @@ Qt::GestureType QGestureManager::registerGestureRecognizer(QGestureRecognizer *r void QGestureManager::unregisterGestureRecognizer(Qt::GestureType type) { QList<QGestureRecognizer *> list = m_recognizers.values(type); - m_recognizers.remove(type); + while (QGestureRecognizer *recognizer = m_recognizers.take(type)) { + if (!m_obsoleteGestures.contains(recognizer)) { + // inserting even an empty QSet will cause the recognizer to be deleted on destruction of the manager + m_obsoleteGestures.insert(recognizer, QSet<QGesture *>()); + } + } foreach (QGesture *g, m_gestureToRecognizer.keys()) { QGestureRecognizer *recognizer = m_gestureToRecognizer.value(g); if (list.contains(recognizer)) { diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index a18ea072ff..ad6a99a3c1 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -164,6 +164,7 @@ public: static inline CEikButtonGroupContainer* buttonGroupContainer(); static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible); #endif + static void controlVisibilityChanged(CCoeControl *control, bool visible); #ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index aaa29a174f..3d2bfe22cc 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -162,47 +162,76 @@ static inline bool hasBackingStoreSupport() extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp +/*! + \internal + \class QWidgetBackingStoreTracker + \brief Class which allows tracking of which widgets are using a given backing store + + QWidgetBackingStoreTracker is a thin wrapper around a QWidgetBackingStore pointer, + which maintains a list of the QWidgets which are currently using the backing + store. This list is modified via the registerWidget and unregisterWidget functions. + */ -QRefCountedWidgetBackingStore::QRefCountedWidgetBackingStore() +QWidgetBackingStoreTracker::QWidgetBackingStoreTracker() : m_ptr(0) - , m_count(0) { } -QRefCountedWidgetBackingStore::~QRefCountedWidgetBackingStore() +QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker() { delete m_ptr; } -void QRefCountedWidgetBackingStore::create(QWidget *widget) +/*! + \internal + Destroy the contained QWidgetBackingStore, if not null, and clear the list of + widgets using the backing store, then create a new QWidgetBackingStore, providing + the QWidget. + */ +void QWidgetBackingStoreTracker::create(QWidget *widget) { destroy(); m_ptr = new QWidgetBackingStore(widget); - m_count = 0; } -void QRefCountedWidgetBackingStore::destroy() +/*! + \internal + Destroy the contained QWidgetBackingStore, if not null, and clear the list of + widgets using the backing store. + */ +void QWidgetBackingStoreTracker::destroy() { delete m_ptr; m_ptr = 0; - m_count = 0; + m_widgets.clear(); } -void QRefCountedWidgetBackingStore::ref() +/*! + \internal + Add the widget to the list of widgets currently using the backing store. + If the widget was already in the list, this function is a no-op. + */ +void QWidgetBackingStoreTracker::registerWidget(QWidget *w) { Q_ASSERT(m_ptr); - ++m_count; + Q_ASSERT(w->internalWinId()); + Q_ASSERT(qt_widget_private(w)->maybeBackingStore() == m_ptr); + m_widgets.insert(w); } -void QRefCountedWidgetBackingStore::deref() +/*! + \internal + Remove the widget from the list of widgets currently using the backing store. + If the widget was in the list, and removing it causes the list to be empty, + the backing store is deleted. + If the widget was not in the list, this function is a no-op. + */ +void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) { - if (m_count) { - Q_ASSERT(m_ptr); - if (0 == --m_count) { - delete m_ptr; - m_ptr = 0; - } + if (m_widgets.remove(w) && m_widgets.isEmpty()) { + delete m_ptr; + m_ptr = 0; } } @@ -1245,7 +1274,16 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) q->setAttribute(Qt::WA_WState_Hidden); //give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later +#ifdef Q_OS_SYMBIAN + if (isGLWidget) { + // Don't waste GPU mem for unnecessary large egl surface + data.crect = QRect(0,0,2,2); + } else { + data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,360,640); + } +#else data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480); +#endif focus_next = focus_prev = q; @@ -9928,7 +9966,7 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) desktopWidget = parent; bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget; -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC) +#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) if (newParent && parent && !desktopWidget) { if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)) parent->d_func()->enforceNativeChildren(); @@ -10582,7 +10620,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } case Qt::WA_PaintOnScreen: d->updateIsOpaque(); -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) +#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_OS_SYMBIAN) // Recreate the widget if it's already created as an alien widget and // WA_PaintOnScreen is enabled. Paint on screen widgets must have win id. // So must their children. diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8ae6a9948a..1979c84631 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2796,10 +2796,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (QWidget *parent = q->parentWidget()) { if (parent->testAttribute(Qt::WA_WState_Created)) { - if (set) - [qt_mac_window_for(parent) addChildWindow:qt_mac_window_for(q) ordered:NSWindowAbove]; - else + if (set) { + if (parent->isVisible()) { + NSWindow *childwin = qt_mac_window_for(q); + [qt_mac_window_for(parent) addChildWindow:childwin ordered:NSWindowAbove]; + } + } else { [qt_mac_window_for(parent) removeChildWindow:qt_mac_window_for(q)]; + } } } @@ -2807,10 +2811,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set) for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { - if (set) - [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove]; - else + if (set) { + NSWindow *childwin = qt_mac_window_for(child); + [qt_mac_window_for(q) addChildWindow:childwin ordered:NSWindowAbove]; + } else { [qt_mac_window_for(q) removeChildWindow:qt_mac_window_for(child)]; + } } } } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 587d7fb2e4..4a79dc7932 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -110,17 +110,18 @@ class QWidgetItemV2; class QStyle; -class Q_AUTOTEST_EXPORT QRefCountedWidgetBackingStore +class Q_AUTOTEST_EXPORT QWidgetBackingStoreTracker { + public: - QRefCountedWidgetBackingStore(); - ~QRefCountedWidgetBackingStore(); + QWidgetBackingStoreTracker(); + ~QWidgetBackingStoreTracker(); void create(QWidget *tlw); void destroy(); - void ref(); - void deref(); + void registerWidget(QWidget *w); + void unregisterWidget(QWidget *w); inline QWidgetBackingStore* data() { @@ -143,11 +144,11 @@ public: } private: - Q_DISABLE_COPY(QRefCountedWidgetBackingStore) + Q_DISABLE_COPY(QWidgetBackingStoreTracker) private: QWidgetBackingStore* m_ptr; - int m_count; + QSet<QWidget *> m_widgets; }; struct QTLWExtra { @@ -156,7 +157,7 @@ struct QTLWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). QIcon *icon; // widget icon QPixmap *iconPixmap; - QRefCountedWidgetBackingStore backingStore; + QWidgetBackingStoreTracker backingStore; QWindowSurface *windowSurface; QPainter *sharedPainter; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 56349ad6d5..7494f92983 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -482,14 +482,13 @@ void QWidgetPrivate::show_sys() activateSymbianWindow(); QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); + const bool isFullscreen = q->windowState() & Qt::WindowFullScreen; #ifdef Q_WS_S60 // Lazily initialize the S60 screen furniture when the first window is shown. - if (!QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) + if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes) && !S60->buttonGroupContainer() && !S60->statusPane()) { - bool isFullscreen = q->windowState() & Qt::WindowFullScreen; - if (!q->testAttribute(Qt::WA_DontShowOnScreen)) { // Create the status pane and CBA here @@ -504,23 +503,24 @@ void QWidgetPrivate::show_sys() // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver. QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId()); S60->statusPane()->SetObserver(desktopControl); - - // Hide the status pane if fullscreen OR - // Fill client area if maximized OR - // Put window below status pane unless the window has an explicit position. - if (isFullscreen) { + if (isFullscreen) S60->statusPane()->MakeVisible(false); - } else if (q->windowState() & Qt::WindowMaximized) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); - id->SetExtent(r.iTl, r.Size()); - } else if (!q->testAttribute(Qt::WA_Moved)) { - id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); - } } } } #endif + // Fill client area if maximized OR + // Put window below status pane unless the window has an explicit position. + if (!isFullscreen) { + if (q->windowState() & Qt::WindowMaximized) { + TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + id->SetExtent(r.iTl, r.Size()); + } else if (!q->testAttribute(Qt::WA_Moved)) { + id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); + } + } + id->MakeVisible(true); if(q->isWindow()) @@ -684,6 +684,12 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) QSymbianControl *old_winid = static_cast<QSymbianControl *>(wasCreated ? data.winid : 0); if ((q->windowType() == Qt::Desktop)) old_winid = 0; + + // old_winid may not have received a 'not visible' visibility + // changed event before being destroyed; make sure that it is + // removed from the backing store's list of visible windows. + S60->controlVisibilityChanged(old_winid, false); + setWinId(0); // hide and reparent our own window away. Otherwise we might get diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index 83751edf8a..ac9b99438e 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -352,7 +352,7 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QWindowS // Always flush repainted areas. dirtyOnScreen += toClean; -#ifdef Q_WS_QWS +#if defined(Q_WS_QWS) && !defined(Q_BACKINGSTORE_SUBSURFACES) toClean.translate(tlwOffset); #endif @@ -1294,7 +1294,12 @@ void QWidgetBackingStore::sync() #ifdef Q_BACKINGSTORE_SUBSURFACES QWindowSurface *subSurface = w->windowSurface(); BeginPaintInfo beginPaintInfo; - beginPaint(toBePainted, w, subSurface, &beginPaintInfo, false); + + QPoint off = w->mapTo(tlw, QPoint()); + toBePainted.translate(off); + beginPaint(toBePainted, w, subSurface, &beginPaintInfo, true); + toBePainted.translate(-off); + if (beginPaintInfo.nothingToPaint) continue; diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp index bc4a7eb80b..9c02009d72 100644 --- a/src/gui/painting/qdrawhelper_ssse3.cpp +++ b/src/gui/painting/qdrawhelper_ssse3.cpp @@ -118,22 +118,12 @@ inline static void blend_pixel(quint32 &dst, const quint32 src) \ /* We use two vectors to extract the src: prevLoaded for the first pixels, lastLoaded for the current pixels. */\ __m128i srcVectorPrevLoaded;\ - if (minusOffsetToAlignSrcOn16Bytes <= prologLength) {\ - srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ - } else {\ - quint32 temp[4] Q_DECL_ALIGN(16);\ - switch (prologLength) {\ - case 3:\ - temp[1] = src[x - 3];\ - case 2:\ - temp[2] = src[x - 2];\ - case 1:\ - temp[3] = src[x - 1];\ - default:\ - break;\ - }\ - srcVectorPrevLoaded = _mm_load_si128((__m128i *)temp);\ + if (minusOffsetToAlignSrcOn16Bytes > prologLength) {\ + /* We go forward 4 pixels to avoid reading before src. */\ + for (; x < prologLength + 4; ++x)\ + blend_pixel(dst[x], src[x]); \ }\ + srcVectorPrevLoaded = _mm_load_si128((__m128i *)&src[x - minusOffsetToAlignSrcOn16Bytes]);\ const int palignrOffset = minusOffsetToAlignSrcOn16Bytes << 2;\ \ const __m128i alphaShuffleMask = _mm_set_epi8(0xff,15,0xff,15,0xff,11,0xff,11,0xff,7,0xff,7,0xff,3,0xff,3);\ diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c index 539a33c7a8..94039fb71e 100644 --- a/src/gui/painting/qgrayraster.c +++ b/src/gui/painting/qgrayraster.c @@ -1355,10 +1355,6 @@ /* <Input> */ /* outline :: A pointer to the source target. */ /* */ - /* func_interface :: A table of `emitters', i.e,. function pointers */ - /* called during decomposition to indicate path */ - /* operations. */ - /* */ /* user :: A typeless pointer which is passed to each */ /* emitter during the decomposition. It can be */ /* used to store the state during the */ @@ -1369,15 +1365,10 @@ /* */ static int QT_FT_Outline_Decompose( const QT_FT_Outline* outline, - const QT_FT_Outline_Funcs* func_interface, void* user ) { #undef SCALED -#if 0 -#define SCALED( x ) ( ( (x) << shift ) - delta ) -#else #define SCALED( x ) (x) -#endif QT_FT_Vector v_last; QT_FT_Vector v_control; @@ -1392,12 +1383,6 @@ int error; char tag; /* current point's state */ -#if 0 - int shift = func_interface->shift; - TPos delta = func_interface->delta; -#endif - - first = 0; for ( n = 0; n < outline->n_contours; n++ ) @@ -1451,7 +1436,7 @@ tags--; } - error = func_interface->move_to( &v_start, user ); + error = gray_move_to( &v_start, user ); if ( error ) goto Exit; @@ -1471,7 +1456,7 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->line_to( &vec, user ); + error = gray_line_to( &vec, user ); if ( error ) goto Exit; continue; @@ -1498,7 +1483,7 @@ if ( tag == QT_FT_CURVE_TAG_ON ) { - error = func_interface->conic_to( &v_control, &vec, + error = gray_conic_to( &v_control, &vec, user ); if ( error ) goto Exit; @@ -1511,7 +1496,7 @@ v_middle.x = ( v_control.x + vec.x ) / 2; v_middle.y = ( v_control.y + vec.y ) / 2; - error = func_interface->conic_to( &v_control, &v_middle, + error = gray_conic_to( &v_control, &v_middle, user ); if ( error ) goto Exit; @@ -1520,7 +1505,7 @@ goto Do_Conic; } - error = func_interface->conic_to( &v_control, &v_start, + error = gray_conic_to( &v_control, &v_start, user ); goto Close; } @@ -1551,20 +1536,20 @@ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - error = func_interface->cubic_to( &vec1, &vec2, &vec, user ); + error = gray_cubic_to( &vec1, &vec2, &vec, user ); if ( error ) goto Exit; continue; } - error = func_interface->cubic_to( &vec1, &vec2, &v_start, user ); + error = gray_cubic_to( &vec1, &vec2, &v_start, user ); goto Close; } } } /* close the contour with a line segment */ - error = func_interface->line_to( &v_start, user ); + error = gray_line_to( &v_start, user ); Close: if ( error ) @@ -1592,22 +1577,11 @@ static int gray_convert_glyph_inner( RAS_ARG ) { - static - const QT_FT_Outline_Funcs func_interface = - { - (QT_FT_Outline_MoveTo_Func) gray_move_to, - (QT_FT_Outline_LineTo_Func) gray_line_to, - (QT_FT_Outline_ConicTo_Func)gray_conic_to, - (QT_FT_Outline_CubicTo_Func)gray_cubic_to, - 0, - 0 - }; - volatile int error = 0; if ( qt_ft_setjmp( ras.jump_buffer ) == 0 ) { - error = QT_FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); + error = QT_FT_Outline_Decompose( &ras.outline, &ras ); gray_record_cell( RAS_VAR ); } else diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index e521e018c3..fecf25f4a4 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -696,10 +696,11 @@ void QX11PaintEngine::drawLines(const QLine *lines, int lineCount) linef = d->matrix.map(QLineF(lines[i])); } if (clipLine(&linef, d->polygonClipper.boundingRect())) { - int x1 = qFloor(linef.x1() + aliasedCoordinateDelta); - int y1 = qFloor(linef.y1() + aliasedCoordinateDelta); - int x2 = qFloor(linef.x2() + aliasedCoordinateDelta); - int y2 = qFloor(linef.y2() + aliasedCoordinateDelta); + int x1 = qRound(linef.x1() + aliasedCoordinateDelta); + int y1 = qRound(linef.y1() + aliasedCoordinateDelta); + int x2 = qRound(linef.x2() + aliasedCoordinateDelta); + int y2 = qRound(linef.y2() + aliasedCoordinateDelta); + XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2); } } @@ -729,10 +730,11 @@ void QX11PaintEngine::drawLines(const QLineF *lines, int lineCount) for (int i = 0; i < lineCount; ++i) { QLineF linef = d->matrix.map(lines[i]); if (clipLine(&linef, d->polygonClipper.boundingRect())) { - int x1 = qFloor(linef.x1() + aliasedCoordinateDelta); - int y1 = qFloor(linef.y1() + aliasedCoordinateDelta); - int x2 = qFloor(linef.x2() + aliasedCoordinateDelta); - int y2 = qFloor(linef.y2() + aliasedCoordinateDelta); + int x1 = qRound(linef.x1() + aliasedCoordinateDelta); + int y1 = qRound(linef.y1() + aliasedCoordinateDelta); + int x2 = qRound(linef.x2() + aliasedCoordinateDelta); + int y2 = qRound(linef.y2() + aliasedCoordinateDelta); + XDrawLine(d->dpy, d->hd, d->gc, x1, y1, x2, y2); } } @@ -1688,8 +1690,8 @@ void QX11PaintEnginePrivate::strokePolygon_dev(const QPointF *polygonPoints, int if (clippedCount > 0) { QVarLengthArray<XPoint> xpoints(clippedCount); for (int i = 0; i < clippedCount; ++i) { - xpoints[i].x = qFloor(clippedPoints[i].x + aliasedCoordinateDelta); - xpoints[i].y = qFloor(clippedPoints[i].y + aliasedCoordinateDelta); + xpoints[i].x = qRound(clippedPoints[i].x + aliasedCoordinateDelta); + xpoints[i].y = qRound(clippedPoints[i].y + aliasedCoordinateDelta); } uint numberPoints = qMin(clippedCount, xlibMaxLinePoints); XPoint *pts = xpoints.data(); @@ -1914,6 +1916,8 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect int sh = qRound(sr.height()); QPixmap pixmap = qt_toX11Pixmap(px); + if(pixmap.isNull()) + return; if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen()) || (pixmap.x11Info().screen() != DefaultScreen(X11->display))) { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b694d9cba9..be900060b8 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5862,10 +5862,13 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText return; } - if (d->extended->type() == QPaintEngine::OpenGL2 && !staticText_d->untransformedCoordinates) { + bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2 + || d->extended->type() == QPaintEngine::OpenVG; + + if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = true; staticText_d->needsRelayout = true; - } else if (d->extended->type() != QPaintEngine::OpenGL2 && staticText_d->untransformedCoordinates) { + } else if (!paintEngineSupportsTransformations && staticText_d->untransformedCoordinates) { staticText_d->untransformedCoordinates = false; staticText_d->needsRelayout = true; } diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index a816ed21c4..170668b969 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -882,7 +882,11 @@ void QWSMemorySurface::beginPaint(const QRegion &rgn) const QVector<QRect> rects = rgn.rects(); const QColor blank = Qt::transparent; for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); + QRect r = *it; +#ifdef Q_BACKINGSTORE_SUBSURFACES + r.translate(painterOffset()); +#endif + p.fillRect(r, blank); } } QWSWindowSurface::beginPaint(rgn); diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 3d34687016..5fe0c0cee0 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1101,14 +1101,6 @@ void QTextControl::processEvent(QEvent *e, const QMatrix &matrix, QWidget *conte } } break; - case QEvent::LayoutDirectionChange: { - if (contextWidget) { - QTextOption opt = document()->defaultTextOption(); - opt.setTextDirection(contextWidget->layoutDirection()); - document()->setDefaultTextOption(opt); - } - } - // FALL THROUGH default: break; } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 5670e29608..8d6dd6ced6 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1561,14 +1561,19 @@ bool QTextEngine::isRightToLeft() const int QTextEngine::findItem(int strPos) const { itemize(); - - // ##### use binary search - int item; - for (item = layoutData->items.size()-1; item > 0; --item) { - if (layoutData->items[item].position <= strPos) - break; + int left = 0; + int right = layoutData->items.size()-1; + while(left <= right) { + int middle = ((right-left)/2)+left; + if (strPos > layoutData->items[middle].position) + left = middle+1; + else if(strPos < layoutData->items[middle].position) + right = middle-1; + else { + return middle; + } } - return item; + return right; } QFixed QTextEngine::width(int from, int len) const diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7d5fa435d0..f432b7e629 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1217,7 +1217,7 @@ void QTextLayout::draw(QPainter *p, const QPointF &pos, const QVector<FormatRang bool hasText = (selection.format.foreground().style() != Qt::NoBrush); bool hasBackground= (selection.format.background().style() != Qt::NoBrush); - + if (hasBackground) { selection.format.setProperty(ObjectSelectionBrush, selection.format.property(QTextFormat::BackgroundBrush)); // don't just clear the property, set an empty brush that overrides a potential @@ -1731,7 +1731,7 @@ namespace { }; inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line) -{ +{ LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal()); QFixed newWidth = calculateNewWidth(line); @@ -1797,13 +1797,23 @@ void QTextLine::layout_helper(int maxGlyphs) bool breakany = (wrapMode == QTextOption::WrapAnywhere); lbh.manualWrap = (wrapMode == QTextOption::ManualWrap || wrapMode == QTextOption::NoWrap); - // #### binary search! int item = -1; - int newItem; - for (newItem = eng->layoutData->items.size()-1; newItem > 0; --newItem) { - if (eng->layoutData->items[newItem].position <= line.from) + int newItem = -1; + int left = 0; + int right = eng->layoutData->items.size()-1; + while(left <= right) { + int middle = ((right-left)/2)+left; + if (line.from > eng->layoutData->items[middle].position) + left = middle+1; + else if(line.from < eng->layoutData->items[middle].position) + right = middle-1; + else { + newItem = middle; break; + } } + if (newItem == -1) + newItem = right; LB_DEBUG("from: %d: item=%d, total %d, width available %f", line.from, newItem, eng->layoutData->items.size(), line.width.toReal()); @@ -1975,7 +1985,7 @@ void QTextLine::layout_helper(int maxGlyphs) } LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); -found: +found: if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); line.textAdvance = line.textWidth; diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 5fb3384d51..d25fb057c6 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1156,6 +1156,10 @@ Qt::LayoutDirection QTextBlock::textDirection() const if (dir != Qt::LayoutDirectionAuto) return dir; + dir = p->defaultTextOption.textDirection(); + if (dir != Qt::LayoutDirectionAuto) + return dir; + const QString buffer = p->buffer(); const int pos = position(); diff --git a/src/gui/widgets/qdatetimeedit.h b/src/gui/widgets/qdatetimeedit.h index 81bbdb91c6..d2f315a41d 100644 --- a/src/gui/widgets/qdatetimeedit.h +++ b/src/gui/widgets/qdatetimeedit.h @@ -206,7 +206,6 @@ private: class Q_GUI_EXPORT QTimeEdit : public QDateTimeEdit { Q_OBJECT - Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true) public: QTimeEdit(QWidget *parent = 0); QTimeEdit(const QTime &time, QWidget *parent = 0); @@ -215,7 +214,6 @@ public: class Q_GUI_EXPORT QDateEdit : public QDateTimeEdit { Q_OBJECT - Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true) public: QDateEdit(QWidget *parent = 0); QDateEdit(const QDate &date, QWidget *parent = 0); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index d3f6a295e4..18192e3073 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -90,7 +90,10 @@ QT_BEGIN_NAMESPACE -//#define QT_GL_NO_SCISSOR_TEST +#if defined(Q_OS_SYMBIAN) +#define QT_GL_NO_SCISSOR_TEST +#endif + #if defined(Q_WS_WIN) extern Q_GUI_EXPORT bool qt_cleartype_enabled; #endif @@ -374,12 +377,12 @@ void QGL2PaintEngineExPrivate::updateMatrix() dx = ceilf(dx - 0.5f); dy = ceilf(dy - 0.5f); } - +#ifndef Q_OS_SYMBIAN if (addOffset) { dx += 0.49f; dy += 0.49f; } - +#endif pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13(); pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23(); pmvMatrix[2][0] = (wfactor * dx) - transform.m33(); @@ -686,7 +689,12 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); // ### Remove before release... - static bool do_vectorpath_cache = qgetenv("QT_OPENGL_NO_PATH_CACHE").isEmpty(); +#ifdef Q_OS_SYMBIAN + // ### There are some unresolved issues in Symbian vector path caching. + static bool do_vectorpath_cache = false; +#else + static bool do_vectorpath_cache = true; +#endif // Check to see if there's any hints if (path.shape() == QVectorPath::RectangleHint) { diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index df7cbc2f3f..f14b0a45d8 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -65,7 +65,11 @@ QT_BEGIN_NAMESPACE // Quick sort. template <class T, class LessThan> +#ifdef Q_CC_RVCT // RVCT 2.2 doesn't see recursive _static_ template function +void sort(T *array, int count, LessThan lessThan) +#else static void sort(T *array, int count, LessThan lessThan) +#endif { // If the number of elements fall below some threshold, use insertion sort. const int INSERTION_SORT_LIMIT = 7; // About 7 is fastest on my computer... @@ -122,7 +126,11 @@ sort_loop_end: // Quick sort. template <class T> +#ifdef Q_CC_RVCT +void sort(T *array, int count) // RVCT 2.2 doesn't see recursive _static_ template function +#else static void sort(T *array, int count) +#endif { // If the number of elements fall below some threshold, use insertion sort. const int INSERTION_SORT_LIMIT = 25; // About 25 is fastest on my computer... diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index d6011cf2f9..0e82467a0a 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -11,18 +11,18 @@ unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui include(../qbase.pri) -!win32:!embedded:!mac:CONFIG += x11 +!win32:!embedded:!mac:!symbian:CONFIG += x11 contains(QT_CONFIG, opengl):CONFIG += opengl contains(QT_CONFIG, opengles1):CONFIG += opengles1 contains(QT_CONFIG, opengles2):CONFIG += opengles2 contains(QT_CONFIG, egl):CONFIG += egl HEADERS += qgl.h \ - qgl_p.h \ - qglcolormap.h \ - qglpixelbuffer.h \ + qgl_p.h \ + qglcolormap.h \ + qglpixelbuffer.h \ qglpixelbuffer_p.h \ - qglframebufferobject.h \ + qglframebufferobject.h \ qglframebufferobject_p.h \ qglextensions_p.h \ qglpaintdevice_p.h \ @@ -30,9 +30,9 @@ HEADERS += qgl.h \ SOURCES += qgl.cpp \ - qglcolormap.cpp \ - qglpixelbuffer.cpp \ - qglframebufferobject.cpp \ + qglcolormap.cpp \ + qglpixelbuffer.cpp \ + qglframebufferobject.cpp \ qglextensions.cpp \ qglpaintdevice.cpp \ qglbuffer.cpp \ @@ -119,7 +119,7 @@ mac { win32:!wince*: { DEFINES += QT_NO_EGL SOURCES += qgl_win.cpp \ - qglpixelbuffer_win.cpp + qglpixelbuffer_win.cpp } wince*: { SOURCES += qgl_wince.cpp \ @@ -147,4 +147,14 @@ embedded { } } +symbian { + SOURCES += qgl_symbian.cpp \ + qglpixelbuffer_egl.cpp \ + qgl_egl.cpp + + HEADERS += qgl_egl_p.h + + symbian:TARGET.UID3 = 0x2002131A +} + INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 4daa866bd3..9e69816f3d 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -96,7 +96,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs; #endif @@ -1688,6 +1688,10 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) workaround_needsFullClearOnEveryFrame = false; workaround_brokenFBOReadBack = false; workaroundsCached = false; + + workaround_brokenTextureFromPixmap = false; + workaround_brokenTextureFromPixmap_init = false; + for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) vertexAttributeArraysEnabledState[i] = false; } @@ -2260,7 +2264,7 @@ static void convertToGLFormatHelper(QImage &dst, const QImage &img, GLenum textu } } -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) QGLExtensionFuncs& QGLContextPrivate::extensionFuncs(const QGLContext *) { return qt_extensionFuncs; @@ -2283,11 +2287,19 @@ QImage QGLContextPrivate::convertToGLFormat(const QImage &image, bool force_prem QGLTexture *QGLContextPrivate::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options) { + Q_Q(QGLContext); + const qint64 key = image.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); if (texture) { - glBindTexture(target, texture->id); - return texture; + if (image.paintingActive()) { + // A QPainter is active on the image - take the safe route and replace the texture. + q->deleteTexture(texture->id); + texture = 0; + } else { + glBindTexture(target, texture->id); + return texture; + } } if (!texture) @@ -2553,14 +2565,19 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, } #else Q_UNUSED(pd); - Q_UNUSED(q); #endif const qint64 key = pixmap.cacheKey(); QGLTexture *texture = textureCacheLookup(key, target); if (texture) { - glBindTexture(target, texture->id); - return texture; + if (pixmap.paintingActive()) { + // A QPainter is active on the pixmap - take the safe route and replace the texture. + q->deleteTexture(texture->id); + texture = 0; + } else { + glBindTexture(target, texture->id); + return texture; + } } #if defined(Q_WS_X11) @@ -2570,11 +2587,27 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, && xinfo && xinfo->screen() == pixmap.x11Info().screen() && target == GL_TEXTURE_2D) { - texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); - if (texture) { - texture->options |= QGLContext::MemoryManagedBindOption; - texture->boundPixmap = pd; - boundPixmaps.insert(pd, QPixmap(pixmap)); + if (!workaround_brokenTextureFromPixmap_init) { + workaround_brokenTextureFromPixmap_init = true; + + const QByteArray versionString(reinterpret_cast<const char*>(glGetString(GL_VERSION))); + const int pos = versionString.indexOf("NVIDIA "); + + if (pos >= 0) { + const QByteArray nvidiaVersionString = versionString.mid(pos + strlen("NVIDIA ")); + + if (nvidiaVersionString.startsWith("195") || nvidiaVersionString.startsWith("256")) + workaround_brokenTextureFromPixmap = true; + } + } + + if (!workaround_brokenTextureFromPixmap) { + texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); + if (texture) { + texture->options |= QGLContext::MemoryManagedBindOption; + texture->boundPixmap = pd; + boundPixmaps.insert(pd, QPixmap(pixmap)); + } } } #endif @@ -4177,6 +4210,34 @@ bool QGLWidget::event(QEvent *e) d->glcx->d_ptr->clearDrawable(); # endif } +#elif defined(Q_OS_SYMBIAN) + // prevents errors on some systems, where we get a flush to a + // hidden widget + if (e->type() == QEvent::Hide) { + makeCurrent(); + glFinish(); + doneCurrent(); + } else if (e->type() == QEvent::ParentChange) { + // if we've reparented a window that has the current context + // bound, we need to rebind that context to the new window id + if (d->glcx == QGLContext::currentContext()) + makeCurrent(); + + if (testAttribute(Qt::WA_TranslucentBackground)) + setContext(new QGLContext(d->glcx->requestedFormat(), this)); + } + + // A re-parent is likely to destroy the Symbian window and re-create it. It is important + // that we free the EGL surface _before_ the winID changes - otherwise we can leak. + if (e->type() == QEvent::ParentAboutToChange) + d->glcx->d_func()->destroyEglSurfaceForDevice(); + + if ((e->type() == QEvent::ParentChange) || (e->type() == QEvent::WindowStateChange)) { + // The window may have been re-created during re-parent or state change - if so, the EGL + // surface will need to be re-created. + d->recreateEglSurface(); + } + #endif return QWidget::event(e); @@ -4384,6 +4445,11 @@ void QGLWidget::glDraw() Q_D(QGLWidget); if (!isValid()) return; +#ifdef Q_OS_SYMBIAN + // Crashes on Symbian if trying to render to invisible surfaces + if (!isVisible() && d->glcx->device()->devType() == QInternal::Widget) + return; +#endif makeCurrent(); #ifndef QT_OPENGL_ES if (d->glcx->deviceIsPixmap()) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index a154325eab..ebd116909d 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -230,7 +230,7 @@ void QGLContext::swapBuffers() const void QGLContextPrivate::destroyEglSurfaceForDevice() { if (eglSurface != EGL_NO_SURFACE) { -#ifdef Q_WS_X11 +#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) // Make sure we don't call eglDestroySurface on a surface which // was created for a different winId. This applies only to QGLWidget // paint device, so make sure this is the one we're operating on diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 32feacd0b0..387c8f780b 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -167,6 +167,9 @@ public: #if defined(Q_WS_X11) && !defined(QT_NO_EGL) , eglSurfaceWindowId(0) #endif +#if defined(Q_OS_SYMBIAN) + , eglSurfaceWindowId(0) +#endif { isGLWidget = 1; } @@ -208,6 +211,10 @@ public: #elif defined(Q_WS_QWS) QWSGLWindowSurface *wsurf; #endif +#ifdef Q_OS_SYMBIAN + void recreateEglSurface(); + WId eglSurfaceWindowId; +#endif }; class QGLContextResource; @@ -393,6 +400,9 @@ public: uint workaround_brokenFBOReadBack : 1; uint workaroundsCached : 1; + uint workaround_brokenTextureFromPixmap : 1; + uint workaround_brokenTextureFromPixmap_init : 1; + QPaintDevice *paintDevice; QColor transpColor; QGLContext *q_ptr; @@ -414,7 +424,7 @@ public: static inline QGLExtensionFuncs& extensionFuncs(const QGLContext *ctx) { return ctx->d_ptr->group->extensionFuncs(); } #endif -#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) +#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) static QGLExtensionFuncs qt_extensionFuncs; static Q_OPENGL_EXPORT QGLExtensionFuncs& extensionFuncs(const QGLContext *); #endif diff --git a/src/opengl/qgl_symbian.cpp b/src/opengl/qgl_symbian.cpp new file mode 100644 index 0000000000..73fe4c9f77 --- /dev/null +++ b/src/opengl/qgl_symbian.cpp @@ -0,0 +1,362 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenGL 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 Technology Preview License Agreement accompanying +** this package. +** +** 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.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +#include "qgl.h" +#include <coemain.h> +#include <coecntrl.h> +#include <w32std.h> +#include <private/qpixmap_s60_p.h> +#include <private/qimagepixmapcleanuphooks_p.h> +#include <private/qgl_p.h> +#include <private/qpaintengine_opengl_p.h> +#include <private/qwidget_p.h> // to access QWExtra +#include "qgl_egl_p.h" +#include "qcolormap.h" +#include <QDebug> + +QT_BEGIN_NAMESPACE + +// Turn off "direct to window" rendering if EGL cannot support it. +#if !defined(EGL_RENDER_BUFFER) || !defined(EGL_SINGLE_BUFFER) +#if defined(QGL_DIRECT_TO_WINDOW) +#undef QGL_DIRECT_TO_WINDOW +#endif +#endif + +// Determine if preserved window contents should be used. +#if !defined(EGL_SWAP_BEHAVIOR) || !defined(EGL_BUFFER_PRESERVED) +#if !defined(QGL_NO_PRESERVED_SWAP) +#define QGL_NO_PRESERVED_SWAP 1 +#endif +#endif + +/* + QGLTemporaryContext implementation +*/ + + +class QGLTemporaryContextPrivate +{ +public: + bool initialized; + RWindow *window; + EGLContext context; + EGLSurface surface; + EGLDisplay display; +}; + +QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *) + : d(new QGLTemporaryContextPrivate) +{ + d->initialized = false; + d->window = 0; + d->context = 0; + d->surface = 0; + + d->display = d->display = QEgl::display(); + + EGLConfig config; + int numConfigs = 0; + EGLint attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, +#ifdef QT_OPENGL_ES_2 + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, +#endif + EGL_NONE + }; + + eglChooseConfig(d->display, attribs, &config, 1, &numConfigs); + if (!numConfigs) { + qWarning("QGLTemporaryContext: No EGL configurations available."); + return; + } + + d->window = new RWindow(CCoeEnv::Static()->WsSession()); + d->window->Construct(CCoeEnv::Static()->RootWin(),(uint)this); + + d->surface = eglCreateWindowSurface(d->display, config, (EGLNativeWindowType) d->window, NULL); + + if (d->surface == EGL_NO_SURFACE) { + qWarning("QGLTemporaryContext: Error creating EGL surface."); + delete d->window; + d->window = 0; + return; + } + + EGLint contextAttribs[] = { +#ifdef QT_OPENGL_ES_2 + EGL_CONTEXT_CLIENT_VERSION, 2, +#endif + EGL_NONE + }; + d->context = eglCreateContext(d->display, config, 0, contextAttribs); + if (d->context != EGL_NO_CONTEXT + && eglMakeCurrent(d->display, d->surface, d->surface, d->context)) + { + d->initialized = true; + } else { + qWarning("QGLTemporaryContext: Error creating EGL context."); + d->window = 0; + return; + } +} + +QGLTemporaryContext::~QGLTemporaryContext() +{ + if (d->initialized) { + eglMakeCurrent(d->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglDestroyContext(d->display, d->context); + eglDestroySurface(d->display, d->surface); + delete d->window; + } +} + +bool QGLFormat::hasOpenGLOverlays() +{ + return false; +} + +// Chooses the EGL config and creates the EGL context +bool QGLContext::chooseContext(const QGLContext* shareContext) // almost same as in qgl_x11egl.cpp +{ + Q_D(QGLContext); + + if (!device()) + return false; + + int devType = device()->devType(); + + if ((devType != QInternal::Widget) && (devType != QInternal::Pbuffer)) { + qWarning("WARNING: Creating a QGLContext not supported on device type %d", devType); + return false; + } + + // Get the display and initialize it. + if (d->eglContext == 0) { + d->eglContext = new QEglContext(); + d->ownsEglContext = true; + d->eglContext->setApi(QEgl::OpenGL); + + // If the device is a widget with WA_TranslucentBackground set, make sure the glFormat + // has the alpha channel option set: + if (devType == QInternal::Widget) { + QWidget* widget = static_cast<QWidget*>(device()); + if (widget->testAttribute(Qt::WA_TranslucentBackground)) + d->glFormat.setAlpha(true); + } + + // Construct the configuration we need for this surface. + QEglProperties configProps; + configProps.setDeviceType(devType); + configProps.setPaintDeviceFormat(device()); + configProps.setRenderableType(QEgl::OpenGL); + configProps.setValue(EGL_SURFACE_TYPE, EGL_WINDOW_BIT|EGL_SWAP_BEHAVIOR_PRESERVED_BIT); + + qt_eglproperties_set_glformat(configProps, d->glFormat); + + if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) { + delete d->eglContext; + d->eglContext = 0; + return false; + } + + // Create a new context for the configuration. + QEglContext* eglSharedContext = shareContext ? shareContext->d_func()->eglContext : 0; + if (!d->eglContext->createContext(eglSharedContext)) { + delete d->eglContext; + d->eglContext = 0; + return false; + } + d->sharing = d->eglContext->isSharing(); + if (d->sharing && shareContext) + const_cast<QGLContext *>(shareContext)->d_func()->sharing = true; + } + + // Inform the higher layers about the actual format properties + qt_glformat_from_eglconfig(d->glFormat, d->eglContext->config()); + + // Do don't create the EGLSurface for everything. + // QWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface + // QGLWidget - yes, create the EGLSurface and store it in QGLContextPrivate::eglSurface + // QGLPixelBuffer - no, it creates the surface itself and stores it in QGLPixelBufferPrivate::pbuf + + if (devType == QInternal::Widget) { + if (d->eglSurface != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglSurface); + + d->eglSurface = QEgl::createSurface(device(), d->eglContext->config()); + +#if !defined(QGL_NO_PRESERVED_SWAP) + eglGetError(); // Clear error state first. + eglSurfaceAttrib(QEgl::display(), d->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (eglGetError() != EGL_SUCCESS) { + qWarning("QGLContext: could not enable preserved swap"); + } +#endif + + setWindowCreated(true); + } + + return true; +} + +void QGLWidget::resizeEvent(QResizeEvent *) +{ + Q_D(QGLWidget); + if (!isValid()) + return; + + if (QGLContext::currentContext()) + doneCurrent(); + + // Symbian needs to recreate the surface on resize. + d->recreateEglSurface(); + + makeCurrent(); + if (!d->glcx->initialized()) + glInit(); + resizeGL(width(), height()); + //handle overlay +} + +const QGLContext* QGLWidget::overlayContext() const +{ + return 0; +} + +void QGLWidget::makeOverlayCurrent() +{ + //handle overlay +} + +void QGLWidget::updateOverlayGL() +{ + //handle overlay +} + +void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext, bool deleteOldContext) +{ + Q_D(QGLWidget); + if (context == 0) { + qWarning("QGLWidget::setContext: Cannot set null context"); + return; + } + if (!context->deviceIsPixmap() && context->device() != this) { + qWarning("QGLWidget::setContext: Context must refer to this widget"); + return; + } + + if (d->glcx) + d->glcx->doneCurrent(); + QGLContext* oldcx = d->glcx; + d->glcx = context; + + bool createFailed = false; + if (!d->glcx->isValid()) { + // Create the QGLContext here, which in turn chooses the EGL config + // and creates the EGL context: + if (!d->glcx->create(shareContext ? shareContext : oldcx)) + createFailed = true; + } + if (createFailed) { + if (deleteOldContext) + delete oldcx; + return; + } + + d->eglSurfaceWindowId = winId(); // Remember the window id we created the surface for +} + +void QGLWidgetPrivate::init(QGLContext *context, const QGLWidget* shareWidget) +{ + Q_Q(QGLWidget); + + initContext(context, shareWidget); + + if(q->isValid() && glcx->format().hasOverlay()) { + //no overlay + qWarning("QtOpenGL ES doesn't currently support overlays"); + } +} + +void QGLWidgetPrivate::cleanupColormaps() +{ +} + +const QGLColormap & QGLWidget::colormap() const +{ + return d_func()->cmap; +} + +void QGLWidget::setColormap(const QGLColormap &) +{ +} + +void QGLWidgetPrivate::recreateEglSurface() +{ + Q_Q(QGLWidget); + + WId currentId = q->winId(); + + if (glcx->d_func()->eglSurface != EGL_NO_SURFACE) { + eglDestroySurface(glcx->d_func()->eglContext->display(), + glcx->d_func()->eglSurface); + } + + glcx->d_func()->eglSurface = QEgl::createSurface(glcx->device(), + glcx->d_func()->eglContext->config()); + +#if !defined(QGL_NO_PRESERVED_SWAP) + eglGetError(); // Clear error state first. + eglSurfaceAttrib(QEgl::display(), glcx->d_func()->eglSurface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (eglGetError() != EGL_SUCCESS) { + qWarning("QGLContext: could not enable preserved swap"); + } +#endif + + eglSurfaceWindowId = currentId; +} + +QT_END_NAMESPACE + diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 653e8054af..1efd3982e3 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -367,7 +367,7 @@ void QGLPixmapData::ensureCreated() const } void QGLPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags /*flags*/) + Qt::ImageConversionFlags flags) { if (image.size() == QSize(w, h)) setSerialNumber(++qt_gl_pixmap_serial); @@ -381,7 +381,9 @@ void QGLPixmapData::fromImage(const QImage &image, if (qApp->desktop()->depth() == 16) format = QImage::Format_RGB16; - if (image.hasAlphaChannel() && const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels()) + if (image.hasAlphaChannel() + && ((flags & Qt::NoOpaqueDetection) + || const_cast<QImage &>(image).data_ptr()->checkForAlphaPixels())) format = QImage::Format_ARGB32_Premultiplied;; m_source = image.convertToFormat(format); diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro index 6d8f7f2572..bbe8ab19c2 100644 --- a/src/plugins/bearer/bearer.pro +++ b/src/plugins/bearer/bearer.pro @@ -5,7 +5,7 @@ contains(QT_CONFIG, dbus) { SUBDIRS += icd } else { SUBDIRS += generic - !mac:SUBDIRS += connman networkmanager + linux*:SUBDIRS += connman networkmanager } } diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 3b5ae86b5f..341f7cda2a 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -328,7 +328,6 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) void QConnmanEngine::propertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { Q_UNUSED(path); -// qDebug() << __FUNCTION__ << path << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Services") { @@ -380,12 +379,10 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { QMutexLocker locker(&mutex); -// qDebug() << __FUNCTION__ << path << item << value.variant(); } void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value) { -// qDebug() << __FUNCTION__ << devpath << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Networks") { @@ -429,7 +426,6 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) { -// qDebug() << __FUNCTION__ << path << item << value.variant(); if(item == "Devices") { QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); QStringList list = qdbus_cast<QStringList>(arg); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index eb8831700b..3722c43287 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -481,9 +481,7 @@ QVariant QConnmanProfileInterface::getProperty(const QString &property) QVariantMap map = getProperties(); if (map.contains(property)) { var = map.value(property); - } else { - qDebug() <<__FUNCTION__<< "Could not find" << property; - } + } return var; } @@ -522,8 +520,6 @@ QConnmanServiceInterface::~QConnmanServiceInterface() void QConnmanServiceInterface::connectNotify(const char *signal) { -// qWarning() << __FUNCTION__ << signal << this->path(); - if (QLatin1String(signal) == SIGNAL(propertyChanged(QString,QDBusVariant))) { dbusConnection.connect(QLatin1String(CONNMAN_SERVICE), this->path(), @@ -569,9 +565,7 @@ QVariant QConnmanServiceInterface::getProperty(const QString &property) QVariantMap map = getProperties(); if (map.contains(property)) { var = map.value(property); - } else { -// qDebug() <<__FUNCTION__<< "Could not find" << property; - } + } return var; } @@ -1051,15 +1045,7 @@ QVariantMap QConnmanDeviceInterface::getProperties() bool QConnmanDeviceInterface::setProperty(const QString &name, const QDBusVariant &value) { - -// QList<QVariant> args; - qWarning() << __FUNCTION__ << name << value.variant(); -// args << qVariantFromValue(name); -// args << qVariantFromValue(value); - QDBusMessage reply = this->call(QLatin1String("SetProperty"),name, qVariantFromValue(value)); -qWarning() << reply.errorMessage(); - return true; } @@ -1148,7 +1134,6 @@ bool QConnmanDeviceInterface::setEnabled(bool powered) << qVariantFromValue(QDBusVariant(powered)); QDBusMessage reply = this->callWithArgumentList(QDBus::AutoDetect,QLatin1String("SetProperty"),args); - qWarning() << reply.errorMessage() << reply.errorName(); return true; } @@ -1164,8 +1149,6 @@ QConnmanDBusHelper::~QConnmanDBusHelper() void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant &var) { QDBusMessage msg = this->message(); -// qWarning() << sender(); - // qWarning() << msg.interface() << msg.path() << item << var.variant() <<"\n"; Q_EMIT propertyChangedContext(msg.path() ,item, var); } diff --git a/src/plugins/graphicssystems/opengl/opengl.pro b/src/plugins/graphicssystems/opengl/opengl.pro index 7d6fe3f997..47e15c5ec5 100644 --- a/src/plugins/graphicssystems/opengl/opengl.pro +++ b/src/plugins/graphicssystems/opengl/opengl.pro @@ -9,3 +9,5 @@ SOURCES = main.cpp target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems INSTALLS += target + +symbian: TARGET.UID3 = 0x2002131B diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby index 935bdc5e33..b6cdce915a 100644 --- a/src/s60installs/qt.iby +++ b/src/s60installs/qt.iby @@ -20,6 +20,7 @@ file=ABI_DIR\BUILD_DIR\phonon.dll SHARED_LIB_DIR\phonon.dll file=ABI_DIR\BUILD_DIR\QtMultimedia.dll SHARED_LIB_DIR\QtMultimedia.dll file=ABI_DIR\BUILD_DIR\QtXmlPatterns.dll SHARED_LIB_DIR\QtXmlPatterns.dll file=ABI_DIR\BUILD_DIR\QtDeclarative.dll SHARED_LIB_DIR\QtDeclarative.dll +file=ABI_DIR\BUILD_DIR\QtOpenGL.dll SHARED_LIB_DIR\QtOpenGL.dll // imageformats file=ABI_DIR\BUILD_DIR\qgif.dll SHARED_LIB_DIR\qgif.dll @@ -50,6 +51,7 @@ file=ABI_DIR\BUILD_DIR\qaudio.dll SHARED_LIB_DIR\qaudio.dll // graphicssystems file=ABI_DIR\BUILD_DIR\qvggraphicssystem.dll SHARED_LIB_DIR\qvggraphicssystem.dll +file=ABI_DIR\BUILD_DIR\qglgraphicssystem.dll SHARED_LIB_DIR\qglgraphicssystem.dll // S60 version compatibility plugins for 5.0 (3.1 and 3.2 devices are never likely to have this in ROM, // so don't bother including those plugins @@ -95,6 +97,7 @@ data=\epoc32\data\qt\qtlibspluginstubs\qaudio.qtplugin resource\qt\plugins\audio // graphicssystems data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin +data=\epoc32\data\z\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin // Stub sis file data=ZSYSTEM\install\qt_stub.sis System\Install\qt_stub.sis diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 8a8167b4eb..9e1d582ea0 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -189,6 +189,11 @@ symbian: { "[0x1028315F],0,0,0,{\"S60ProductID\"}" } + contains(QT_CONFIG, opengl) { + qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtOpenGL$${QT_LIBINFIX}.dll + graphicssystems_plugins.sources += $$QT_BUILD_TREE/plugins/graphicssystems/qglgraphicssystem$${QT_LIBINFIX}.dll + } + contains(QT_CONFIG, multimedia){ qtlibraries.sources += $$QMAKE_LIBDIR_QT/QtMultimedia$${QT_LIBINFIX}.dll } diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 9a982d087a..c3bbba1af1 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -483,54 +483,6 @@ void Generator::generateFunctions(QList<FunctionDef>& list, const char *functype void Generator::generateProperties() { // - // specify get function, for compatibiliy we accept functions - // returning pointers, or const char * for QByteArray. - // - for (int i = 0; i < cdef->propertyList.count(); ++i) { - PropertyDef &p = cdef->propertyList[i]; - if (p.read.isEmpty()) - continue; - for (int j = 0; j < cdef->publicList.count(); ++j) { - const FunctionDef &f = cdef->publicList.at(j); - if (f.name != p.read) - continue; - if (!f.isConst) // get functions must be const - continue; - if (f.arguments.size()) // and must not take any arguments - continue; - PropertyDef::Specification spec = PropertyDef::ValueSpec; - QByteArray tmp = f.normalizedType; - if (p.type == "QByteArray" && tmp == "const char *") - tmp = "QByteArray"; - if (tmp.left(6) == "const ") - tmp = tmp.mid(6); - if (p.type != tmp && tmp.endsWith('*')) { - tmp.chop(1); - spec = PropertyDef::PointerSpec; - } else if (f.type.name.endsWith('&')) { // raw type, not normalized type - spec = PropertyDef::ReferenceSpec; - } - if (p.type != tmp) - continue; - p.gspec = spec; - break; - } - if(!p.notify.isEmpty()) { - int notifyId = -1; - for (int j = 0; j < cdef->signalList.count(); ++j) { - const FunctionDef &f = cdef->signalList.at(j); - if(f.name != p.notify) { - continue; - } else { - notifyId = j /* Signal indexes start from 0 */; - break; - } - } - p.notifyId = notifyId; - } - } - - // // Create meta data // diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index ac49d65164..2c24165537 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -727,6 +727,7 @@ void Moc::parse() error("Class declarations lacks Q_OBJECT macro."); checkSuperClasses(&def); + checkProperties(&def); classList += def; knownQObjectClasses.insert(def.classname); @@ -1312,5 +1313,62 @@ void Moc::checkSuperClasses(ClassDef *def) } } +void Moc::checkProperties(ClassDef *cdef) +{ + // + // specify get function, for compatibiliy we accept functions + // returning pointers, or const char * for QByteArray. + // + for (int i = 0; i < cdef->propertyList.count(); ++i) { + PropertyDef &p = cdef->propertyList[i]; + if (p.read.isEmpty()) + continue; + for (int j = 0; j < cdef->publicList.count(); ++j) { + const FunctionDef &f = cdef->publicList.at(j); + if (f.name != p.read) + continue; + if (!f.isConst) // get functions must be const + continue; + if (f.arguments.size()) // and must not take any arguments + continue; + PropertyDef::Specification spec = PropertyDef::ValueSpec; + QByteArray tmp = f.normalizedType; + if (p.type == "QByteArray" && tmp == "const char *") + tmp = "QByteArray"; + if (tmp.left(6) == "const ") + tmp = tmp.mid(6); + if (p.type != tmp && tmp.endsWith('*')) { + tmp.chop(1); + spec = PropertyDef::PointerSpec; + } else if (f.type.name.endsWith('&')) { // raw type, not normalized type + spec = PropertyDef::ReferenceSpec; + } + if (p.type != tmp) + continue; + p.gspec = spec; + break; + } + if(!p.notify.isEmpty()) { + int notifyId = -1; + for (int j = 0; j < cdef->signalList.count(); ++j) { + const FunctionDef &f = cdef->signalList.at(j); + if(f.name != p.notify) { + continue; + } else { + notifyId = j /* Signal indexes start from 0 */; + break; + } + } + p.notifyId = notifyId; + if (notifyId == -1) { + QByteArray msg = "NOTIFY signal '" + p.notify + "' of property '" + p.name + + "' does not exist in class " + cdef->classname + "."; + error(msg.constData()); + } + } + } +} + + QT_END_NAMESPACE diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 9f349b530e..5e47d9afe3 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -238,6 +238,7 @@ public: bool testFunctionAttribute(Token tok, FunctionDef *def); void checkSuperClasses(ClassDef *def); + void checkProperties(ClassDef* cdef); }; inline QByteArray noRef(const QByteArray &type) |