Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: tests/auto/qml/qml.pro tools/qmlprofiler/qmlprofilerclient.cpp Change-Id: Id47f15a5ab38f8ec79f0a26c92805acba62caac4
This commit is contained in:
commit
3832b1e05b
|
@ -374,6 +374,7 @@ void QQuickAnimatedSprite::stop()
|
||||||
return;
|
return;
|
||||||
m_pauseOffset = 0;
|
m_pauseOffset = 0;
|
||||||
emit runningChanged(false);
|
emit runningChanged(false);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -391,6 +392,7 @@ void QQuickAnimatedSprite::advance(int frames)
|
||||||
m_curFrame += m_spriteEngine->maxFrames();
|
m_curFrame += m_spriteEngine->maxFrames();
|
||||||
m_curFrame = m_curFrame % m_spriteEngine->maxFrames();
|
m_curFrame = m_curFrame % m_spriteEngine->maxFrames();
|
||||||
emit currentFrameChanged(m_curFrame);
|
emit currentFrameChanged(m_curFrame);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -408,6 +410,7 @@ void QQuickAnimatedSprite::pause()
|
||||||
m_pauseOffset = m_timestamp.elapsed();
|
m_pauseOffset = m_timestamp.elapsed();
|
||||||
m_paused = true;
|
m_paused = true;
|
||||||
emit pausedChanged(true);
|
emit pausedChanged(true);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -425,6 +428,7 @@ void QQuickAnimatedSprite::resume()
|
||||||
m_pauseOffset = m_pauseOffset - m_timestamp.elapsed();
|
m_pauseOffset = m_pauseOffset - m_timestamp.elapsed();
|
||||||
m_paused = false;
|
m_paused = false;
|
||||||
emit pausedChanged(false);
|
emit pausedChanged(false);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickAnimatedSprite::createEngine()
|
void QQuickAnimatedSprite::createEngine()
|
||||||
|
@ -436,6 +440,7 @@ void QQuickAnimatedSprite::createEngine()
|
||||||
m_spriteEngine = new QQuickSpriteEngine(QList<QQuickSprite*>(spriteList), this);
|
m_spriteEngine = new QQuickSpriteEngine(QList<QQuickSprite*>(spriteList), this);
|
||||||
m_spriteEngine->startAssemblingImage();
|
m_spriteEngine->startAssemblingImage();
|
||||||
reset();
|
reset();
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QSGGeometry::Attribute AnimatedSprite_Attributes[] = {
|
static QSGGeometry::Attribute AnimatedSprite_Attributes[] = {
|
||||||
|
@ -555,9 +560,12 @@ QSGNode *QQuickAnimatedSprite::updatePaintNode(QSGNode *, UpdatePaintNodeData *)
|
||||||
prepareNextFrame();
|
prepareNextFrame();
|
||||||
|
|
||||||
if (m_running) {
|
if (m_running) {
|
||||||
update();
|
if (!m_paused)
|
||||||
if (m_node)
|
update();
|
||||||
|
|
||||||
|
if (m_node) {
|
||||||
m_node->markDirty(QSGNode::DirtyMaterial);
|
m_node->markDirty(QSGNode::DirtyMaterial);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_node;
|
return m_node;
|
||||||
|
@ -614,12 +622,16 @@ void QQuickAnimatedSprite::prepareNextFrame()
|
||||||
frameAt = 0;
|
frameAt = 0;
|
||||||
m_running = false;
|
m_running = false;
|
||||||
emit runningChanged(false);
|
emit runningChanged(false);
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
frameAt = m_curFrame;
|
frameAt = m_curFrame;
|
||||||
}
|
}
|
||||||
if (m_curFrame != lastFrame && isCurrentFrameChangedConnected())
|
if (m_curFrame != lastFrame) {
|
||||||
emit currentFrameChanged(m_curFrame);
|
if (isCurrentFrameChangedConnected())
|
||||||
|
emit currentFrameChanged(m_curFrame);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
qreal frameCount = m_spriteEngine->spriteFrames();
|
qreal frameCount = m_spriteEngine->spriteFrames();
|
||||||
bool reverse = m_spriteEngine->sprite()->reverse();
|
bool reverse = m_spriteEngine->sprite()->reverse();
|
||||||
|
|
|
@ -344,6 +344,7 @@ public Q_SLOTS:
|
||||||
if (m_curFrame != arg) {
|
if (m_curFrame != arg) {
|
||||||
m_curFrame = arg;
|
m_curFrame = arg;
|
||||||
Q_EMIT currentFrameChanged(arg); //TODO-C Only emitted on manual advance!
|
Q_EMIT currentFrameChanged(arg); //TODO-C Only emitted on manual advance!
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,7 +322,7 @@ Item {
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty point QtQuick::WheelEvent::pixelDelta
|
\qmlproperty point QtQuick::WheelEvent::pixelDelta
|
||||||
|
|
||||||
This property holds the delta in screen pixels and is available in plataforms that
|
This property holds the delta in screen pixels and is available in platforms that
|
||||||
have high-resolution trackpads, such as OS X.
|
have high-resolution trackpads, such as OS X.
|
||||||
The x and y cordinate of this property holds the delta in horizontal and
|
The x and y cordinate of this property holds the delta in horizontal and
|
||||||
vertical orientation. The value should be used directly to scroll content on screen.
|
vertical orientation. The value should be used directly to scroll content on screen.
|
||||||
|
|
|
@ -724,6 +724,7 @@ void QQuickKeyNavigationAttached::setFocusNavigation(QQuickItem *currentItem, co
|
||||||
{
|
{
|
||||||
QQuickItem *initialItem = currentItem;
|
QQuickItem *initialItem = currentItem;
|
||||||
bool isNextItem = false;
|
bool isNextItem = false;
|
||||||
|
QVector<QQuickItem *> visitedItems;
|
||||||
do {
|
do {
|
||||||
isNextItem = false;
|
isNextItem = false;
|
||||||
if (currentItem->isVisible() && currentItem->isEnabled()) {
|
if (currentItem->isVisible() && currentItem->isEnabled()) {
|
||||||
|
@ -734,13 +735,14 @@ void QQuickKeyNavigationAttached::setFocusNavigation(QQuickItem *currentItem, co
|
||||||
if (attached) {
|
if (attached) {
|
||||||
QQuickItem *tempItem = qvariant_cast<QQuickItem*>(attached->property(dir));
|
QQuickItem *tempItem = qvariant_cast<QQuickItem*>(attached->property(dir));
|
||||||
if (tempItem) {
|
if (tempItem) {
|
||||||
|
visitedItems.append(currentItem);
|
||||||
currentItem = tempItem;
|
currentItem = tempItem;
|
||||||
isNextItem = true;
|
isNextItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (currentItem != initialItem && isNextItem);
|
while (currentItem != initialItem && isNextItem && !visitedItems.contains(currentItem));
|
||||||
}
|
}
|
||||||
|
|
||||||
struct SigMap {
|
struct SigMap {
|
||||||
|
@ -5918,7 +5920,7 @@ void QQuickItemPrivate::itemChange(QQuickItem::ItemChange change, const QQuickIt
|
||||||
|
|
||||||
In Qt Quick 2.0, this property has minimal impact on performance.
|
In Qt Quick 2.0, this property has minimal impact on performance.
|
||||||
|
|
||||||
By default is true.
|
By default, this property is set to \c true.
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\property QQuickItem::smooth
|
\property QQuickItem::smooth
|
||||||
|
@ -5930,7 +5932,7 @@ void QQuickItemPrivate::itemChange(QQuickItem::ItemChange change, const QQuickIt
|
||||||
|
|
||||||
In Qt Quick 2.0, this property has minimal impact on performance.
|
In Qt Quick 2.0, this property has minimal impact on performance.
|
||||||
|
|
||||||
By default is true.
|
By default, this property is set to \c true.
|
||||||
*/
|
*/
|
||||||
bool QQuickItem::smooth() const
|
bool QQuickItem::smooth() const
|
||||||
{
|
{
|
||||||
|
@ -5952,10 +5954,10 @@ void QQuickItem::setSmooth(bool smooth)
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool QtQuick::Item::activeFocusOnTab
|
\qmlproperty bool QtQuick::Item::activeFocusOnTab
|
||||||
|
|
||||||
This property holds whether the item wants to be in tab focus
|
This property holds whether the item wants to be in the tab focus
|
||||||
chain. By default this is set to false.
|
chain. By default, this is set to \c false.
|
||||||
|
|
||||||
The tab focus chain traverses elements by visiting first the
|
The tab focus chain traverses elements by first visiting the
|
||||||
parent, and then its children in the order they occur in the
|
parent, and then its children in the order they occur in the
|
||||||
children property. Pressing the tab key on an item in the tab
|
children property. Pressing the tab key on an item in the tab
|
||||||
focus chain will move keyboard focus to the next item in the
|
focus chain will move keyboard focus to the next item in the
|
||||||
|
@ -5964,14 +5966,14 @@ void QQuickItem::setSmooth(bool smooth)
|
||||||
|
|
||||||
To set up a manual tab focus chain, see \l KeyNavigation. Tab
|
To set up a manual tab focus chain, see \l KeyNavigation. Tab
|
||||||
key events used by Keys or KeyNavigation have precedence over
|
key events used by Keys or KeyNavigation have precedence over
|
||||||
focus chain behavior, ignore the events in other key handlers
|
focus chain behavior; ignore the events in other key handlers
|
||||||
to allow it to propagate.
|
to allow it to propagate.
|
||||||
*/
|
*/
|
||||||
/*!
|
/*!
|
||||||
\property QQuickItem::activeFocusOnTab
|
\property QQuickItem::activeFocusOnTab
|
||||||
|
|
||||||
This property holds whether the item wants to be in tab focus
|
This property holds whether the item wants to be in the tab focus
|
||||||
chain. By default this is set to false.
|
chain. By default, this is set to \c false.
|
||||||
*/
|
*/
|
||||||
bool QQuickItem::activeFocusOnTab() const
|
bool QQuickItem::activeFocusOnTab() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -350,11 +350,22 @@ uint qHash(const QQuickShaderEffectMaterialKey &key)
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QQuickShaderEffectMaterialCache : public QObject
|
||||||
typedef QHash<QQuickShaderEffectMaterialKey, QWeakPointer<QSGMaterialType> > MaterialHash;
|
{
|
||||||
|
Q_OBJECT
|
||||||
Q_GLOBAL_STATIC(MaterialHash, materialHash)
|
public:
|
||||||
Q_GLOBAL_STATIC(QMutex, materialHashMutex)
|
static QQuickShaderEffectMaterialCache *get(bool create = true) {
|
||||||
|
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||||
|
QQuickShaderEffectMaterialCache *me = ctx->findChild<QQuickShaderEffectMaterialCache *>(QStringLiteral("__qt_ShaderEffectCache"), Qt::FindDirectChildrenOnly);
|
||||||
|
if (!me && create) {
|
||||||
|
me = new QQuickShaderEffectMaterialCache();
|
||||||
|
me->setObjectName(QStringLiteral("__qt_ShaderEffectCache"));
|
||||||
|
me->setParent(ctx);
|
||||||
|
}
|
||||||
|
return me;
|
||||||
|
}
|
||||||
|
QHash<QQuickShaderEffectMaterialKey, QSGMaterialType *> cache;
|
||||||
|
};
|
||||||
|
|
||||||
QQuickShaderEffectMaterial::QQuickShaderEffectMaterial(QQuickShaderEffectNode *node)
|
QQuickShaderEffectMaterial::QQuickShaderEffectMaterial(QQuickShaderEffectNode *node)
|
||||||
: cullMode(NoCulling)
|
: cullMode(NoCulling)
|
||||||
|
@ -367,7 +378,7 @@ QQuickShaderEffectMaterial::QQuickShaderEffectMaterial(QQuickShaderEffectNode *n
|
||||||
|
|
||||||
QSGMaterialType *QQuickShaderEffectMaterial::type() const
|
QSGMaterialType *QQuickShaderEffectMaterial::type() const
|
||||||
{
|
{
|
||||||
return m_type.data();
|
return m_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSGMaterialShader *QQuickShaderEffectMaterial::createShader() const
|
QSGMaterialShader *QQuickShaderEffectMaterial::createShader() const
|
||||||
|
@ -425,30 +436,23 @@ int QQuickShaderEffectMaterial::compare(const QSGMaterial *o) const
|
||||||
|
|
||||||
void QQuickShaderEffectMaterial::setProgramSource(const QQuickShaderEffectMaterialKey &source)
|
void QQuickShaderEffectMaterial::setProgramSource(const QQuickShaderEffectMaterialKey &source)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(materialHashMutex);
|
|
||||||
Q_UNUSED(locker);
|
|
||||||
|
|
||||||
m_source = source;
|
m_source = source;
|
||||||
m_emittedLogChanged = false;
|
m_emittedLogChanged = false;
|
||||||
QWeakPointer<QSGMaterialType> weakPtr = materialHash->value(m_source);
|
|
||||||
m_type = weakPtr.toStrongRef();
|
|
||||||
|
|
||||||
if (m_type.isNull()) {
|
QQuickShaderEffectMaterialCache *cache = QQuickShaderEffectMaterialCache::get();
|
||||||
m_type = QSharedPointer<QSGMaterialType>(new QSGMaterialType);
|
m_type = cache->cache.value(m_source);
|
||||||
materialHash->insert(m_source, m_type.toWeakRef());
|
if (!m_type) {
|
||||||
|
m_type = new QSGMaterialType();
|
||||||
|
cache->cache.insert(source, m_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickShaderEffectMaterial::cleanupMaterialCache()
|
void QQuickShaderEffectMaterial::cleanupMaterialCache()
|
||||||
{
|
{
|
||||||
QMutexLocker locker(materialHashMutex);
|
QQuickShaderEffectMaterialCache *cache = QQuickShaderEffectMaterialCache::get(false);
|
||||||
Q_UNUSED(locker);
|
if (cache) {
|
||||||
|
qDeleteAll(cache->cache.values());
|
||||||
for (MaterialHash::iterator it = materialHash->begin(); it != materialHash->end(); ) {
|
delete cache;
|
||||||
if (!it.value().toStrongRef())
|
|
||||||
it = materialHash->erase(it);
|
|
||||||
else
|
|
||||||
++it;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,4 +505,6 @@ void QQuickShaderEffectNode::preprocess()
|
||||||
static_cast<QQuickShaderEffectMaterial *>(material())->updateTextures();
|
static_cast<QQuickShaderEffectMaterial *>(material())->updateTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "qquickshadereffectnode.moc"
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -73,7 +73,6 @@ struct QQuickShaderEffectMaterialKey {
|
||||||
|
|
||||||
uint qHash(const QQuickShaderEffectMaterialKey &key);
|
uint qHash(const QQuickShaderEffectMaterialKey &key);
|
||||||
|
|
||||||
|
|
||||||
class QQuickCustomMaterialShader;
|
class QQuickCustomMaterialShader;
|
||||||
class QQuickShaderEffectNode;
|
class QQuickShaderEffectNode;
|
||||||
class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMaterial : public QSGMaterial
|
class Q_QUICK_PRIVATE_EXPORT QQuickShaderEffectMaterial : public QSGMaterial
|
||||||
|
@ -117,13 +116,12 @@ public:
|
||||||
protected:
|
protected:
|
||||||
friend class QQuickCustomMaterialShader;
|
friend class QQuickCustomMaterialShader;
|
||||||
|
|
||||||
// The type pointer needs to be unique. It is not safe to let the type object be part of the
|
// Each material needs a unique type to ensure that the renderer has a one
|
||||||
// QQuickShaderEffectMaterial, since it can be deleted and a new one constructed on top of the old
|
// and exactly one GL program for every unique set of shader sources.
|
||||||
// one. The new QQuickShaderEffectMaterial would then get the same type pointer as the old one, and
|
// setProgramSource() stores the sources in a cache along with the right
|
||||||
// CustomMaterialShaders based on the old one would incorrectly be used together with the new
|
// type. The type is cleaned up in cleanupMaterialCache() which is called
|
||||||
// one. To guarantee that the type pointer is unique, the type object must live as long as
|
// when the GL context is shut down.
|
||||||
// there are any CustomMaterialShaders of that type.
|
QSGMaterialType *m_type;
|
||||||
QSharedPointer<QSGMaterialType> m_type;
|
|
||||||
QQuickShaderEffectMaterialKey m_source;
|
QQuickShaderEffectMaterialKey m_source;
|
||||||
|
|
||||||
QQuickShaderEffectNode *m_node;
|
QQuickShaderEffectNode *m_node;
|
||||||
|
|
|
@ -129,14 +129,15 @@ QQuickTextDocumentWithImageResources::~QQuickTextDocumentWithImageResources()
|
||||||
|
|
||||||
QVariant QQuickTextDocumentWithImageResources::loadResource(int type, const QUrl &name)
|
QVariant QQuickTextDocumentWithImageResources::loadResource(int type, const QUrl &name)
|
||||||
{
|
{
|
||||||
QQmlContext *context = qmlContext(parent());
|
QVariant resource = QTextDocument::loadResource(type, name);
|
||||||
|
if (resource.isNull() && type == QTextDocument::ImageResource) {
|
||||||
if (type == QTextDocument::ImageResource) {
|
QQmlContext *context = qmlContext(parent());
|
||||||
QQuickPixmap *p = loadPixmap(context, name);
|
QUrl url = baseUrl().resolved(name);
|
||||||
return p->image();
|
QQuickPixmap *p = loadPixmap(context, url);
|
||||||
|
resource = p->image();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QTextDocument::loadResource(type, name);
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickTextDocumentWithImageResources::requestFinished()
|
void QQuickTextDocumentWithImageResources::requestFinished()
|
||||||
|
@ -161,30 +162,28 @@ QSizeF QQuickTextDocumentWithImageResources::intrinsicSize(
|
||||||
|
|
||||||
QSizeF size(width, height);
|
QSizeF size(width, height);
|
||||||
if (!hasWidth || !hasHeight) {
|
if (!hasWidth || !hasHeight) {
|
||||||
QQmlContext *context = qmlContext(parent());
|
QVariant res = resource(QTextDocument::ImageResource, QUrl(imageFormat.name()));
|
||||||
QUrl url = baseUrl().resolved(QUrl(imageFormat.name()));
|
QImage image = res.value<QImage>();
|
||||||
|
if (image.isNull()) {
|
||||||
QQuickPixmap *p = loadPixmap(context, url);
|
|
||||||
if (!p->isReady()) {
|
|
||||||
if (!hasWidth)
|
if (!hasWidth)
|
||||||
size.setWidth(16);
|
size.setWidth(16);
|
||||||
if (!hasHeight)
|
if (!hasHeight)
|
||||||
size.setHeight(16);
|
size.setHeight(16);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
QSize implicitSize = p->implicitSize();
|
QSize imgSize = image.size();
|
||||||
|
|
||||||
if (!hasWidth) {
|
if (!hasWidth) {
|
||||||
if (!hasHeight)
|
if (!hasHeight)
|
||||||
size.setWidth(implicitSize.width());
|
size.setWidth(imgSize.width());
|
||||||
else
|
else
|
||||||
size.setWidth(qRound(height * (implicitSize.width() / (qreal) implicitSize.height())));
|
size.setWidth(qRound(height * (imgSize.width() / (qreal) imgSize.height())));
|
||||||
}
|
}
|
||||||
if (!hasHeight) {
|
if (!hasHeight) {
|
||||||
if (!hasWidth)
|
if (!hasWidth)
|
||||||
size.setHeight(implicitSize.height());
|
size.setHeight(imgSize.height());
|
||||||
else
|
else
|
||||||
size.setHeight(qRound(width * (implicitSize.height() / (qreal) implicitSize.width())));
|
size.setHeight(qRound(width * (imgSize.height() / (qreal) imgSize.width())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
|
@ -199,11 +198,8 @@ void QQuickTextDocumentWithImageResources::drawObject(
|
||||||
|
|
||||||
QImage QQuickTextDocumentWithImageResources::image(const QTextImageFormat &format)
|
QImage QQuickTextDocumentWithImageResources::image(const QTextImageFormat &format)
|
||||||
{
|
{
|
||||||
QQmlContext *context = qmlContext(parent());
|
QVariant res = resource(QTextDocument::ImageResource, QUrl(format.name()));
|
||||||
QUrl url = baseUrl().resolved(QUrl(format.name()));
|
return res.value<QImage>();
|
||||||
|
|
||||||
QQuickPixmap *p = loadPixmap(context, url);
|
|
||||||
return p->image();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QQuickTextDocumentWithImageResources::reset()
|
void QQuickTextDocumentWithImageResources::reset()
|
||||||
|
|
|
@ -197,7 +197,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
class QQuickPixmap;
|
class QQuickPixmap;
|
||||||
class QQuickTextDocumentWithImageResources : public QTextDocument, public QTextObjectInterface
|
class Q_AUTOTEST_EXPORT QQuickTextDocumentWithImageResources : public QTextDocument, public QTextObjectInterface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QTextObjectInterface)
|
Q_INTERFACES(QTextObjectInterface)
|
||||||
|
|
|
@ -890,11 +890,11 @@ void Renderer::map(Buffer *buffer, int byteSize, bool isIndexBuf)
|
||||||
if (byteSize > pool.size())
|
if (byteSize > pool.size())
|
||||||
pool.resize(byteSize);
|
pool.resize(byteSize);
|
||||||
buffer->data = pool.data();
|
buffer->data = pool.data();
|
||||||
} else {
|
} else if (buffer->size != byteSize) {
|
||||||
|
free(buffer->data);
|
||||||
buffer->data = (char *) malloc(byteSize);
|
buffer->data = (char *) malloc(byteSize);
|
||||||
}
|
}
|
||||||
buffer->size = byteSize;
|
buffer->size = byteSize;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::unmap(Buffer *buffer, bool isIndexBuf)
|
void Renderer::unmap(Buffer *buffer, bool isIndexBuf)
|
||||||
|
|
|
@ -72,7 +72,10 @@ qtHaveModule(widgets) {
|
||||||
|
|
||||||
SUBDIRS += $$PUBLICTESTS
|
SUBDIRS += $$PUBLICTESTS
|
||||||
SUBDIRS += $$METATYPETESTS
|
SUBDIRS += $$METATYPETESTS
|
||||||
!winrt:!contains(QT_CONFIG, no-qml-debug): SUBDIRS += debugger # no QProcess on winrt
|
!winrt { # no QProcess on winrt
|
||||||
|
!contains(QT_CONFIG, no-qml-debug): SUBDIRS += debugger
|
||||||
|
SUBDIRS += qmllint
|
||||||
|
}
|
||||||
|
|
||||||
contains(QT_CONFIG, private_tests) {
|
contains(QT_CONFIG, private_tests) {
|
||||||
SUBDIRS += $$PRIVATETESTS
|
SUBDIRS += $$PRIVATETESTS
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
.pragma library
|
||||||
|
.import QtQuick 2.4 as JSQtQuick
|
||||||
|
|
||||||
|
function foo(url)
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
import QtQuick 2.2
|
||||||
|
|
||||||
|
Item {
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
function foo()
|
||||||
|
{
|
||||||
|
var hello
|
||||||
|
returm 0 // Typo
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import QtQuick 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id root # // Missing :
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
import "QTBUG-45916.js" as JSTest
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
}
|
|
@ -0,0 +1,90 @@
|
||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2015 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sergio Martins <sergio.martins@kdab.com>
|
||||||
|
** Contact: http://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL21$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** 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 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** As a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class TestQmllint: public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void initTestCase();
|
||||||
|
void test();
|
||||||
|
void test_data();
|
||||||
|
private:
|
||||||
|
QString m_qmllintPath;
|
||||||
|
};
|
||||||
|
|
||||||
|
void TestQmllint::initTestCase()
|
||||||
|
{
|
||||||
|
m_qmllintPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmllint");
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
m_qmllintPath += QLatin1String(".exe");
|
||||||
|
#endif
|
||||||
|
if (!QFileInfo(m_qmllintPath).exists()) {
|
||||||
|
QString message = QStringLiteral("qmllint executable not found (looked for %0)").arg(m_qmllintPath);
|
||||||
|
QFAIL(qPrintable(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestQmllint::test_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QString>("filename");
|
||||||
|
QTest::addColumn<bool>("isValid");
|
||||||
|
|
||||||
|
// Valid files:
|
||||||
|
QTest::newRow("Simple_QML") << QStringLiteral("Simple.qml") << true;
|
||||||
|
QTest::newRow("QML_importing_JS") << QStringLiteral("importing_js.qml") << true;
|
||||||
|
QTest::newRow("QTBUG-45916_JS_with_pragma_and_import") << QStringLiteral("QTBUG-45916.js") << true;
|
||||||
|
|
||||||
|
// Invalid files:
|
||||||
|
QTest::newRow("Invalid_syntax_QML") << QStringLiteral("failure1.qml") << false;
|
||||||
|
QTest::newRow("Invalid_syntax_JS") << QStringLiteral("failure1.js") << false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestQmllint::test()
|
||||||
|
{
|
||||||
|
QFETCH(QString, filename);
|
||||||
|
QFETCH(bool, isValid);
|
||||||
|
filename = QStringLiteral("data/") + filename;
|
||||||
|
QStringList args;
|
||||||
|
args << QStringLiteral("--silent") << filename;
|
||||||
|
|
||||||
|
bool success = QProcess::execute(m_qmllintPath, args) == 0;
|
||||||
|
QCOMPARE(success, isValid);
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_MAIN(TestQmllint)
|
||||||
|
#include "main.moc"
|
|
@ -0,0 +1,6 @@
|
||||||
|
TEMPLATE = app
|
||||||
|
TARGET = testqmllint
|
||||||
|
INCLUDEPATH += .
|
||||||
|
|
||||||
|
SOURCES += main.cpp
|
||||||
|
QT += testlib
|
|
@ -87,6 +87,7 @@ void tst_qmlmin::initTestCase()
|
||||||
excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
|
excludedDirs << "doc/src/snippets/qtquick1/qtbinding";
|
||||||
excludedDirs << "doc/src/snippets/qtquick1/imports";
|
excludedDirs << "doc/src/snippets/qtquick1/imports";
|
||||||
excludedDirs << "tests/manual/v4";
|
excludedDirs << "tests/manual/v4";
|
||||||
|
excludedDirs << "tests/auto/qml/qmllint";
|
||||||
|
|
||||||
// Add invalid files (i.e. files with syntax errors)
|
// Add invalid files (i.e. files with syntax errors)
|
||||||
invalidFiles << "tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml";
|
invalidFiles << "tests/auto/quick/qquickloader/data/InvalidSourceComponent.qml";
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Column {
|
||||||
|
width: 50; height: 200
|
||||||
|
Rectangle {
|
||||||
|
id: item1
|
||||||
|
objectName: "item1"
|
||||||
|
focus: true
|
||||||
|
width: 50; height: 50
|
||||||
|
color: focus ? "red" : "lightgray"
|
||||||
|
KeyNavigation.down: item2
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: item2
|
||||||
|
objectName: "item2"
|
||||||
|
enabled: false
|
||||||
|
width: 50; height: 50
|
||||||
|
color: focus ? "red" : "lightgray"
|
||||||
|
KeyNavigation.down: item3
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: item3
|
||||||
|
objectName: "item3"
|
||||||
|
enabled: false
|
||||||
|
width: 50; height: 50
|
||||||
|
color: focus ? "red" : "lightgray"
|
||||||
|
KeyNavigation.down: item4
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: item4
|
||||||
|
objectName: "item4"
|
||||||
|
enabled: false
|
||||||
|
width: 50; height: 50
|
||||||
|
color: focus ? "red" : "lightgray"
|
||||||
|
KeyNavigation.down: item3
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,6 +87,7 @@ private slots:
|
||||||
void keyNavigation_skipNotVisible();
|
void keyNavigation_skipNotVisible();
|
||||||
void keyNavigation_implicitSetting();
|
void keyNavigation_implicitSetting();
|
||||||
void keyNavigation_focusReason();
|
void keyNavigation_focusReason();
|
||||||
|
void keyNavigation_loop();
|
||||||
void layoutMirroring();
|
void layoutMirroring();
|
||||||
void layoutMirroringIllegalParent();
|
void layoutMirroringIllegalParent();
|
||||||
void smooth();
|
void smooth();
|
||||||
|
@ -2102,6 +2103,31 @@ void tst_QQuickItem::keyNavigation_focusReason()
|
||||||
delete window;
|
delete window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_QQuickItem::keyNavigation_loop()
|
||||||
|
{
|
||||||
|
// QTBUG-47229
|
||||||
|
QQuickView *window = new QQuickView(0);
|
||||||
|
window->setBaseSize(QSize(240,320));
|
||||||
|
|
||||||
|
window->setSource(testFileUrl("keynavigationtest_loop.qml"));
|
||||||
|
window->show();
|
||||||
|
window->requestActivate();
|
||||||
|
|
||||||
|
QVERIFY(QTest::qWaitForWindowActive(window));
|
||||||
|
QCOMPARE(QGuiApplication::focusWindow(), window);
|
||||||
|
|
||||||
|
QQuickItem *item = findItem<QQuickItem>(window->rootObject(), "item1");
|
||||||
|
QVERIFY(item);
|
||||||
|
QVERIFY(item->hasActiveFocus());
|
||||||
|
|
||||||
|
QKeyEvent key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1);
|
||||||
|
QGuiApplication::sendEvent(window, &key);
|
||||||
|
QVERIFY(key.isAccepted());
|
||||||
|
QVERIFY(item->hasActiveFocus());
|
||||||
|
|
||||||
|
delete window;
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QQuickItem::smooth()
|
void tst_QQuickItem::smooth()
|
||||||
{
|
{
|
||||||
QQmlComponent component(&engine);
|
QQmlComponent component(&engine);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <QtQuick/QQuickTextDocument>
|
#include <QtQuick/QQuickTextDocument>
|
||||||
#include <QtQuick/QQuickItem>
|
#include <QtQuick/QQuickItem>
|
||||||
#include <QtQuick/private/qquicktextedit_p.h>
|
#include <QtQuick/private/qquicktextedit_p.h>
|
||||||
|
#include <QtQuick/private/qquicktext_p_p.h>
|
||||||
#include <QtGui/QTextDocument>
|
#include <QtGui/QTextDocument>
|
||||||
#include <QtGui/QTextDocumentWriter>
|
#include <QtGui/QTextDocumentWriter>
|
||||||
#include <QtQml/QQmlEngine>
|
#include <QtQml/QQmlEngine>
|
||||||
|
@ -47,6 +48,7 @@ class tst_qquicktextdocument : public QQmlDataTest
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private slots:
|
private slots:
|
||||||
void textDocumentWriter();
|
void textDocumentWriter();
|
||||||
|
void textDocumentWithImage();
|
||||||
};
|
};
|
||||||
|
|
||||||
QString text = QStringLiteral("foo bar");
|
QString text = QStringLiteral("foo bar");
|
||||||
|
@ -74,6 +76,20 @@ void tst_qquicktextdocument::textDocumentWriter()
|
||||||
delete o;
|
delete o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_qquicktextdocument::textDocumentWithImage()
|
||||||
|
{
|
||||||
|
QQuickTextDocumentWithImageResources document(0);
|
||||||
|
QImage image(1, 1, QImage::Format_Mono);
|
||||||
|
image.fill(1);
|
||||||
|
|
||||||
|
QString name = "image";
|
||||||
|
document.addResource(QTextDocument::ImageResource, name, image);
|
||||||
|
QTextImageFormat format;
|
||||||
|
format.setName(name);
|
||||||
|
QCOMPARE(image, document.image(format));
|
||||||
|
QCOMPARE(image, document.resource(QTextDocument::ImageResource, name).value<QImage>());
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_qquicktextdocument)
|
QTEST_MAIN(tst_qquicktextdocument)
|
||||||
|
|
||||||
#include "tst_qquicktextdocument.moc"
|
#include "tst_qquicktextdocument.moc"
|
||||||
|
|
|
@ -117,6 +117,7 @@ void QmlProfilerClient::sendRecordingStatus(bool record)
|
||||||
{
|
{
|
||||||
QByteArray ba;
|
QByteArray ba;
|
||||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||||
|
stream.setVersion(QDataStream::Qt_4_7);
|
||||||
stream << record << -1 << d->features;
|
stream << record << -1 << d->features;
|
||||||
sendMessage(ba);
|
sendMessage(ba);
|
||||||
}
|
}
|
||||||
|
@ -146,6 +147,7 @@ void QmlProfilerClient::messageReceived(const QByteArray &data)
|
||||||
{
|
{
|
||||||
QByteArray rwData = data;
|
QByteArray rwData = data;
|
||||||
QDataStream stream(&rwData, QIODevice::ReadOnly);
|
QDataStream stream(&rwData, QIODevice::ReadOnly);
|
||||||
|
stream.setVersion(QDataStream::Qt_4_7);
|
||||||
|
|
||||||
// Force all the 1 << <FLAG> expressions to be done in 64 bit, to silence some warnings
|
// Force all the 1 << <FLAG> expressions to be done in 64 bit, to silence some warnings
|
||||||
const quint64 one = static_cast<quint64>(1);
|
const quint64 one = static_cast<quint64>(1);
|
||||||
|
|
Loading…
Reference in New Issue