Merge remote-tracking branch 'origin/5.5' into 5.6

Change-Id: Ibc7a47f7ce6d15dff79fdc59f8ded297d1b8d50d
This commit is contained in:
Simon Hausmann 2015-09-02 17:19:03 +02:00
commit 149ece7a0c
9 changed files with 113 additions and 4 deletions

View File

@ -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.
*/

View File

@ -82,3 +82,13 @@
Your implementation of this function must be thread-safe, as it can be called from multiple threads
at the same time.
*/
/*!
\fn QQmlAbstractUrlInterceptor::QQmlAbstractUrlInterceptor()
Constructor for QQmlAbstractUrlInterceptor.
*/
/*!
\fn QQmlAbstractUrlInterceptor::~QQmlAbstractUrlInterceptor()
Destructor for QQmlAbstractUrlInterceptor.
*/

View File

@ -82,7 +82,8 @@ bool QQmlValueTypeFactoryImpl::isValueType(int idx)
&& idx != QVariant::StringList
&& idx != QMetaType::QObjectStar
&& idx != QMetaType::VoidStar
&& idx != QMetaType::QVariant) {
&& idx != QMetaType::QVariant
&& idx != QMetaType::QLocale) {
return true;
}

View File

@ -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.
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
handle we can access the same model data that is available in a delegate instance of that item and
with the \l {DelegateModelGroup::}{get()} function. Through the model property on this handle we can
access the same model data that is available in a delegate instance of that item and
compare against other items to determine relative position.
\snippet tutorials/dynamicview/dynamicview4/dynamicview.qml 3

View File

@ -189,7 +189,7 @@ QColor qt_color_from_string(const QV4::Value &name)
if (isRgb)
return QColor::fromRgba(qRgba(qClamp(rh, 0, 255), qClamp(gs, 0, 255), qClamp(bl, 0, 255), qClamp(alpha, 0, 255)));
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();
}

View File

@ -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
}

View File

@ -36,6 +36,7 @@
#include <QQmlComponent>
#include <QDebug>
#include <private/qquickvaluetypes_p.h>
#include <private/qqmlglobal_p.h>
#include "../../shared/util.h"
#include "testtypes.h"
@ -67,6 +68,7 @@ private slots:
void font();
void color();
void variant();
void locale();
void bindingAssignment();
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()
{
{

View File

@ -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);
}
}
}

View File

@ -461,6 +461,12 @@ public:
void dumpComposite(QQmlEngine *engine, const QQmlType *compositeType, QSet<QByteArray> &defaultReachableNames)
{
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();
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.
}
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN) && !defined(Q_CC_MINGW)
@ -1041,6 +1048,7 @@ int main(int argc, char *argv[])
if (calculateDependencies)
getDependencies(engine, pluginImportUri, pluginImportVersion, &dependencies);
compactDependencies(&dependencies);
// load the QtQml 2.2 builtins and the dependencies
{
QByteArray code("import QtQml 2.2");