Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: Id27c36e55fcc68cc1140b0d9bec00b8ae6b52ed0
This commit is contained in:
commit
68607aeeeb
|
@ -37,7 +37,7 @@
|
||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
import QtQuick 2.5
|
import QtQuick 2.6
|
||||||
import QtQuick.Dialogs 1.0
|
import QtQuick.Dialogs 1.0
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.1
|
||||||
import Qt.labs.folderlistmodel 1.0
|
import Qt.labs.folderlistmodel 1.0
|
||||||
|
@ -172,7 +172,7 @@ Window {
|
||||||
height: flick.height * (flick.height / flick.contentHeight) - (width - anchors.margins) * 2
|
height: flick.height * (flick.height / flick.contentHeight) - (width - anchors.margins) * 2
|
||||||
y: flick.contentY * (flick.height / flick.contentHeight)
|
y: flick.contentY * (flick.height / flick.contentHeight)
|
||||||
NumberAnimation on opacity { id: vfade; to: 0; duration: 500 }
|
NumberAnimation on opacity { id: vfade; to: 0; duration: 500 }
|
||||||
onYChanged: { opacity = 1.0; fadeTimer.restart() }
|
onYChanged: { opacity = 1.0; scrollFadeTimer.restart() }
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -188,10 +188,10 @@ Window {
|
||||||
width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2
|
width: flick.width * (flick.width / flick.contentWidth) - (height - anchors.margins) * 2
|
||||||
x: flick.contentX * (flick.width / flick.contentWidth)
|
x: flick.contentX * (flick.width / flick.contentWidth)
|
||||||
NumberAnimation on opacity { id: hfade; to: 0; duration: 500 }
|
NumberAnimation on opacity { id: hfade; to: 0; duration: 500 }
|
||||||
onXChanged: { opacity = 1.0; fadeTimer.restart() }
|
onXChanged: { opacity = 1.0; scrollFadeTimer.restart() }
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer { id: fadeTimer; interval: 1000; onTriggered: { hfade.start(); vfade.start() } }
|
Timer { id: scrollFadeTimer; interval: 1000; onTriggered: { hfade.start(); vfade.start() } }
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -202,6 +202,42 @@ Window {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: -10
|
anchors.margins: -10
|
||||||
onClicked: fileDialog.open()
|
onClicked: fileDialog.open()
|
||||||
|
hoverEnabled: true
|
||||||
|
onPositionChanged: {
|
||||||
|
tooltip.visible = false
|
||||||
|
hoverTimer.start()
|
||||||
|
}
|
||||||
|
onExited: {
|
||||||
|
tooltip.visible = false
|
||||||
|
hoverTimer.stop()
|
||||||
|
}
|
||||||
|
Timer {
|
||||||
|
id: hoverTimer
|
||||||
|
interval: 1000
|
||||||
|
onTriggered: {
|
||||||
|
tooltip.x = parent.mouseX
|
||||||
|
tooltip.y = parent.mouseY
|
||||||
|
tooltip.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: tooltip
|
||||||
|
border.color: "black"
|
||||||
|
color: "beige"
|
||||||
|
width: tooltipText.implicitWidth + 8
|
||||||
|
height: tooltipText.implicitHeight + 8
|
||||||
|
visible: false
|
||||||
|
Text {
|
||||||
|
id: tooltipText
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: "Open an image directory (" + openShortcut.sequenceString + ")"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Shortcut {
|
||||||
|
id: openShortcut
|
||||||
|
sequence: StandardKey.Open
|
||||||
|
onActivated: fileDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,5 +253,7 @@ Window {
|
||||||
"With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate"
|
"With a mouse: drag normally, use the vertical wheel to zoom, horizontal wheel to rotate, or hold Ctrl while using the vertical wheel to rotate"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Shortcut { sequence: StandardKey.Quit; onActivated: Qt.quit() }
|
||||||
|
|
||||||
Component.onCompleted: fileDialog.open()
|
Component.onCompleted: fileDialog.open()
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,4 @@ RESOURCES += samegame.qrc
|
||||||
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame
|
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/samegame
|
||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|
||||||
QTPLUGIN += qsqlite
|
!contains(sql-drivers, sqlite): QTPLUGIN += qsqlite
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
\include examples-run.qdocinc
|
\include examples-run.qdocinc
|
||||||
|
|
||||||
\section1 Multipoint Flames
|
\section1 Multipoint Flames Example
|
||||||
|
|
||||||
\e{Multipoint Flames} demonstrates distinguishing different fingers in a
|
\e{Multipoint Flames} demonstrates distinguishing different fingers in a
|
||||||
\l MultiPointTouchArea, by assigning a different colored flame to each touch
|
\l MultiPointTouchArea, by assigning a different colored flame to each touch
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
whether it is currently pressed, as follows:
|
whether it is currently pressed, as follows:
|
||||||
\snippet touchinteraction/multipointtouch/multiflame.qml 1
|
\snippet touchinteraction/multipointtouch/multiflame.qml 1
|
||||||
|
|
||||||
\section1 Bear-Whack
|
\section1 Bear-Whack Example
|
||||||
|
|
||||||
\e{Bear-Whack} demonstrates using \l MultiPointTouchArea to add multiple
|
\e{Bear-Whack} demonstrates using \l MultiPointTouchArea to add multiple
|
||||||
finger support to a simple game. The interaction with the game
|
finger support to a simple game. The interaction with the game
|
||||||
|
@ -58,19 +58,19 @@
|
||||||
embedded into it:
|
embedded into it:
|
||||||
\snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0
|
\snippet touchinteraction/multipointtouch/content/AugmentedTouchPoint.qml 0
|
||||||
|
|
||||||
\section1 Flick Resize
|
\section1 Flick Resize Example
|
||||||
|
|
||||||
\e{Flick Resize} uses a \l PinchArea to implement a \e{pinch-to-resize}
|
\e{Flick Resize} uses a \l PinchArea to implement a \e{pinch-to-resize}
|
||||||
behavior. This is easily achieved by listening to the PinchArea signals and
|
behavior. This is easily achieved by listening to the PinchArea signals and
|
||||||
responding to user input.
|
responding to user input.
|
||||||
\snippet touchinteraction/pincharea/flickresize.qml 0
|
\snippet touchinteraction/pincharea/flickresize.qml 0
|
||||||
|
|
||||||
\section1 Flickable
|
\section1 Flickable Example
|
||||||
|
|
||||||
\e Flickable is a simple example demonstrating the \l Flickable type.
|
\e Flickable is a simple example demonstrating the \l Flickable type.
|
||||||
\snippet touchinteraction/flickable/basic-flickable.qml 0
|
\snippet touchinteraction/flickable/basic-flickable.qml 0
|
||||||
|
|
||||||
\section1 Corkboards
|
\section1 Corkboards Example
|
||||||
|
|
||||||
\e Corkboards shows another use for \l Flickable, with QML types within the
|
\e Corkboards shows another use for \l Flickable, with QML types within the
|
||||||
flickable object that respond to mouse and keyboard interaction. This
|
flickable object that respond to mouse and keyboard interaction. This
|
||||||
|
|
|
@ -81,7 +81,7 @@ static void qQmlProfilerDataToByteArrays(const QQmlProfilerData *d, QList<QByteA
|
||||||
ds << QQmlProfilerDefinitions::QmlBinding;
|
ds << QQmlProfilerDefinitions::QmlBinding;
|
||||||
break;
|
break;
|
||||||
case QQmlProfilerDefinitions::RangeData:
|
case QQmlProfilerDefinitions::RangeData:
|
||||||
ds << d->detailString;
|
ds << (d->detailString.isEmpty() ? d->detailUrl.toString() : d->detailString);
|
||||||
break;
|
break;
|
||||||
case QQmlProfilerDefinitions::RangeLocation:
|
case QQmlProfilerDefinitions::RangeLocation:
|
||||||
ds << (d->detailUrl.isEmpty() ? d->detailString : d->detailUrl.toString()) << d->x
|
ds << (d->detailUrl.isEmpty() ? d->detailString : d->detailUrl.toString()) << d->x
|
||||||
|
|
|
@ -99,8 +99,9 @@ struct Q_AUTOTEST_EXPORT QQmlProfilerData
|
||||||
int messageType; //bit field of QQmlProfilerService::Message
|
int messageType; //bit field of QQmlProfilerService::Message
|
||||||
int detailType;
|
int detailType;
|
||||||
|
|
||||||
|
// RangeData prefers detailString; RangeLocation prefers detailUrl.
|
||||||
QString detailString; //used by RangeData and possibly by RangeLocation
|
QString detailString; //used by RangeData and possibly by RangeLocation
|
||||||
QUrl detailUrl; //used by RangeLocation, overrides detailString
|
QUrl detailUrl; //used by RangeLocation and possibly by RangeData
|
||||||
|
|
||||||
int x; //used by RangeLocation
|
int x; //used by RangeLocation
|
||||||
int y; //used by RangeLocation
|
int y; //used by RangeLocation
|
||||||
|
@ -120,11 +121,11 @@ public:
|
||||||
|
|
||||||
// Have toByteArrays() construct another RangeData event from the same QString later.
|
// Have toByteArrays() construct another RangeData event from the same QString later.
|
||||||
// This is somewhat pointless but important for backwards compatibility.
|
// This is somewhat pointless but important for backwards compatibility.
|
||||||
void startCompiling(const QString &name)
|
void startCompiling(const QUrl &url)
|
||||||
{
|
{
|
||||||
m_data.append(QQmlProfilerData(m_timer.nsecsElapsed(),
|
m_data.append(QQmlProfilerData(m_timer.nsecsElapsed(),
|
||||||
(1 << RangeStart | 1 << RangeLocation | 1 << RangeData),
|
(1 << RangeStart | 1 << RangeLocation | 1 << RangeData),
|
||||||
1 << Compiling, name, 1, 1));
|
1 << Compiling, url, 1, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void startHandlingSignal(const QQmlSourceLocation &location)
|
void startHandlingSignal(const QQmlSourceLocation &location)
|
||||||
|
@ -217,10 +218,10 @@ struct QQmlHandlingSignalProfiler : public QQmlProfilerHelper {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QQmlCompilingProfiler : public QQmlProfilerHelper {
|
struct QQmlCompilingProfiler : public QQmlProfilerHelper {
|
||||||
QQmlCompilingProfiler(QQmlProfiler *profiler, const QString &name) :
|
QQmlCompilingProfiler(QQmlProfiler *profiler, const QUrl &url) :
|
||||||
QQmlProfilerHelper(profiler)
|
QQmlProfilerHelper(profiler)
|
||||||
{
|
{
|
||||||
Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, startCompiling(name));
|
Q_QML_PROFILE(QQmlProfilerDefinitions::ProfileCompiling, profiler, startCompiling(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
~QQmlCompilingProfiler()
|
~QQmlCompilingProfiler()
|
||||||
|
|
|
@ -328,11 +328,11 @@ public:
|
||||||
: QObject(parent), m_author(new MessageAuthor(this))
|
: QObject(parent), m_author(new MessageAuthor(this))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Message *author() const {
|
MessageAuthor *author() const {
|
||||||
return m_author;
|
return m_author;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
Message *m_author;
|
MessageAuthor *m_author;
|
||||||
};
|
};
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,18 @@ QJSValue::QJSValue(const QJSValue& other)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QJSValue::QJSValue(QJSValue && other)
|
||||||
|
|
||||||
|
Move constructor. Moves from \a other into this QJSValue object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QJSValue &operator=(QJSValue && other)
|
||||||
|
|
||||||
|
Move-assigns \a other to this QJSValue object.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Destroys this QJSValue.
|
Destroys this QJSValue.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,8 +77,8 @@ void ArgumentsObject::fullyCreate()
|
||||||
if (fullyCreated())
|
if (fullyCreated())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint numAccessors = qMin((int)context()->function->formalParameterCount(), context()->callData->argc);
|
|
||||||
uint argCount = context()->callData->argc;
|
uint argCount = context()->callData->argc;
|
||||||
|
uint numAccessors = qMin(context()->function->formalParameterCount(), argCount);
|
||||||
ArrayData::realloc(this, Heap::ArrayData::Sparse, argCount, true);
|
ArrayData::realloc(this, Heap::ArrayData::Sparse, argCount, true);
|
||||||
context()->engine->requireArgumentsAccessors(numAccessors);
|
context()->engine->requireArgumentsAccessors(numAccessors);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void ArgumentsObject::fullyCreate()
|
||||||
Scoped<MemberData> md(scope, d()->mappedArguments);
|
Scoped<MemberData> md(scope, d()->mappedArguments);
|
||||||
if (!md || md->size() < numAccessors)
|
if (!md || md->size() < numAccessors)
|
||||||
d()->mappedArguments = md->reallocate(engine(), d()->mappedArguments, numAccessors);
|
d()->mappedArguments = md->reallocate(engine(), d()->mappedArguments, numAccessors);
|
||||||
for (uint i = 0; i < (uint)numAccessors; ++i) {
|
for (uint i = 0; i < numAccessors; ++i) {
|
||||||
mappedArguments()->data[i] = context()->callData->args[i];
|
mappedArguments()->data[i] = context()->callData->args[i];
|
||||||
arraySet(i, context()->engine->argumentsAccessors + i, Attr_Accessor);
|
arraySet(i, context()->engine->argumentsAccessors + i, Attr_Accessor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,20 +46,30 @@ void MemberData::markObjects(Heap::Base *that, ExecutionEngine *e)
|
||||||
m->data[i].mark(e);
|
m->data[i].mark(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Heap::MemberData *MemberData::reallocate(ExecutionEngine *e, Heap::MemberData *old, uint idx)
|
static Heap::MemberData *reallocateHelper(ExecutionEngine *e, Heap::MemberData *old, uint n)
|
||||||
{
|
{
|
||||||
uint s = old ? old->size : 0;
|
uint alloc = sizeof(Heap::MemberData) + (n)*sizeof(Value);
|
||||||
if (idx < s)
|
|
||||||
return old;
|
|
||||||
|
|
||||||
int newAlloc = qMax((uint)4, 2*idx);
|
|
||||||
uint alloc = sizeof(Heap::MemberData) + (newAlloc)*sizeof(Value);
|
|
||||||
Scope scope(e);
|
Scope scope(e);
|
||||||
Scoped<MemberData> newMemberData(scope, e->memoryManager->allocManaged<MemberData>(alloc));
|
Scoped<MemberData> newMemberData(scope, e->memoryManager->allocManaged<MemberData>(alloc));
|
||||||
if (old)
|
if (old)
|
||||||
memcpy(newMemberData->d(), old, sizeof(Heap::MemberData) + s*sizeof(Value));
|
memcpy(newMemberData->d(), old, sizeof(Heap::MemberData) + old->size * sizeof(Value));
|
||||||
else
|
else
|
||||||
new (newMemberData->d()) Heap::MemberData;
|
new (newMemberData->d()) Heap::MemberData;
|
||||||
newMemberData->d()->size = newAlloc;
|
newMemberData->d()->size = n;
|
||||||
return newMemberData->d();
|
return newMemberData->d();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Heap::MemberData *MemberData::allocate(ExecutionEngine *e, uint n)
|
||||||
|
{
|
||||||
|
return reallocateHelper(e, 0, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
Heap::MemberData *MemberData::reallocate(ExecutionEngine *e, Heap::MemberData *old, uint n)
|
||||||
|
{
|
||||||
|
uint s = old ? old->size : 0;
|
||||||
|
if (n < s)
|
||||||
|
return old;
|
||||||
|
|
||||||
|
// n is multiplied by two to leave room for growth
|
||||||
|
return reallocateHelper(e, old, qMax((uint)4, 2*n));
|
||||||
|
}
|
||||||
|
|
|
@ -61,7 +61,8 @@ struct MemberData : Managed
|
||||||
Value *data() { return d()->data; }
|
Value *data() { return d()->data; }
|
||||||
inline uint size() const { return d()->size; }
|
inline uint size() const { return d()->size; }
|
||||||
|
|
||||||
static Heap::MemberData *reallocate(QV4::ExecutionEngine *e, Heap::MemberData *old, uint idx);
|
static Heap::MemberData *allocate(QV4::ExecutionEngine *e, uint n);
|
||||||
|
static Heap::MemberData *reallocate(QV4::ExecutionEngine *e, Heap::MemberData *old, uint n);
|
||||||
|
|
||||||
static void markObjects(Heap::Base *that, ExecutionEngine *e);
|
static void markObjects(Heap::Base *that, ExecutionEngine *e);
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
using namespace QV4;
|
namespace QV4 {
|
||||||
using namespace QV4::Profiling;
|
namespace Profiling {
|
||||||
|
|
||||||
FunctionCallProperties FunctionCall::resolve() const
|
FunctionCallProperties FunctionCall::resolve() const
|
||||||
{
|
{
|
||||||
|
@ -63,26 +63,28 @@ Profiler::Profiler(QV4::ExecutionEngine *engine) : featuresEnabled(0), m_engine(
|
||||||
m_timer.start();
|
m_timer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FunctionCallComparator {
|
|
||||||
bool operator()(const FunctionCallProperties &p1, const FunctionCallProperties &p2)
|
|
||||||
{ return p1.start < p2.start; }
|
|
||||||
};
|
|
||||||
|
|
||||||
void Profiler::stopProfiling()
|
void Profiler::stopProfiling()
|
||||||
{
|
{
|
||||||
featuresEnabled = 0;
|
featuresEnabled = 0;
|
||||||
reportData();
|
reportData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator<(const FunctionCall &call1, const FunctionCall &call2)
|
||||||
|
{
|
||||||
|
return call1.m_start < call2.m_start ||
|
||||||
|
(call1.m_start == call2.m_start && (call1.m_end < call2.m_end ||
|
||||||
|
(call1.m_end == call2.m_end && call1.m_function < call2.m_function)));
|
||||||
|
}
|
||||||
|
|
||||||
void Profiler::reportData()
|
void Profiler::reportData()
|
||||||
{
|
{
|
||||||
|
std::sort(m_data.begin(), m_data.end());
|
||||||
QVector<FunctionCallProperties> resolved;
|
QVector<FunctionCallProperties> resolved;
|
||||||
resolved.reserve(m_data.size());
|
resolved.reserve(m_data.size());
|
||||||
FunctionCallComparator comp;
|
|
||||||
foreach (const FunctionCall &call, m_data) {
|
foreach (const FunctionCall &call, m_data)
|
||||||
FunctionCallProperties props = call.resolve();
|
resolved.append(call.resolve());
|
||||||
resolved.insert(std::upper_bound(resolved.begin(), resolved.end(), props, comp), props);
|
|
||||||
}
|
|
||||||
emit dataReady(resolved, m_memory_data);
|
emit dataReady(resolved, m_memory_data);
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
m_memory_data.clear();
|
m_memory_data.clear();
|
||||||
|
@ -111,4 +113,7 @@ void Profiler::startProfiling(quint64 features)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace Profiling
|
||||||
|
} // namespace QV4
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -104,6 +104,7 @@ public:
|
||||||
FunctionCallProperties resolve() const;
|
FunctionCallProperties resolve() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
friend bool operator<(const FunctionCall &call1, const FunctionCall &call2);
|
||||||
|
|
||||||
Function *m_function;
|
Function *m_function;
|
||||||
qint64 m_start;
|
qint64 m_start;
|
||||||
|
|
|
@ -104,18 +104,6 @@ Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Functio
|
||||||
internalClass->engine->popContext();
|
internalClass->engine->popContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::QmlContextWrapper *qml)
|
|
||||||
: Heap::FunctionObject(scope, scope->d()->engine->id_eval(), /*createProto = */ false)
|
|
||||||
{
|
|
||||||
Q_ASSERT(scope->inUse());
|
|
||||||
|
|
||||||
Scope s(scope);
|
|
||||||
Scoped<QV4::QmlBindingWrapper> protectThis(s, this);
|
|
||||||
|
|
||||||
this->scope = scope->newQmlContext(qml);
|
|
||||||
internalClass->engine->popContext();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnedValue QmlBindingWrapper::call(const Managed *that, CallData *callData)
|
ReturnedValue QmlBindingWrapper::call(const Managed *that, CallData *callData)
|
||||||
{
|
{
|
||||||
const QmlBindingWrapper *This = static_cast<const QmlBindingWrapper *>(that);
|
const QmlBindingWrapper *This = static_cast<const QmlBindingWrapper *>(that);
|
||||||
|
@ -152,8 +140,8 @@ Heap::FunctionObject *QmlBindingWrapper::createQmlCallableForFunction(QQmlContex
|
||||||
QV4::Scope valueScope(engine);
|
QV4::Scope valueScope(engine);
|
||||||
QV4::Scoped<QmlContextWrapper> qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine, qmlContext, scopeObject));
|
QV4::Scoped<QmlContextWrapper> qmlScopeObject(valueScope, QV4::QmlContextWrapper::qmlScope(engine, qmlContext, scopeObject));
|
||||||
ScopedContext global(valueScope, valueScope.engine->rootContext());
|
ScopedContext global(valueScope, valueScope.engine->rootContext());
|
||||||
QV4::Scoped<QV4::QmlBindingWrapper> wrapper(valueScope, engine->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScopeObject));
|
QV4::Scoped<QmlContext> wrapperContext(valueScope, global->newQmlContext(qmlScopeObject));
|
||||||
QV4::Scoped<QmlContext> wrapperContext(valueScope, wrapper->context());
|
engine->popContext();
|
||||||
|
|
||||||
if (!signalParameters.isEmpty()) {
|
if (!signalParameters.isEmpty()) {
|
||||||
if (error)
|
if (error)
|
||||||
|
|
|
@ -88,8 +88,6 @@ struct ContextStateSaver {
|
||||||
namespace Heap {
|
namespace Heap {
|
||||||
struct QmlBindingWrapper : Heap::FunctionObject {
|
struct QmlBindingWrapper : Heap::FunctionObject {
|
||||||
QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::QmlContextWrapper *qml);
|
QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::QmlContextWrapper *qml);
|
||||||
// Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
|
|
||||||
QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::QmlContextWrapper *qml);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -99,8 +97,6 @@ struct Q_QML_EXPORT QmlBindingWrapper : FunctionObject {
|
||||||
|
|
||||||
static ReturnedValue call(const Managed *that, CallData *callData);
|
static ReturnedValue call(const Managed *that, CallData *callData);
|
||||||
|
|
||||||
Heap::QmlContext *context() const { return static_cast<Heap::QmlContext *>(d()->scope.ptr); }
|
|
||||||
|
|
||||||
static Heap::FunctionObject *createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, QV4::Function *runtimeFunction,
|
static Heap::FunctionObject *createQmlCallableForFunction(QQmlContextData *qmlContext, QObject *scopeObject, QV4::Function *runtimeFunction,
|
||||||
const QList<QByteArray> &signalParameters = QList<QByteArray>(), QString *error = 0);
|
const QList<QByteArray> &signalParameters = QList<QByteArray>(), QString *error = 0);
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,3 +82,13 @@
|
||||||
Your implementation of this function must be thread-safe, as it can be called from multiple threads
|
Your implementation of this function must be thread-safe, as it can be called from multiple threads
|
||||||
at the same time.
|
at the same time.
|
||||||
*/
|
*/
|
||||||
|
/*!
|
||||||
|
\fn QQmlAbstractUrlInterceptor::QQmlAbstractUrlInterceptor()
|
||||||
|
|
||||||
|
Constructor for QQmlAbstractUrlInterceptor.
|
||||||
|
*/
|
||||||
|
/*!
|
||||||
|
\fn QQmlAbstractUrlInterceptor::~QQmlAbstractUrlInterceptor()
|
||||||
|
|
||||||
|
Destructor for QQmlAbstractUrlInterceptor.
|
||||||
|
*/
|
||||||
|
|
|
@ -100,23 +100,14 @@ ReturnedValue QmlContextWrapper::get(const Managed *m, String *name, bool *hasPr
|
||||||
QV4::ExecutionEngine *v4 = resource->engine();
|
QV4::ExecutionEngine *v4 = resource->engine();
|
||||||
QV4::Scope scope(v4);
|
QV4::Scope scope(v4);
|
||||||
|
|
||||||
// In V8 the JS global object would come _before_ the QML global object,
|
|
||||||
// so simulate that here.
|
|
||||||
bool hasProp;
|
|
||||||
QV4::ScopedValue result(scope, v4->globalObject->get(name, &hasProp));
|
|
||||||
if (hasProp) {
|
|
||||||
if (hasProperty)
|
|
||||||
*hasProperty = hasProp;
|
|
||||||
return result->asReturnedValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resource->d()->isNullWrapper)
|
if (resource->d()->isNullWrapper)
|
||||||
return Object::get(m, name, hasProperty);
|
return Object::get(m, name, hasProperty);
|
||||||
|
|
||||||
if (v4->callingQmlContext() != resource->d()->context)
|
if (v4->callingQmlContext() != resource->d()->context)
|
||||||
return Object::get(m, name, hasProperty);
|
return Object::get(m, name, hasProperty);
|
||||||
|
|
||||||
result = Object::get(m, name, &hasProp);
|
bool hasProp;
|
||||||
|
QV4::ScopedValue result(scope, Object::get(m, name, &hasProp));
|
||||||
if (hasProp) {
|
if (hasProp) {
|
||||||
if (hasProperty)
|
if (hasProperty)
|
||||||
*hasProperty = hasProp;
|
*hasProperty = hasProp;
|
||||||
|
|
|
@ -120,7 +120,7 @@ void QQmlObjectCreator::init(QQmlContextData *providedParentContext)
|
||||||
_ddata = 0;
|
_ddata = 0;
|
||||||
_propertyCache = 0;
|
_propertyCache = 0;
|
||||||
_vmeMetaObject = 0;
|
_vmeMetaObject = 0;
|
||||||
_qmlBindingWrapper = 0;
|
_qmlContext = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QQmlObjectCreator::~QQmlObjectCreator()
|
QQmlObjectCreator::~QQmlObjectCreator()
|
||||||
|
@ -236,9 +236,9 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
|
||||||
Q_ASSERT(!sharedState->allJavaScriptObjects);
|
Q_ASSERT(!sharedState->allJavaScriptObjects);
|
||||||
sharedState->allJavaScriptObjects = valueScope.alloc(compiledData->totalObjectCount);
|
sharedState->allJavaScriptObjects = valueScope.alloc(compiledData->totalObjectCount);
|
||||||
|
|
||||||
QV4::Value *qmlBindingWrapper = valueScope.alloc(1);
|
QV4::QmlContext *qmlContext = static_cast<QV4::QmlContext *>(valueScope.alloc(1));
|
||||||
|
|
||||||
qSwap(_qmlBindingWrapper, qmlBindingWrapper);
|
qSwap(_qmlContext, qmlContext);
|
||||||
|
|
||||||
qSwap(_propertyCache, cache);
|
qSwap(_propertyCache, cache);
|
||||||
qSwap(_qobject, instance);
|
qSwap(_qobject, instance);
|
||||||
|
@ -267,7 +267,7 @@ bool QQmlObjectCreator::populateDeferredProperties(QObject *instance)
|
||||||
qSwap(_qobject, instance);
|
qSwap(_qobject, instance);
|
||||||
qSwap(_propertyCache, cache);
|
qSwap(_propertyCache, cache);
|
||||||
|
|
||||||
qSwap(_qmlBindingWrapper, qmlBindingWrapper);
|
qSwap(_qmlContext, qmlContext);
|
||||||
qSwap(_scopeObject, scopeObject);
|
qSwap(_scopeObject, scopeObject);
|
||||||
|
|
||||||
phase = ObjectsCreated;
|
phase = ObjectsCreated;
|
||||||
|
@ -985,15 +985,16 @@ void QQmlObjectCreator::registerObjectWithContextById(int objectIndex, QObject *
|
||||||
context->setIdProperty(idEntry.value(), instance);
|
context->setIdProperty(idEntry.value(), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
QV4::Heap::ExecutionContext *QQmlObjectCreator::currentQmlContext()
|
QV4::Heap::QmlContext *QQmlObjectCreator::currentQmlContext()
|
||||||
{
|
{
|
||||||
if (!_qmlBindingWrapper->objectValue()) {
|
if (!_qmlContext->objectValue()) {
|
||||||
QV4::Scope valueScope(v4);
|
QV4::Scope valueScope(v4);
|
||||||
QV4::Scoped<QV4::QmlContextWrapper> qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject));
|
QV4::Scoped<QV4::QmlContextWrapper> qmlScope(valueScope, QV4::QmlContextWrapper::qmlScope(v4, context, _scopeObject));
|
||||||
QV4::ScopedContext global(valueScope, v4->rootContext());
|
QV4::ScopedContext global(valueScope, v4->rootContext());
|
||||||
*_qmlBindingWrapper = v4->memoryManager->alloc<QV4::QmlBindingWrapper>(global, qmlScope);
|
_qmlContext->setM(global->newQmlContext(qmlScope));
|
||||||
|
v4->popContext();
|
||||||
}
|
}
|
||||||
return static_cast<QV4::QmlBindingWrapper*>(_qmlBindingWrapper->objectValue())->context();
|
return _qmlContext->d();
|
||||||
}
|
}
|
||||||
|
|
||||||
QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isContextObject)
|
QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isContextObject)
|
||||||
|
@ -1140,13 +1141,13 @@ QObject *QQmlObjectCreator::createInstance(int index, QObject *parent, bool isCo
|
||||||
++sharedState->allJavaScriptObjects;
|
++sharedState->allJavaScriptObjects;
|
||||||
|
|
||||||
QV4::Scope valueScope(v4);
|
QV4::Scope valueScope(v4);
|
||||||
QV4::Value *qmlBindingWrapper = valueScope.alloc(1);
|
QV4::QmlContext *qmlContext = static_cast<QV4::QmlContext *>(valueScope.alloc(1));
|
||||||
|
|
||||||
qSwap(_qmlBindingWrapper, qmlBindingWrapper);
|
qSwap(_qmlContext, qmlContext);
|
||||||
|
|
||||||
bool result = populateInstance(index, instance, /*binding target*/instance, /*value type property*/0, bindingsToSkip);
|
bool result = populateInstance(index, instance, /*binding target*/instance, /*value type property*/0, bindingsToSkip);
|
||||||
|
|
||||||
qSwap(_qmlBindingWrapper, qmlBindingWrapper);
|
qSwap(_qmlContext, qmlContext);
|
||||||
qSwap(_scopeObject, scopeObject);
|
qSwap(_scopeObject, scopeObject);
|
||||||
|
|
||||||
return result ? instance : 0;
|
return result ? instance : 0;
|
||||||
|
|
|
@ -107,7 +107,7 @@ private:
|
||||||
|
|
||||||
void registerObjectWithContextById(int objectIndex, QObject *instance) const;
|
void registerObjectWithContextById(int objectIndex, QObject *instance) const;
|
||||||
|
|
||||||
QV4::Heap::ExecutionContext *currentQmlContext();
|
QV4::Heap::QmlContext *currentQmlContext();
|
||||||
|
|
||||||
enum Phase {
|
enum Phase {
|
||||||
Startup,
|
Startup,
|
||||||
|
@ -143,7 +143,7 @@ private:
|
||||||
QQmlRefPointer<QQmlPropertyCache> _propertyCache;
|
QQmlRefPointer<QQmlPropertyCache> _propertyCache;
|
||||||
QQmlVMEMetaObject *_vmeMetaObject;
|
QQmlVMEMetaObject *_vmeMetaObject;
|
||||||
QQmlListProperty<void> _currentList;
|
QQmlListProperty<void> _currentList;
|
||||||
QV4::Value *_qmlBindingWrapper;
|
QV4::QmlContext *_qmlContext;
|
||||||
|
|
||||||
friend struct QQmlObjectCreatorRecursionWatcher;
|
friend struct QQmlObjectCreatorRecursionWatcher;
|
||||||
};
|
};
|
||||||
|
|
|
@ -647,6 +647,8 @@ void QQmlDataBlob::notifyComplete(QQmlDataBlob *blob)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_waitingFor.contains(blob));
|
Q_ASSERT(m_waitingFor.contains(blob));
|
||||||
Q_ASSERT(blob->status() == Error || blob->status() == Complete);
|
Q_ASSERT(blob->status() == Error || blob->status() == Complete);
|
||||||
|
QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler,
|
||||||
|
blob->url());
|
||||||
|
|
||||||
m_inCallback = true;
|
m_inCallback = true;
|
||||||
|
|
||||||
|
@ -1194,6 +1196,8 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, QQmlFile *file)
|
||||||
void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
|
void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
|
||||||
{
|
{
|
||||||
QML_MEMORY_SCOPE_URL(blob->url());
|
QML_MEMORY_SCOPE_URL(blob->url());
|
||||||
|
QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
|
||||||
|
|
||||||
blob->m_inCallback = true;
|
blob->m_inCallback = true;
|
||||||
|
|
||||||
blob->dataReceived(d);
|
blob->dataReceived(d);
|
||||||
|
@ -1212,6 +1216,8 @@ void QQmlTypeLoader::setData(QQmlDataBlob *blob, const QQmlDataBlob::Data &d)
|
||||||
void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
|
void QQmlTypeLoader::setCachedUnit(QQmlDataBlob *blob, const QQmlPrivate::CachedQmlUnit *unit)
|
||||||
{
|
{
|
||||||
QML_MEMORY_SCOPE_URL(blob->url());
|
QML_MEMORY_SCOPE_URL(blob->url());
|
||||||
|
QQmlCompilingProfiler prof(QQmlEnginePrivate::get(engine())->profiler, blob->url());
|
||||||
|
|
||||||
blob->m_inCallback = true;
|
blob->m_inCallback = true;
|
||||||
|
|
||||||
blob->initializeFromCachedUnit(unit);
|
blob->initializeFromCachedUnit(unit);
|
||||||
|
@ -2253,8 +2259,6 @@ void QQmlTypeData::compile()
|
||||||
|
|
||||||
m_compiledData = new QQmlCompiledData(typeLoader()->engine());
|
m_compiledData = new QQmlCompiledData(typeLoader()->engine());
|
||||||
|
|
||||||
QQmlCompilingProfiler prof(QQmlEnginePrivate::get(typeLoader()->engine())->profiler, finalUrlString());
|
|
||||||
|
|
||||||
QQmlTypeCompiler compiler(QQmlEnginePrivate::get(typeLoader()->engine()), m_compiledData, this, m_document.data());
|
QQmlTypeCompiler compiler(QQmlEnginePrivate::get(typeLoader()->engine()), m_compiledData, this, m_document.data());
|
||||||
if (!compiler.compile()) {
|
if (!compiler.compile()) {
|
||||||
setError(compiler.compilationErrors());
|
setError(compiler.compilationErrors());
|
||||||
|
|
|
@ -82,7 +82,8 @@ bool QQmlValueTypeFactoryImpl::isValueType(int idx)
|
||||||
&& idx != QVariant::StringList
|
&& idx != QVariant::StringList
|
||||||
&& idx != QMetaType::QObjectStar
|
&& idx != QMetaType::QObjectStar
|
||||||
&& idx != QMetaType::VoidStar
|
&& idx != QMetaType::VoidStar
|
||||||
&& idx != QMetaType::QVariant) {
|
&& idx != QMetaType::QVariant
|
||||||
|
&& idx != QMetaType::QLocale) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1086,7 +1086,7 @@ void QQmlVMEMetaObject::allocateProperties()
|
||||||
{
|
{
|
||||||
Q_ASSERT(cache && cache->engine);
|
Q_ASSERT(cache && cache->engine);
|
||||||
QV4::ExecutionEngine *v4 = cache->engine;
|
QV4::ExecutionEngine *v4 = cache->engine;
|
||||||
QV4::Heap::MemberData *data = QV4::MemberData::reallocate(v4, 0, metaData->propertyCount);
|
QV4::Heap::MemberData *data = QV4::MemberData::allocate(v4, metaData->propertyCount);
|
||||||
properties.set(v4, data);
|
properties.set(v4, data);
|
||||||
for (uint i = 0; i < data->size; ++i)
|
for (uint i = 0; i < data->size; ++i)
|
||||||
data->data[i] = QV4::Encode::undefined();
|
data->data[i] = QV4::Encode::undefined();
|
||||||
|
|
|
@ -1358,7 +1358,11 @@ void QQmlXMLHttpRequest::error(QNetworkReply::NetworkError error)
|
||||||
error == QNetworkReply::AuthenticationRequiredError ||
|
error == QNetworkReply::AuthenticationRequiredError ||
|
||||||
error == QNetworkReply::ContentReSendError ||
|
error == QNetworkReply::ContentReSendError ||
|
||||||
error == QNetworkReply::UnknownContentError ||
|
error == QNetworkReply::UnknownContentError ||
|
||||||
error == QNetworkReply::ProtocolInvalidOperationError) {
|
error == QNetworkReply::ProtocolInvalidOperationError ||
|
||||||
|
error == QNetworkReply::InternalServerError ||
|
||||||
|
error == QNetworkReply::OperationNotImplementedError ||
|
||||||
|
error == QNetworkReply::ServiceUnavailableError ||
|
||||||
|
error == QNetworkReply::UnknownServerError) {
|
||||||
m_state = Loading;
|
m_state = Loading;
|
||||||
dispatchCallback();
|
dispatchCallback();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -210,7 +210,7 @@ public:
|
||||||
\inqmlmodule QtQuick
|
\inqmlmodule QtQuick
|
||||||
\brief Defines a set of objects to be used as a model
|
\brief Defines a set of objects to be used as a model
|
||||||
|
|
||||||
The VisualItemModel type encapsulates contains the objects to be used
|
The VisualItemModel type contains the objects to be used
|
||||||
as a model.
|
as a model.
|
||||||
|
|
||||||
This element is now primarily available as ObjectModel in the QtQml.Models module.
|
This element is now primarily available as ObjectModel in the QtQml.Models module.
|
||||||
|
|
|
@ -208,8 +208,8 @@ item and then transfer the item to the items group before moving it to the pre-d
|
||||||
repeat until the unsorted group is empty.
|
repeat until the unsorted group is empty.
|
||||||
|
|
||||||
To find the insert position for an item we request a handle for the item from the unsorted group
|
To find the insert position for an item we request a handle for the item from the unsorted group
|
||||||
with the \l {DelegateModel::}{get} function. Through the model property on this
|
with the \l {DelegateModelGroup::}{get()} function. Through the model property on this handle we can
|
||||||
handle we can access the same model data that is available in a delegate instance of that item and
|
access the same model data that is available in a delegate instance of that item and
|
||||||
compare against other items to determine relative position.
|
compare against other items to determine relative position.
|
||||||
|
|
||||||
\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 3
|
\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 3
|
||||||
|
|
|
@ -189,7 +189,7 @@ QColor qt_color_from_string(const QV4::Value &name)
|
||||||
if (isRgb)
|
if (isRgb)
|
||||||
return QColor::fromRgba(qRgba(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255)));
|
return QColor::fromRgba(qRgba(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255)));
|
||||||
else if (isHsl)
|
else if (isHsl)
|
||||||
return QColor::fromHsl(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255));
|
return QColor::fromHsl(qClamp(rh, 0, 359), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255));
|
||||||
}
|
}
|
||||||
return QColor();
|
return QColor();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1699,7 +1699,8 @@ void QQuickItemViewPrivate::updateCurrent(int modelIndex)
|
||||||
updateHighlight();
|
updateHighlight();
|
||||||
if (oldCurrentIndex != currentIndex)
|
if (oldCurrentIndex != currentIndex)
|
||||||
emit q->currentIndexChanged();
|
emit q->currentIndexChanged();
|
||||||
if (oldCurrentItem != currentItem)
|
if (oldCurrentItem != currentItem
|
||||||
|
&& (!oldCurrentItem || !currentItem || oldCurrentItem->item != currentItem->item))
|
||||||
emit q->currentItemChanged();
|
emit q->currentItemChanged();
|
||||||
releaseItem(oldCurrentItem);
|
releaseItem(oldCurrentItem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2115,6 +2115,7 @@ QQuickTextEditPrivate::ExtraData::ExtraData()
|
||||||
, explicitLeftPadding(false)
|
, explicitLeftPadding(false)
|
||||||
, explicitRightPadding(false)
|
, explicitRightPadding(false)
|
||||||
, explicitBottomPadding(false)
|
, explicitBottomPadding(false)
|
||||||
|
, explicitImplicitSize(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2345,6 +2346,7 @@ void QQuickTextEdit::updateSize()
|
||||||
|
|
||||||
const bool wasInLayout = d->inLayout;
|
const bool wasInLayout = d->inLayout;
|
||||||
d->inLayout = true;
|
d->inLayout = true;
|
||||||
|
if (!d->extra.isAllocated() || !d->extra->explicitImplicitSize)
|
||||||
setImplicitWidth(naturalWidth + leftPadding() + rightPadding());
|
setImplicitWidth(naturalWidth + leftPadding() + rightPadding());
|
||||||
d->inLayout = wasInLayout;
|
d->inLayout = wasInLayout;
|
||||||
if (d->inLayout) // probably the result of a binding loop, but by letting it
|
if (d->inLayout) // probably the result of a binding loop, but by letting it
|
||||||
|
@ -2364,11 +2366,13 @@ void QQuickTextEdit::updateSize()
|
||||||
QFontMetricsF fm(d->font);
|
QFontMetricsF fm(d->font);
|
||||||
qreal newHeight = d->document->isEmpty() ? qCeil(fm.height()) : d->document->size().height();
|
qreal newHeight = d->document->isEmpty() ? qCeil(fm.height()) : d->document->size().height();
|
||||||
|
|
||||||
|
if (!d->extra.isAllocated() || !d->extra->explicitImplicitSize) {
|
||||||
// ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed.
|
// ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed.
|
||||||
if (!widthValid() && !d->requireImplicitWidth)
|
if (!widthValid() && !d->requireImplicitWidth)
|
||||||
setImplicitSize(newWidth + leftPadding() + rightPadding(), newHeight + topPadding() + bottomPadding());
|
setImplicitSize(newWidth + leftPadding() + rightPadding(), newHeight + topPadding() + bottomPadding());
|
||||||
else
|
else
|
||||||
setImplicitHeight(newHeight + topPadding() + bottomPadding());
|
setImplicitHeight(newHeight + topPadding() + bottomPadding());
|
||||||
|
}
|
||||||
|
|
||||||
d->xoff = leftPadding() + qMax(qreal(0), QQuickTextUtil::alignedX(d->document->size().width(), width() - leftPadding() - rightPadding(), effectiveHAlign()));
|
d->xoff = leftPadding() + qMax(qreal(0), QQuickTextUtil::alignedX(d->document->size().width(), width() - leftPadding() - rightPadding(), effectiveHAlign()));
|
||||||
d->yoff = topPadding() + QQuickTextUtil::alignedY(d->document->size().height(), height() - topPadding() - bottomPadding(), d->vAlign);
|
d->yoff = topPadding() + QQuickTextUtil::alignedY(d->document->size().height(), height() - topPadding() - bottomPadding(), d->vAlign);
|
||||||
|
|
|
@ -94,6 +94,7 @@ public:
|
||||||
bool explicitLeftPadding : 1;
|
bool explicitLeftPadding : 1;
|
||||||
bool explicitRightPadding : 1;
|
bool explicitRightPadding : 1;
|
||||||
bool explicitBottomPadding : 1;
|
bool explicitBottomPadding : 1;
|
||||||
|
bool explicitImplicitSize : 1;
|
||||||
};
|
};
|
||||||
QLazilyAllocated<ExtraData> extra;
|
QLazilyAllocated<ExtraData> extra;
|
||||||
|
|
||||||
|
|
|
@ -2518,6 +2518,7 @@ QQuickTextInputPrivate::ExtraData::ExtraData()
|
||||||
, explicitLeftPadding(false)
|
, explicitLeftPadding(false)
|
||||||
, explicitRightPadding(false)
|
, explicitRightPadding(false)
|
||||||
, explicitBottomPadding(false)
|
, explicitBottomPadding(false)
|
||||||
|
, explicitImplicitSize(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2820,6 +2821,7 @@ void QQuickTextInputPrivate::updateLayout()
|
||||||
line.setLineWidth(INT_MAX);
|
line.setLineWidth(INT_MAX);
|
||||||
const bool wasInLayout = inLayout;
|
const bool wasInLayout = inLayout;
|
||||||
inLayout = true;
|
inLayout = true;
|
||||||
|
if (!extra.isAllocated() || !extra->explicitImplicitSize)
|
||||||
q->setImplicitWidth(qCeil(line.naturalTextWidth()) + q->leftPadding() + q->rightPadding());
|
q->setImplicitWidth(qCeil(line.naturalTextWidth()) + q->leftPadding() + q->rightPadding());
|
||||||
inLayout = wasInLayout;
|
inLayout = wasInLayout;
|
||||||
if (inLayout) // probably the result of a binding loop, but by letting it
|
if (inLayout) // probably the result of a binding loop, but by letting it
|
||||||
|
@ -2851,10 +2853,12 @@ void QQuickTextInputPrivate::updateLayout()
|
||||||
q->polish();
|
q->polish();
|
||||||
q->update();
|
q->update();
|
||||||
|
|
||||||
|
if (!extra.isAllocated() || !extra->explicitImplicitSize) {
|
||||||
if (!requireImplicitWidth && !q->widthValid())
|
if (!requireImplicitWidth && !q->widthValid())
|
||||||
q->setImplicitSize(width + q->leftPadding() + q->rightPadding(), height + q->topPadding() + q->bottomPadding());
|
q->setImplicitSize(width + q->leftPadding() + q->rightPadding(), height + q->topPadding() + q->bottomPadding());
|
||||||
else
|
else
|
||||||
q->setImplicitHeight(height + q->topPadding() + q->bottomPadding());
|
q->setImplicitHeight(height + q->topPadding() + q->bottomPadding());
|
||||||
|
}
|
||||||
|
|
||||||
updateBaselineOffset();
|
updateBaselineOffset();
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ public:
|
||||||
bool explicitLeftPadding : 1;
|
bool explicitLeftPadding : 1;
|
||||||
bool explicitRightPadding : 1;
|
bool explicitRightPadding : 1;
|
||||||
bool explicitBottomPadding : 1;
|
bool explicitBottomPadding : 1;
|
||||||
|
bool explicitImplicitSize : 1;
|
||||||
};
|
};
|
||||||
QLazilyAllocated<ExtraData> extra;
|
QLazilyAllocated<ExtraData> extra;
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ QList<QQmlError> QQuickView::errors() const
|
||||||
QQmlError error;
|
QQmlError error;
|
||||||
error.setDescription(QLatin1String("QQuickView: invalid qml engine."));
|
error.setDescription(QLatin1String("QQuickView: invalid qml engine."));
|
||||||
errs << error;
|
errs << error;
|
||||||
} else if (d->component->status() == QQmlComponent::Ready && !d->root) {
|
} else if (d->component && d->component->status() == QQmlComponent::Ready && !d->root) {
|
||||||
QQmlError error;
|
QQmlError error;
|
||||||
error.setDescription(QLatin1String("QQuickView: invalid root object."));
|
error.setDescription(QLatin1String("QQuickView: invalid root object."));
|
||||||
errs << error;
|
errs << error;
|
||||||
|
|
|
@ -374,7 +374,7 @@ public:
|
||||||
return QMatrix4x4(matVals);
|
return QMatrix4x4(matVals);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMetaObject *getMetaObjectForMetaType(int type)
|
const QMetaObject *getMetaObjectForMetaType(int type) Q_DECL_OVERRIDE
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case QMetaType::QColor:
|
case QMetaType::QColor:
|
||||||
|
|
|
@ -137,6 +137,7 @@ public:
|
||||||
class Event : public QEvent {
|
class Event : public QEvent {
|
||||||
public:
|
public:
|
||||||
Event(ReadError, const QString &, const QSize &, AutoTransform, QQuickTextureFactory *factory);
|
Event(ReadError, const QString &, const QSize &, AutoTransform, QQuickTextureFactory *factory);
|
||||||
|
~Event();
|
||||||
|
|
||||||
ReadError error;
|
ReadError error;
|
||||||
QString errorString;
|
QString errorString;
|
||||||
|
@ -331,6 +332,11 @@ QQuickPixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSiz
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QQuickPixmapReply::Event::~Event()
|
||||||
|
{
|
||||||
|
delete textureFactory;
|
||||||
|
}
|
||||||
|
|
||||||
QNetworkAccessManager *QQuickPixmapReader::networkAccessManager()
|
QNetworkAccessManager *QQuickPixmapReader::networkAccessManager()
|
||||||
{
|
{
|
||||||
if (!accessManager) {
|
if (!accessManager) {
|
||||||
|
@ -1021,6 +1027,7 @@ bool QQuickPixmapReply::event(QEvent *event)
|
||||||
data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error;
|
data->pixmapStatus = (de->error == NoError) ? QQuickPixmap::Ready : QQuickPixmap::Error;
|
||||||
if (data->pixmapStatus == QQuickPixmap::Ready) {
|
if (data->pixmapStatus == QQuickPixmap::Ready) {
|
||||||
data->textureFactory = de->textureFactory;
|
data->textureFactory = de->textureFactory;
|
||||||
|
de->textureFactory = 0;
|
||||||
data->implicitSize = de->implicitSize;
|
data->implicitSize = de->implicitSize;
|
||||||
data->appliedTransform = de->autoTransform;
|
data->appliedTransform = de->autoTransform;
|
||||||
PIXMAP_PROFILE(pixmapLoadingFinished(data->url,
|
PIXMAP_PROFILE(pixmapLoadingFinished(data->url,
|
||||||
|
|
|
@ -133,6 +133,20 @@ void QQuickShortcut::setSequence(const QVariant &sequence)
|
||||||
emit sequenceChanged();
|
emit sequenceChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlproperty string QtQuick::Shortcut::sequenceString
|
||||||
|
\since 5.6
|
||||||
|
|
||||||
|
This property provides the shortcut's key sequence as a string,
|
||||||
|
for display purposes (tooltips, for example).
|
||||||
|
|
||||||
|
\sa sequence
|
||||||
|
*/
|
||||||
|
QString QQuickShortcut::sequenceString() const
|
||||||
|
{
|
||||||
|
return m_shortcut.toString(QKeySequence::NativeText);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty bool QtQuick::Shortcut::enabled
|
\qmlproperty bool QtQuick::Shortcut::enabled
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ class QQuickShortcut : public QObject, public QQmlParserStatus
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(QQmlParserStatus)
|
Q_INTERFACES(QQmlParserStatus)
|
||||||
Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
|
Q_PROPERTY(QVariant sequence READ sequence WRITE setSequence NOTIFY sequenceChanged FINAL)
|
||||||
|
Q_PROPERTY(QString sequenceString READ sequenceString NOTIFY sequenceChanged FINAL REVISION 1)
|
||||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
|
||||||
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
|
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
|
||||||
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
|
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext NOTIFY contextChanged FINAL)
|
||||||
|
@ -68,6 +69,8 @@ public:
|
||||||
QVariant sequence() const;
|
QVariant sequence() const;
|
||||||
void setSequence(const QVariant &sequence);
|
void setSequence(const QVariant &sequence);
|
||||||
|
|
||||||
|
Q_REVISION(1) QString sequenceString() const;
|
||||||
|
|
||||||
bool isEnabled() const;
|
bool isEnabled() const;
|
||||||
void setEnabled(bool enabled);
|
void setEnabled(bool enabled);
|
||||||
|
|
||||||
|
|
|
@ -114,4 +114,6 @@ void QQuickUtilModule::defineModule()
|
||||||
qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics");
|
qmlRegisterType<QQuickTextMetrics>("QtQuick", 2, 4, "TextMetrics");
|
||||||
|
|
||||||
qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut");
|
qmlRegisterType<QQuickShortcut>("QtQuick", 2, 5, "Shortcut");
|
||||||
|
|
||||||
|
qmlRegisterType<QQuickShortcut,1>("QtQuick", 2, 6, "Shortcut");
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,7 +566,7 @@ QList<QQmlError> QQuickWidget::errors() const
|
||||||
QQmlError error;
|
QQmlError error;
|
||||||
error.setDescription(QLatin1String("QQuickWidget: invalid qml engine."));
|
error.setDescription(QLatin1String("QQuickWidget: invalid qml engine."));
|
||||||
errs << error;
|
errs << error;
|
||||||
} else if (d->component->status() == QQmlComponent::Ready && !d->root) {
|
} else if (d->component && d->component->status() == QQmlComponent::Ready && !d->root) {
|
||||||
QQmlError error;
|
QQmlError error;
|
||||||
error.setDescription(QLatin1String("QQuickWidget: invalid root object."));
|
error.setDescription(QLatin1String("QQuickWidget: invalid root object."));
|
||||||
errs << error;
|
errs << error;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[importsPath]
|
||||||
|
windows
|
|
@ -0,0 +1,22 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
property string amText: Qt.inputMethod.locale.amText
|
||||||
|
property string decimalPoint: Qt.inputMethod.locale.decimalPoint
|
||||||
|
property string exponential: Qt.inputMethod.locale.exponential
|
||||||
|
property int firstDayOfWeek: Qt.inputMethod.locale.firstDayOfWeek
|
||||||
|
property string groupSeparator: Qt.inputMethod.locale.groupSeparator
|
||||||
|
property int measurementSystem: Qt.inputMethod.locale.measurementSystem
|
||||||
|
property string name: Qt.inputMethod.locale.name
|
||||||
|
property string nativeCountryName: Qt.inputMethod.locale.nativeCountryName
|
||||||
|
property string nativeLanguageName: Qt.inputMethod.locale.nativeLanguageName
|
||||||
|
property string negativeSign: Qt.inputMethod.locale.negativeSign
|
||||||
|
property string percent: Qt.inputMethod.locale.percent
|
||||||
|
property string pmText: Qt.inputMethod.locale.pmText
|
||||||
|
property string positiveSign: Qt.inputMethod.locale.positiveSign
|
||||||
|
property int textDirection: Qt.inputMethod.locale.textDirection
|
||||||
|
property var uiLanguages: Qt.inputMethod.locale.uiLanguages
|
||||||
|
property var weekDays: Qt.inputMethod.locale.weekDays
|
||||||
|
property string zeroDigit: Qt.inputMethod.locale.zeroDigit
|
||||||
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <QQmlComponent>
|
#include <QQmlComponent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <private/qquickvaluetypes_p.h>
|
#include <private/qquickvaluetypes_p.h>
|
||||||
|
#include <private/qqmlglobal_p.h>
|
||||||
#include "../../shared/util.h"
|
#include "../../shared/util.h"
|
||||||
#include "testtypes.h"
|
#include "testtypes.h"
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ private slots:
|
||||||
void font();
|
void font();
|
||||||
void color();
|
void color();
|
||||||
void variant();
|
void variant();
|
||||||
|
void locale();
|
||||||
|
|
||||||
void bindingAssignment();
|
void bindingAssignment();
|
||||||
void bindingRead();
|
void bindingRead();
|
||||||
|
@ -316,6 +318,42 @@ void tst_qqmlvaluetypes::variant()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_qqmlvaluetypes::locale()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
QQmlComponent component(&engine, testFileUrl("locale_read.qml"));
|
||||||
|
QScopedPointer<QObject> object(component.create());
|
||||||
|
QVERIFY(!object.isNull());
|
||||||
|
|
||||||
|
QVERIFY(QQml_guiProvider()->inputMethod());
|
||||||
|
QInputMethod *inputMethod = qobject_cast<QInputMethod*>(QQml_guiProvider()->inputMethod());
|
||||||
|
QLocale locale = inputMethod->locale();
|
||||||
|
|
||||||
|
QCOMPARE(object->property("amText").toString(), locale.amText());
|
||||||
|
QCOMPARE(object->property("decimalPoint").toString().at(0), locale.decimalPoint());
|
||||||
|
QCOMPARE(object->property("exponential").toString().at(0), locale.exponential());
|
||||||
|
// Sunday is 0 in JavaScript.
|
||||||
|
QCOMPARE(object->property("firstDayOfWeek").toInt(), int(locale.firstDayOfWeek() == Qt::Sunday ? 0 : locale.firstDayOfWeek()));
|
||||||
|
QCOMPARE(object->property("groupSeparator").toString().at(0), locale.groupSeparator());
|
||||||
|
QCOMPARE(object->property("measurementSystem").toInt(), int(locale.measurementSystem()));
|
||||||
|
QCOMPARE(object->property("name").toString(), locale.name());
|
||||||
|
QCOMPARE(object->property("nativeCountryName").toString(), locale.nativeCountryName());
|
||||||
|
QCOMPARE(object->property("nativeLanguageName").toString(), locale.nativeLanguageName());
|
||||||
|
QCOMPARE(object->property("negativeSign").toString().at(0), locale.negativeSign());
|
||||||
|
QCOMPARE(object->property("percent").toString().at(0), locale.percent());
|
||||||
|
QCOMPARE(object->property("pmText").toString(), locale.pmText());
|
||||||
|
QCOMPARE(object->property("positiveSign").toString().at(0), locale.positiveSign());
|
||||||
|
QCOMPARE(object->property("textDirection").toInt(), int(locale.textDirection()));
|
||||||
|
QCOMPARE(object->property("uiLanguages").toStringList(), locale.uiLanguages());
|
||||||
|
QList<Qt::DayOfWeek> weekDays;
|
||||||
|
foreach (const QVariant &weekDay, object->property("weekDays").toList()) {
|
||||||
|
weekDays.append(Qt::DayOfWeek(weekDay.toInt()));
|
||||||
|
}
|
||||||
|
QCOMPARE(weekDays, locale.weekdays());
|
||||||
|
QCOMPARE(object->property("zeroDigit").toString().at(0), locale.zeroDigit());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void tst_qqmlvaluetypes::sizereadonly()
|
void tst_qqmlvaluetypes::sizereadonly()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
HTTP/1.0 500 Internal Server Error
|
||||||
|
Connection: close
|
||||||
|
Content-type: text/html; charset=UTF-8
|
|
@ -989,6 +989,7 @@ void tst_qqmlxmlhttprequest::responseText_data()
|
||||||
QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
|
QTest::newRow("empty body") << testFileUrl("status.200.reply") << QUrl() << "";
|
||||||
QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
|
QTest::newRow("Not Found") << testFileUrl("status.404.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
|
||||||
QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
|
QTest::newRow("Bad Request") << testFileUrl("status.400.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
|
||||||
|
QTest::newRow("Internal server error") << testFileUrl("status.500.reply") << testFileUrl("testdocument.html") << "QML Rocks!\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_qqmlxmlhttprequest::nonUtf8()
|
void tst_qqmlxmlhttprequest::nonUtf8()
|
||||||
|
|
|
@ -338,19 +338,17 @@ void tst_QQuickWorkerScript::script_global()
|
||||||
delete worker;
|
delete worker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qquickworkerscript_lastWarning = QString();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
|
||||||
|
|
||||||
QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
|
QQmlComponent component(&m_engine, testFileUrl("worker_global2.qml"));
|
||||||
QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
|
QQuickWorkerScript *worker = qobject_cast<QQuickWorkerScript*>(component.create());
|
||||||
QVERIFY(worker != 0);
|
QVERIFY(worker != 0);
|
||||||
|
|
||||||
QString value("Hello");
|
|
||||||
|
|
||||||
QtMessageHandler previousMsgHandler = qInstallMessageHandler(qquickworkerscript_warningsHandler);
|
|
||||||
|
|
||||||
QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
|
|
||||||
|
|
||||||
QTRY_COMPARE(qquickworkerscript_lastWarning,
|
QTRY_COMPARE(qquickworkerscript_lastWarning,
|
||||||
testFileUrl("script_global.js").toString() + QLatin1String(":2: Invalid write to global property \"world\""));
|
testFileUrl("script_global2.js").toString() + QLatin1String(":1: Invalid write to global property \"world\""));
|
||||||
|
|
||||||
qInstallMessageHandler(previousMsgHandler);
|
qInstallMessageHandler(previousMsgHandler);
|
||||||
|
|
||||||
|
|
|
@ -182,4 +182,22 @@ Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestCase {
|
||||||
|
name: "Colors"
|
||||||
|
when: canvas.available
|
||||||
|
|
||||||
|
function test_colors() {
|
||||||
|
wait(100);
|
||||||
|
compare(contextSpy.count, 1);
|
||||||
|
|
||||||
|
var ctx = canvas.getContext("2d");
|
||||||
|
// QTBUG-47894
|
||||||
|
ctx.strokeStyle = 'hsl(255, 100%, 50%)';
|
||||||
|
var c1 = ctx.strokeStyle.toString();
|
||||||
|
ctx.strokeStyle = 'hsl(320, 100%, 50%)';
|
||||||
|
var c2 = ctx.strokeStyle.toString();
|
||||||
|
verify(c1 !== c2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,8 @@ void tst_qquickdesignersupport::statesPropertyChanges()
|
||||||
//Create new PropertyChanges
|
//Create new PropertyChanges
|
||||||
QQuickPropertyChanges *newPropertyChange = new QQuickPropertyChanges();
|
QQuickPropertyChanges *newPropertyChange = new QQuickPropertyChanges();
|
||||||
newPropertyChange->setParent(state01);
|
newPropertyChange->setParent(state01);
|
||||||
QQuickStatePrivate::operations_append(&state01->changes(), newPropertyChange);
|
QQmlListProperty<QQuickStateOperation> changes = state01->changes();
|
||||||
|
QQuickStatePrivate::operations_append(&changes, newPropertyChange);
|
||||||
|
|
||||||
newPropertyChange->setObject(rootItem);
|
newPropertyChange->setObject(rootItem);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ Rectangle {
|
||||||
property int current: grid.currentIndex
|
property int current: grid.currentIndex
|
||||||
property bool showHeader: false
|
property bool showHeader: false
|
||||||
property bool showFooter: false
|
property bool showFooter: false
|
||||||
|
property int currentItemChangedCount: 0
|
||||||
|
|
||||||
width: 240
|
width: 240
|
||||||
height: 320
|
height: 320
|
||||||
|
@ -63,5 +64,7 @@ Rectangle {
|
||||||
model: testModel
|
model: testModel
|
||||||
header: root.showHeader ? headerFooter : null
|
header: root.showHeader ? headerFooter : null
|
||||||
footer: root.showFooter ? headerFooter : null
|
footer: root.showFooter ? headerFooter : null
|
||||||
|
|
||||||
|
onCurrentItemChanged: { root.currentItemChangedCount++ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1886,9 +1886,12 @@ void tst_QQuickGridView::currentIndex()
|
||||||
QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY);
|
QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY);
|
||||||
|
|
||||||
// insert item before currentIndex
|
// insert item before currentIndex
|
||||||
|
window->rootObject()->setProperty("currentItemChangedCount", QVariant(0));
|
||||||
gridview->setCurrentIndex(28);
|
gridview->setCurrentIndex(28);
|
||||||
|
QTRY_COMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
|
||||||
model.insertItem(0, "Foo", "1111");
|
model.insertItem(0, "Foo", "1111");
|
||||||
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
|
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
|
||||||
|
QCOMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
|
||||||
|
|
||||||
// check removing highlight by setting currentIndex to -1;
|
// check removing highlight by setting currentIndex to -1;
|
||||||
gridview->setCurrentIndex(-1);
|
gridview->setCurrentIndex(-1);
|
||||||
|
|
|
@ -6,6 +6,7 @@ Rectangle {
|
||||||
property int current: list.currentIndex
|
property int current: list.currentIndex
|
||||||
property bool showHeader: false
|
property bool showHeader: false
|
||||||
property bool showFooter: false
|
property bool showFooter: false
|
||||||
|
property int currentItemChangedCount: 0
|
||||||
|
|
||||||
width: 240
|
width: 240
|
||||||
height: 320
|
height: 320
|
||||||
|
@ -60,5 +61,7 @@ Rectangle {
|
||||||
model: testModel
|
model: testModel
|
||||||
header: root.showHeader ? headerFooter : null
|
header: root.showHeader ? headerFooter : null
|
||||||
footer: root.showFooter ? headerFooter : null
|
footer: root.showFooter ? headerFooter : null
|
||||||
|
|
||||||
|
onCurrentItemChanged: { root.currentItemChangedCount++ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2718,9 +2718,12 @@ void tst_QQuickListView::currentIndex()
|
||||||
QTRY_COMPARE(listview->highlightItem()->y(), hlPos);
|
QTRY_COMPARE(listview->highlightItem()->y(), hlPos);
|
||||||
|
|
||||||
// insert item before currentIndex
|
// insert item before currentIndex
|
||||||
|
window->rootObject()->setProperty("currentItemChangedCount", QVariant(0));
|
||||||
listview->setCurrentIndex(28);
|
listview->setCurrentIndex(28);
|
||||||
|
QTRY_COMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
|
||||||
model.insertItem(0, "Foo", "1111");
|
model.insertItem(0, "Foo", "1111");
|
||||||
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
|
QTRY_COMPARE(window->rootObject()->property("current").toInt(), 29);
|
||||||
|
QCOMPARE(window->rootObject()->property("currentItemChangedCount").toInt(), 1);
|
||||||
|
|
||||||
// check removing highlight by setting currentIndex to -1;
|
// check removing highlight by setting currentIndex to -1;
|
||||||
listview->setCurrentIndex(-1);
|
listview->setCurrentIndex(-1);
|
||||||
|
|
|
@ -180,6 +180,10 @@ void tst_QQuickView::resizemodeitem()
|
||||||
|
|
||||||
void tst_QQuickView::errors()
|
void tst_QQuickView::errors()
|
||||||
{
|
{
|
||||||
|
{
|
||||||
|
QQuickView view;
|
||||||
|
QVERIFY(view.errors().isEmpty()); // don't crash
|
||||||
|
}
|
||||||
{
|
{
|
||||||
QQuickView view;
|
QQuickView view;
|
||||||
QQmlTestMessageHandler messageHandler;
|
QQmlTestMessageHandler messageHandler;
|
||||||
|
|
|
@ -223,6 +223,7 @@ void tst_qquickwidget::errors()
|
||||||
{
|
{
|
||||||
QQuickWidget *view = new QQuickWidget;
|
QQuickWidget *view = new QQuickWidget;
|
||||||
QScopedPointer<QQuickWidget> cleanupView(view);
|
QScopedPointer<QQuickWidget> cleanupView(view);
|
||||||
|
QVERIFY(view->errors().isEmpty()); // don't crash
|
||||||
|
|
||||||
QQmlTestMessageHandler messageHandler;
|
QQmlTestMessageHandler messageHandler;
|
||||||
view->setSource(testFileUrl("error1.qml"));
|
view->setSource(testFileUrl("error1.qml"));
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 0b5af3dcec772bb06b4d685a20b2859cda59d189
|
Subproject commit 9741ac4655808ac46c127e3d1d8ba3d27ada618e
|
|
@ -238,7 +238,7 @@ void LoadWatcher::checkForWindow(QObject *o)
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Q_UNUSED(o)
|
Q_UNUSED(o)
|
||||||
#endif // QT_GUI_LIB
|
#endif // QT_GUI_LIB && !QT_NO_OPENGL
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
|
#if defined(QT_GUI_LIB) && !defined(QT_NO_OPENGL)
|
||||||
|
@ -257,7 +257,7 @@ void LoadWatcher::onOpenGlContextCreated(QOpenGLContext *context)
|
||||||
puts(output.constData());
|
puts(output.constData());
|
||||||
context->doneCurrent();
|
context->doneCurrent();
|
||||||
}
|
}
|
||||||
#endif // QT_GUI_LIB
|
#endif // QT_GUI_LIB && !QT_NO_OPENGL
|
||||||
|
|
||||||
void quietMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg)
|
void quietMessageHandler(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -461,6 +461,12 @@ public:
|
||||||
void dumpComposite(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames)
|
void dumpComposite(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames)
|
||||||
{
|
{
|
||||||
QQmlComponent e(engine, compositeType->sourceUrl());
|
QQmlComponent e(engine, compositeType->sourceUrl());
|
||||||
|
if (!e.isReady()) {
|
||||||
|
std::cerr << "WARNING: skipping module " << compositeType->elementName().toStdString()
|
||||||
|
<< std::endl << e.errorString().toStdString() << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QObject *object = e.create();
|
QObject *object = e.create();
|
||||||
|
|
||||||
if (!object)
|
if (!object)
|
||||||
|
@ -901,6 +907,7 @@ void printDebugMessage(QtMsgType, const QMessageLogContext &, const QString &msg
|
||||||
// In case of QtFatalMsg the calling code will abort() when appropriate.
|
// In case of QtFatalMsg the calling code will abort() when appropriate.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_WIN) && !defined(Q_CC_MINGW)
|
#if defined(Q_OS_WIN) && !defined(Q_CC_MINGW)
|
||||||
|
@ -1041,6 +1048,7 @@ int main(int argc, char *argv[])
|
||||||
if (calculateDependencies)
|
if (calculateDependencies)
|
||||||
getDependencies(engine, pluginImportUri, pluginImportVersion, &dependencies);
|
getDependencies(engine, pluginImportUri, pluginImportVersion, &dependencies);
|
||||||
compactDependencies(&dependencies);
|
compactDependencies(&dependencies);
|
||||||
|
|
||||||
// load the QtQml 2.2 builtins and the dependencies
|
// load the QtQml 2.2 builtins and the dependencies
|
||||||
{
|
{
|
||||||
QByteArray code("import QtQml 2.2");
|
QByteArray code("import QtQml 2.2");
|
||||||
|
|
Loading…
Reference in New Issue