summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.qmake.conf4
-rw-r--r--examples/script/context2d/environment.cpp2
-rw-r--r--examples/script/qstetrix/main.cpp1
-rw-r--r--src/script/api/qscriptvalueiterator.cpp12
-rw-r--r--src/script/doc/snippets/code/src_script_qscriptengine.cpp2
-rw-r--r--src/scripttools/debugging/qscriptbreakpointswidget.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggeragent_p_p.h4
-rw-r--r--src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggercodeview.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggercodewidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp4
-rw-r--r--src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerscriptswidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebuggerstackwidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptdebugoutputwidget.cpp2
-rw-r--r--src/scripttools/debugging/qscriptenginedebugger.cpp2
-rw-r--r--src/scripttools/debugging/qscripterrorlogwidget.cpp2
-rw-r--r--tests/auto/qscriptclass/tst_qscriptclass.cpp10
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp35
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp54
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp14
-rw-r--r--tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp4
24 files changed, 85 insertions, 87 deletions
diff --git a/.qmake.conf b/.qmake.conf
index 3d0f217..b6cbb69 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,6 +1,6 @@
load(qt_build_config)
android|boot2qt: CONFIG -= headersclean
-DEFINES += QT_NO_FOREACH
+DEFINES += QT_NO_FOREACH QT_NO_JAVA_STYLE_ITERATORS QT_NO_LINKED_LIST
-MODULE_VERSION = 5.13.2
+MODULE_VERSION = 5.14.0
diff --git a/examples/script/context2d/environment.cpp b/examples/script/context2d/environment.cpp
index 53b56fe..3afb759 100644
--- a/examples/script/context2d/environment.cpp
+++ b/examples/script/context2d/environment.cpp
@@ -506,7 +506,7 @@ QScriptValue Environment::newFakeDomEvent(const QString &type, const QScriptValu
e.setProperty("target", target, QScriptValue::ReadOnly);
e.setProperty("currentTarget", target, QScriptValue::ReadOnly);
e.setProperty("eventPhase", 3); // bubbling
- e.setProperty("timeStamp", QDateTime::currentDateTime().toTime_t());
+ e.setProperty("timeStamp", static_cast<int>(QDateTime::currentDateTime().toSecsSinceEpoch()));
// UIEvent
e.setProperty("detail", 0, QScriptValue::ReadOnly);
e.setProperty("view", m_engine->globalObject(), QScriptValue::ReadOnly);
diff --git a/examples/script/qstetrix/main.cpp b/examples/script/qstetrix/main.cpp
index 2d71048..43f32b4 100644
--- a/examples/script/qstetrix/main.cpp
+++ b/examples/script/qstetrix/main.cpp
@@ -148,7 +148,6 @@ int main(int argc, char *argv[])
ui->resize(550, 370);
ui->show();
- qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
return app.exec();
//! [4]
}
diff --git a/src/script/api/qscriptvalueiterator.cpp b/src/script/api/qscriptvalueiterator.cpp
index c470664..a1e3b21 100644
--- a/src/script/api/qscriptvalueiterator.cpp
+++ b/src/script/api/qscriptvalueiterator.cpp
@@ -28,14 +28,14 @@
#include "qscriptengine.h"
#include "qscriptengine_p.h"
#include "qscriptvalue_p.h"
-#include "qlinkedlist.h"
-
#include "JSObject.h"
#include "PropertyNameArray.h"
#include "JSArray.h"
#include "JSFunction.h"
+#include <list>
+
QT_BEGIN_NAMESPACE
/*!
@@ -118,16 +118,16 @@ public:
JSC::PropertyNameArray::const_iterator propertyNamesIt = propertyNamesArray.begin();
for(; propertyNamesIt != propertyNamesArray.end(); ++propertyNamesIt) {
- propertyNames.append(*propertyNamesIt);
+ propertyNames.push_back(*propertyNamesIt);
}
it = propertyNames.begin();
initialized = true;
}
QScriptValue objectValue;
- QLinkedList<JSC::Identifier> propertyNames;
- QLinkedList<JSC::Identifier>::iterator it;
- QLinkedList<JSC::Identifier>::iterator current;
+ std::list<JSC::Identifier> propertyNames;
+ std::list<JSC::Identifier>::iterator it;
+ std::list<JSC::Identifier>::iterator current;
bool initialized;
};
diff --git a/src/script/doc/snippets/code/src_script_qscriptengine.cpp b/src/script/doc/snippets/code/src_script_qscriptengine.cpp
index 8ccd9a0..ae9e35f 100644
--- a/src/script/doc/snippets/code/src_script_qscriptengine.cpp
+++ b/src/script/doc/snippets/code/src_script_qscriptengine.cpp
@@ -318,7 +318,7 @@ Q_DECLARE_METATYPE(QVector<int>)
qScriptRegisterSequenceMetaType<QVector<int> >(engine);
...
QVector<int> v = qscriptvalue_cast<QVector<int> >(engine->evaluate("[5, 1, 3, 2]"));
-qSort(v.begin(), v.end());
+std::sort(v.begin(), v.end());
QScriptValue a = engine->toScriptValue(v);
qDebug() << a.toString(); // outputs "[1, 2, 3, 5]"
//! [26]
diff --git a/src/scripttools/debugging/qscriptbreakpointswidget.cpp b/src/scripttools/debugging/qscriptbreakpointswidget.cpp
index aaac47e..51059e2 100644
--- a/src/scripttools/debugging/qscriptbreakpointswidget.cpp
+++ b/src/scripttools/debugging/qscriptbreakpointswidget.cpp
@@ -70,7 +70,7 @@ public:
system = QLatin1String("mac");
#else
hboxLayout->setSpacing(6);
- hboxLayout->setMargin(0);
+ hboxLayout->setContentsMargins(0, 0, 0, 0);
#endif
toolClose = new QToolButton(this);
@@ -311,7 +311,7 @@ QScriptBreakpointsWidget::QScriptBreakpointsWidget(QWidget *parent)
#endif
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
#ifndef QT_NO_TOOLBAR
vbox->addWidget(toolBar);
#endif
diff --git a/src/scripttools/debugging/qscriptdebuggeragent.cpp b/src/scripttools/debugging/qscriptdebuggeragent.cpp
index 5642dfe..7e25304 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent.cpp
+++ b/src/scripttools/debugging/qscriptdebuggeragent.cpp
@@ -559,7 +559,7 @@ void QScriptDebuggerAgent::positionChange(qint64 scriptId,
if (engine()->processEventsInterval() == -1) {
// see if it's time to call processEvents()
if ((++d->statementCounter % 25000) == 0) {
- if (!d->processEventsTimer.isNull()) {
+ if (d->processEventsTimer.isValid()) {
if (d->processEventsTimer.elapsed() > 30) {
QCoreApplication::processEvents();
d->processEventsTimer.restart();
diff --git a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
index 2e8be3a..1474032 100644
--- a/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
+++ b/src/scripttools/debugging/qscriptdebuggeragent_p_p.h
@@ -52,7 +52,7 @@
//
#include <QtScript/qscriptvalue.h>
-#include <QtCore/qdatetime.h>
+#include <QtCore/qelapsedtimer.h>
#include <QtCore/qhash.h>
#include <QtCore/qmap.h>
#include <QtCore/qlist.h>
@@ -113,7 +113,7 @@ public:
QList<qint64> checkpointContextIdStack;
qint64 nextContextId;
- QTime processEventsTimer;
+ QElapsedTimer processEventsTimer;
int statementCounter;
QScriptDebuggerBackendPrivate *backend;
diff --git a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
index 5f60db6..a538234 100644
--- a/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp
@@ -130,7 +130,7 @@ QScriptDebuggerCodeFinderWidget::QScriptDebuggerCodeFinderWidget(QWidget *parent
system = QLatin1String("mac");
#else
hboxLayout->setSpacing(6);
- hboxLayout->setMargin(0);
+ hboxLayout->setContentsMargins(0, 0, 0, 0);
#endif
d->toolClose = new QToolButton(this);
diff --git a/src/scripttools/debugging/qscriptdebuggercodeview.cpp b/src/scripttools/debugging/qscriptdebuggercodeview.cpp
index 7a3d8ed..19545b6 100644
--- a/src/scripttools/debugging/qscriptdebuggercodeview.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercodeview.cpp
@@ -79,7 +79,7 @@ QScriptDebuggerCodeView::QScriptDebuggerCodeView(QWidget *parent)
QObject::connect(d->editor, SIGNAL(breakpointEnableRequest(int,bool)),
this, SIGNAL(breakpointEnableRequest(int,bool)));
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(d->editor);
}
diff --git a/src/scripttools/debugging/qscriptdebuggercodewidget.cpp b/src/scripttools/debugging/qscriptdebuggercodewidget.cpp
index 68c127f..23e1bf6 100644
--- a/src/scripttools/debugging/qscriptdebuggercodewidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggercodewidget.cpp
@@ -202,7 +202,7 @@ QScriptDebuggerCodeWidget::QScriptDebuggerCodeWidget(QWidget *parent)
{
Q_D(QScriptDebuggerCodeWidget);
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
d->viewStack = new QStackedWidget();
vbox->addWidget(d->viewStack);
}
diff --git a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
index d1cdffc..5cf68b6 100644
--- a/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerconsolewidget.cpp
@@ -102,7 +102,7 @@ public:
inputEdit = new InputEdit();
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->setSpacing(0);
- hbox->setMargin(0);
+ hbox->setContentsMargins(0, 0, 0, 0);
hbox->addWidget(promptLabel);
hbox->addWidget(inputEdit);
@@ -323,7 +323,7 @@ QScriptDebuggerConsoleWidget::QScriptDebuggerConsoleWidget(QWidget *parent)
d->outputEdit = new QScriptDebuggerConsoleWidgetOutputEdit();
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setSpacing(0);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(d->outputEdit);
vbox->addWidget(d->commandLine);
diff --git a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
index 9068534..25ca0fb 100644
--- a/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerlocalsmodel.cpp
@@ -850,7 +850,7 @@ QVariant QScriptDebuggerLocalsModel::data(const QModelIndex &index, int role) co
else if (role == Qt::BackgroundRole) {
if (d->isTopLevelNode(node))
return QBrush(Qt::darkGray);
- } else if (role == Qt::TextColorRole) {
+ } else if (role == Qt::ForegroundRole) {
if (d->isTopLevelNode(node))
return QColor(Qt::white);
} else if (role == Qt::FontRole) {
diff --git a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
index 67069ce..3f11c87 100644
--- a/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerlocalswidget.cpp
@@ -359,7 +359,7 @@ QScriptDebuggerLocalsWidget::QScriptDebuggerLocalsWidget(QWidget *parent)
// d->view->header()->setResizeMode(QHeaderView::ResizeToContents);
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(d->view);
}
diff --git a/src/scripttools/debugging/qscriptdebuggerscriptswidget.cpp b/src/scripttools/debugging/qscriptdebuggerscriptswidget.cpp
index 83acb43..1ded58b 100644
--- a/src/scripttools/debugging/qscriptdebuggerscriptswidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerscriptswidget.cpp
@@ -107,7 +107,7 @@ QScriptDebuggerScriptsWidget::QScriptDebuggerScriptsWidget(QWidget *parent)
// d->view->header()->setResizeMode(QHeaderView::ResizeToContents);
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(d->view);
}
diff --git a/src/scripttools/debugging/qscriptdebuggerstackwidget.cpp b/src/scripttools/debugging/qscriptdebuggerstackwidget.cpp
index 2d5668a..f72968b 100644
--- a/src/scripttools/debugging/qscriptdebuggerstackwidget.cpp
+++ b/src/scripttools/debugging/qscriptdebuggerstackwidget.cpp
@@ -88,7 +88,7 @@ QScriptDebuggerStackWidget::QScriptDebuggerStackWidget(QWidget *parent)
// d->view->header()->setResizeMode(QHeaderView::ResizeToContents);
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(d->view);
}
diff --git a/src/scripttools/debugging/qscriptdebugoutputwidget.cpp b/src/scripttools/debugging/qscriptdebugoutputwidget.cpp
index 1560098..a522519 100644
--- a/src/scripttools/debugging/qscriptdebugoutputwidget.cpp
+++ b/src/scripttools/debugging/qscriptdebugoutputwidget.cpp
@@ -100,7 +100,7 @@ QScriptDebugOutputWidget::QScriptDebugOutputWidget(QWidget *parent)
Q_D(QScriptDebugOutputWidget);
d->outputEdit = new QScriptDebugOutputWidgetOutputEdit();
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->setSpacing(0);
vbox->addWidget(d->outputEdit);
diff --git a/src/scripttools/debugging/qscriptenginedebugger.cpp b/src/scripttools/debugging/qscriptenginedebugger.cpp
index 1b39b72..dbaffb3 100644
--- a/src/scripttools/debugging/qscriptenginedebugger.cpp
+++ b/src/scripttools/debugging/qscriptenginedebugger.cpp
@@ -591,7 +591,7 @@ QMainWindow *QScriptEngineDebugger::standardWindow() const
QWidget *central = new QWidget();
QVBoxLayout *vbox = new QVBoxLayout(central);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->addWidget(widget(CodeWidget));
vbox->addWidget(widget(CodeFinderWidget));
widget(CodeFinderWidget)->hide();
diff --git a/src/scripttools/debugging/qscripterrorlogwidget.cpp b/src/scripttools/debugging/qscripterrorlogwidget.cpp
index 7359f04..165f0fd 100644
--- a/src/scripttools/debugging/qscripterrorlogwidget.cpp
+++ b/src/scripttools/debugging/qscripterrorlogwidget.cpp
@@ -95,7 +95,7 @@ QScriptErrorLogWidget::QScriptErrorLogWidget(QWidget *parent)
Q_D(QScriptErrorLogWidget);
d->outputEdit = new QScriptErrorLogWidgetOutputEdit();
QVBoxLayout *vbox = new QVBoxLayout(this);
- vbox->setMargin(0);
+ vbox->setContentsMargins(0, 0, 0, 0);
vbox->setSpacing(0);
vbox->addWidget(d->outputEdit);
diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp
index 8242611..d7b9440 100644
--- a/tests/auto/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp
@@ -366,17 +366,17 @@ QVariant TestClass::extension(Extension extension,
}
return sum;
} else if (m_callableMode == CallableReturnsArgument) {
- return qVariantFromValue(ctx->argument(0));
+ return QVariant::fromValue(ctx->argument(0));
} else if (m_callableMode == CallableReturnsInvalidVariant) {
return QVariant();
} else if (m_callableMode == CallableReturnsGlobalObject) {
- return qVariantFromValue(engine()->globalObject());
+ return QVariant::fromValue(engine()->globalObject());
} else if (m_callableMode == CallableReturnsThisObject) {
- return qVariantFromValue(ctx->thisObject());
+ return QVariant::fromValue(ctx->thisObject());
} else if (m_callableMode == CallableReturnsCallee) {
- return qVariantFromValue(ctx->callee());
+ return QVariant::fromValue(ctx->callee());
} else if (m_callableMode == CallableReturnsArgumentsObject) {
- return qVariantFromValue(ctx->argumentsObject());
+ return QVariant::fromValue(ctx->argumentsObject());
} else if (m_callableMode == CallableInitializesThisObject) {
engine()->newQObject(ctx->thisObject(), engine());
return QVariant();
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 4d59e0d..434f35b 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -2057,13 +2057,13 @@ void tst_QScriptEngine::getSetDefaultPrototype_customType()
QCOMPARE(eng.defaultPrototype(qMetaTypeId<Foo>()).isValid(), false);
eng.setDefaultPrototype(qMetaTypeId<Foo>(), object);
QCOMPARE(eng.defaultPrototype(qMetaTypeId<Foo>()).strictlyEquals(object), true);
- QScriptValue value = eng.newVariant(qVariantFromValue(Foo()));
+ QScriptValue value = eng.newVariant(QVariant::fromValue(Foo()));
QCOMPARE(value.prototype().isObject(), true);
QCOMPARE(value.prototype().strictlyEquals(object), true);
eng.setDefaultPrototype(qMetaTypeId<Foo>(), QScriptValue());
QCOMPARE(eng.defaultPrototype(qMetaTypeId<Foo>()).isValid(), false);
- QScriptValue value2 = eng.newVariant(qVariantFromValue(Foo()));
+ QScriptValue value2 = eng.newVariant(QVariant::fromValue(Foo()));
QCOMPARE(value2.prototype().strictlyEquals(object), false);
}
@@ -2091,12 +2091,12 @@ static void fooFromScriptValueV2(const QScriptValue &value, Foo &foo)
foo.x = value.toInt32();
}
-Q_DECLARE_METATYPE(QLinkedList<QString>)
+Q_DECLARE_METATYPE(std::list<QString>)
Q_DECLARE_METATYPE(QList<Foo>)
Q_DECLARE_METATYPE(QVector<QChar>)
Q_DECLARE_METATYPE(QStack<int>)
Q_DECLARE_METATYPE(QQueue<char>)
-Q_DECLARE_METATYPE(QLinkedList<QStack<int> >)
+Q_DECLARE_METATYPE(std::list<QStack<int> >)
void tst_QScriptEngine::valueConversion_basic()
{
@@ -2215,11 +2215,10 @@ void tst_QScriptEngine::valueConversion_customType()
void tst_QScriptEngine::valueConversion_sequence()
{
QScriptEngine eng;
- qScriptRegisterSequenceMetaType<QLinkedList<QString> >(&eng);
+ qScriptRegisterSequenceMetaType<std::list<QString> >(&eng);
{
- QLinkedList<QString> lst;
- lst << QLatin1String("foo") << QLatin1String("bar");
+ std::list<QString> lst = {QLatin1String("foo"), QLatin1String("bar")};
QScriptValue lstVal = qScriptValueFromValue(&eng, lst);
QCOMPARE(lstVal.isArray(), true);
QCOMPARE(lstVal.property("length").toInt32(), 2);
@@ -2233,12 +2232,12 @@ void tst_QScriptEngine::valueConversion_sequence()
qScriptRegisterSequenceMetaType<QStack<int> >(&eng);
qScriptRegisterSequenceMetaType<QVector<QChar> >(&eng);
qScriptRegisterSequenceMetaType<QQueue<char> >(&eng);
- qScriptRegisterSequenceMetaType<QLinkedList<QStack<int> > >(&eng);
+ qScriptRegisterSequenceMetaType<std::list<QStack<int> > >(&eng);
{
- QLinkedList<QStack<int> > lst;
- QStack<int> first; first << 13 << 49; lst << first;
- QStack<int> second; second << 99999;lst << second;
+ QStack<int> first; first << 13 << 49;
+ QStack<int> second; second << 99999;
+ std::list<QStack<int> > lst = {first, second};
QScriptValue lstVal = qScriptValueFromValue(&eng, lst);
QCOMPARE(lstVal.isArray(), true);
QCOMPARE(lstVal.property("length").toInt32(), 2);
@@ -2251,7 +2250,7 @@ void tst_QScriptEngine::valueConversion_sequence()
QCOMPARE(lstVal.property("1").property("0").toInt32(), second.at(0));
QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("0")), first);
QCOMPARE(qscriptvalue_cast<QStack<int> >(lstVal.property("1")), second);
- QCOMPARE(qscriptvalue_cast<QLinkedList<QStack<int> > >(lstVal), lst);
+ QCOMPARE(qscriptvalue_cast<std::list<QStack<int> > >(lstVal), lst);
}
// pointers
@@ -2362,13 +2361,13 @@ void tst_QScriptEngine::valueConversion_QVariant()
QCOMPARE(val.toString(), str);
}
{
- QScriptValue val = qScriptValueFromValue(&eng, qVariantFromValue((QObject*)this));
+ QScriptValue val = qScriptValueFromValue(&eng, QVariant::fromValue((QObject*)this));
QVERIFY(!val.isVariant());
QVERIFY(val.isQObject());
QCOMPARE(val.toQObject(), (QObject*)this);
}
{
- QVariant var = qVariantFromValue(QPoint(123, 456));
+ QVariant var = QVariant::fromValue(QPoint(123, 456));
QScriptValue val = qScriptValueFromValue(&eng, var);
QVERIFY(val.isVariant());
QCOMPARE(val.toVariant(), var);
@@ -5784,7 +5783,7 @@ void tst_QScriptEngine::qRegExpInport()
}
}
-static QByteArray msgDateRoundtripJSQtJS(int i, uint secs,
+static QByteArray msgDateRoundtripJSQtJS(int i, qint64 secs,
const QScriptValue &jsDate2,
const QScriptValue &jsDate)
{
@@ -5804,7 +5803,7 @@ static QByteArray msgDateRoundtripJSQtJS(int i, uint secs,
// effect at a given date (QTBUG-9770).
void tst_QScriptEngine::dateRoundtripJSQtJS()
{
- uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ qint64 secs = QDateTime(QDate(2009, 1, 1)).toUTC().toSecsSinceEpoch();
QScriptEngine eng;
for (int i = 0; i < 8000; ++i) {
QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0 * 1000.0)").arg(secs));
@@ -5829,7 +5828,7 @@ void tst_QScriptEngine::dateRoundtripQtJSQt()
}
}
-static QByteArray msgDateConversionJSQt(int i, uint secs,
+static QByteArray msgDateConversionJSQt(int i, qint64 secs,
const QString &qtUTCDateStr,
const QString &jsUTCDateStr,
const QScriptValue &jsDate)
@@ -5844,7 +5843,7 @@ static QByteArray msgDateConversionJSQt(int i, uint secs,
void tst_QScriptEngine::dateConversionJSQt()
{
- uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t();
+ qint64 secs = QDateTime(QDate(2009, 1, 1)).toUTC().toSecsSinceEpoch();
QScriptEngine eng;
for (int i = 0; i < 8000; ++i) {
QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0 * 1000.0)").arg(secs));
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 58fee07..9d6c2fb 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -271,7 +271,7 @@ public:
Q_INVOKABLE QObject *myInvokableReturningQObjectStar()
{ m_qtFunctionInvoked = 13; return this; }
Q_INVOKABLE QObjectList myInvokableWithQObjectListArg(const QObjectList &lst)
- { m_qtFunctionInvoked = 14; m_actuals << qVariantFromValue(lst); return lst; }
+ { m_qtFunctionInvoked = 14; m_actuals << QVariant::fromValue(lst); return lst; }
Q_INVOKABLE QVariant myInvokableWithVariantArg(const QVariant &v)
{ m_qtFunctionInvoked = 15; m_actuals << v; return v; }
Q_INVOKABLE QVariantMap myInvokableWithVariantMapArg(const QVariantMap &vm)
@@ -279,37 +279,37 @@ public:
Q_INVOKABLE QVariantList myInvokableWithVariantListArg(const QVariantList &lst)
{ m_qtFunctionInvoked = 62; m_actuals.append(QVariant(lst)); return lst; }
Q_INVOKABLE QList<int> myInvokableWithListOfIntArg(const QList<int> &lst)
- { m_qtFunctionInvoked = 17; m_actuals << qVariantFromValue(lst); return lst; }
+ { m_qtFunctionInvoked = 17; m_actuals << QVariant::fromValue(lst); return lst; }
Q_INVOKABLE QObject* myInvokableWithQObjectStarArg(QObject *obj)
- { m_qtFunctionInvoked = 18; m_actuals << qVariantFromValue(obj); return obj; }
+ { m_qtFunctionInvoked = 18; m_actuals << QVariant::fromValue(obj); return obj; }
Q_INVOKABLE QBrush myInvokableWithQBrushArg(const QBrush &brush)
- { m_qtFunctionInvoked = 19; m_actuals << qVariantFromValue(brush); return brush; }
+ { m_qtFunctionInvoked = 19; m_actuals << QVariant::fromValue(brush); return brush; }
Q_INVOKABLE void myInvokableWithBrushStyleArg(Qt::BrushStyle style)
- { m_qtFunctionInvoked = 43; m_actuals << qVariantFromValue(style); }
+ { m_qtFunctionInvoked = 43; m_actuals << QVariant::fromValue(style); }
Q_INVOKABLE void myInvokableWithVoidStarArg(void *arg)
- { m_qtFunctionInvoked = 44; m_actuals << qVariantFromValue(arg); }
+ { m_qtFunctionInvoked = 44; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE void myInvokableWithAmbiguousArg(int arg)
- { m_qtFunctionInvoked = 45; m_actuals << qVariantFromValue(arg); }
+ { m_qtFunctionInvoked = 45; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE void myInvokableWithAmbiguousArg(uint arg)
- { m_qtFunctionInvoked = 46; m_actuals << qVariantFromValue(arg); }
+ { m_qtFunctionInvoked = 46; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE void myInvokableWithDefaultArgs(int arg1, const QString &arg2 = "")
- { m_qtFunctionInvoked = 47; m_actuals << qVariantFromValue(arg1) << qVariantFromValue(arg2); }
+ { m_qtFunctionInvoked = 47; m_actuals << QVariant::fromValue(arg1) << QVariant::fromValue(arg2); }
Q_INVOKABLE QObject& myInvokableReturningRef()
{ m_qtFunctionInvoked = 48; return *this; }
Q_INVOKABLE const QObject& myInvokableReturningConstRef() const
{ const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 49; return *this; }
Q_INVOKABLE void myInvokableWithPointArg(const QPoint &arg)
- { const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 50; m_actuals << qVariantFromValue(arg); }
+ { const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 50; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE void myInvokableWithPointArg(const QPointF &arg)
- { const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 51; m_actuals << qVariantFromValue(arg); }
+ { const_cast<MyQObject*>(this)->m_qtFunctionInvoked = 51; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE void myInvokableWithMyQObjectArg(MyQObject *arg)
- { m_qtFunctionInvoked = 52; m_actuals << qVariantFromValue((QObject*)arg); }
+ { m_qtFunctionInvoked = 52; m_actuals << QVariant::fromValue((QObject*)arg); }
Q_INVOKABLE MyQObject* myInvokableReturningMyQObject()
{ m_qtFunctionInvoked = 53; return this; }
Q_INVOKABLE void myInvokableWithConstMyQObjectArg(const MyQObject *arg)
- { m_qtFunctionInvoked = 54; m_actuals << qVariantFromValue((QObject*)arg); }
+ { m_qtFunctionInvoked = 54; m_actuals << QVariant::fromValue((QObject*)arg); }
Q_INVOKABLE void myInvokableWithQDirArg(const QDir &arg)
- { m_qtFunctionInvoked = 55; m_actuals << qVariantFromValue(arg); }
+ { m_qtFunctionInvoked = 55; m_actuals << QVariant::fromValue(arg); }
Q_INVOKABLE QScriptValue myInvokableWithScriptValueArg(const QScriptValue &arg)
{ m_qtFunctionInvoked = 56; return arg; }
Q_INVOKABLE QObject* myInvokableReturningMyQObjectAsQObject()
@@ -319,21 +319,21 @@ public:
Q_INVOKABLE MyQObject::Ability myInvokableWithQualifiedFlagsArg(MyQObject::Ability arg)
{ m_qtFunctionInvoked = 59; m_actuals << int(arg); return arg; }
Q_INVOKABLE QWidget *myInvokableWithQWidgetStarArg(QWidget *arg)
- { m_qtFunctionInvoked = 63; m_actuals << qVariantFromValue((QWidget*)arg); return arg; }
+ { m_qtFunctionInvoked = 63; m_actuals << QVariant::fromValue((QWidget*)arg); return arg; }
Q_INVOKABLE short myInvokableWithShortArg(short arg)
- { m_qtFunctionInvoked = 64; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 64; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE unsigned short myInvokableWithUShortArg(unsigned short arg)
- { m_qtFunctionInvoked = 65; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 65; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE char myInvokableWithCharArg(char arg)
- { m_qtFunctionInvoked = 66; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 66; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE unsigned char myInvokableWithUCharArg(unsigned char arg)
- { m_qtFunctionInvoked = 67; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 67; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE qulonglong myInvokableWithULonglongArg(qulonglong arg)
- { m_qtFunctionInvoked = 68; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 68; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE long myInvokableWithLongArg(long arg)
- { m_qtFunctionInvoked = 69; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 69; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE unsigned long myInvokableWithULongArg(unsigned long arg)
- { m_qtFunctionInvoked = 70; m_actuals << qVariantFromValue(arg); return arg; }
+ { m_qtFunctionInvoked = 70; m_actuals << QVariant::fromValue(arg); return arg; }
Q_INVOKABLE QObjectList findObjects() const
{ return findChildren<QObject *>(); }
@@ -378,7 +378,7 @@ public Q_SLOTS:
void myOverloadedSlot()
{ m_qtFunctionInvoked = 24; }
void myOverloadedSlot(QObject *arg)
- { m_qtFunctionInvoked = 41; m_actuals << qVariantFromValue(arg); }
+ { m_qtFunctionInvoked = 41; m_actuals << QVariant::fromValue(arg); }
void myOverloadedSlot(bool arg)
{ m_qtFunctionInvoked = 25; m_actuals << arg; }
void myOverloadedSlot(const QStringList &arg)
@@ -723,7 +723,7 @@ void tst_QScriptExtQObject::getSetStaticProperty_changeInCpp()
m_myObject->setVariantProperty(42);
QCOMPARE(m_engine->evaluate("myObject.variantProperty")
.toVariant(), QVariant(42));
- m_myObject->setVariantProperty(qVariantFromValue(QBrush()));
+ m_myObject->setVariantProperty(QVariant::fromValue(QBrush()));
QVERIFY(m_engine->evaluate("myObject.variantProperty").isVariant());
m_myObject->setStringProperty(QLatin1String("baz"));
@@ -837,7 +837,7 @@ void tst_QScriptExtQObject::getSetStaticProperty_compatibleVariantTypes()
QScriptValue mobj = m_engine->globalObject().property("myObject");
QVERIFY(m_myObject->propWithCustomType().string.isEmpty());
- mobj.setProperty("propWithCustomType", m_engine->newVariant(qVariantFromValue(t)));
+ mobj.setProperty("propWithCustomType", m_engine->newVariant(QVariant::fromValue(t)));
QVERIFY(m_myObject->propWithCustomType().string == t.string);
}
}
@@ -965,7 +965,7 @@ void tst_QScriptExtQObject::getSetStaticProperty_pointerDeref()
{
QBrush b = QColor(0xCA, 0xFE, 0xBA, 0xBE);
QBrush *bp = &b;
- QScriptValue bpValue = m_engine->newVariant(qVariantFromValue(bp));
+ QScriptValue bpValue = m_engine->newVariant(QVariant::fromValue(bp));
m_engine->globalObject().setProperty("brushPointer", bpValue);
{
QScriptValue ret = m_engine->evaluate("myObject.setBrushProperty(brushPointer)");
@@ -1413,7 +1413,7 @@ void tst_QScriptExtQObject::callQtInvokable3()
m_myObject->resetQtFunctionInvoked();
{
- m_myObject->setVariantProperty(qVariantFromValue(QBrush()));
+ m_myObject->setVariantProperty(QVariant::fromValue(QBrush()));
QScriptValue ret = m_engine->evaluate("myObject.myInvokableWithVariantArg(myObject.variantProperty)");
QVERIFY(ret.isVariant());
QCOMPARE(m_myObject->qtFunctionInvoked(), 15);
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index 195fe0c..0875fe6 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1352,7 +1352,7 @@ void tst_QScriptValue::toQObject_nonQObject_data()
QTest::newRow("array") << engine->newArray();
QTest::newRow("date") << engine->newDate(124);
QTest::newRow("variant(12345)") << engine->newVariant(12345);
- QTest::newRow("variant((QObject*)0)") << engine->newVariant(qVariantFromValue((QObject*)0));
+ QTest::newRow("variant((QObject*)0)") << engine->newVariant(QVariant::fromValue((QObject*)0));
QTest::newRow("newQObject(0)") << engine->newQObject(0);
}
@@ -1390,19 +1390,19 @@ void tst_QScriptValue::toQObject()
QCOMPARE(qscriptvalue_cast<QPushButton*>(qbutton), &button);
// wrapping a QObject* as variant
- QScriptValue variant = eng.newVariant(qVariantFromValue((QObject*)&button));
+ QScriptValue variant = eng.newVariant(QVariant::fromValue((QObject*)&button));
QCOMPARE(variant.toQObject(), (QObject*)&button);
QCOMPARE(qscriptvalue_cast<QObject*>(variant), (QObject*)&button);
QCOMPARE(qscriptvalue_cast<QWidget*>(variant), (QWidget*)&button);
QCOMPARE(qscriptvalue_cast<QPushButton*>(variant), &button);
- QScriptValue variant2 = eng.newVariant(qVariantFromValue((QWidget*)&button));
+ QScriptValue variant2 = eng.newVariant(QVariant::fromValue((QWidget*)&button));
QCOMPARE(variant2.toQObject(), (QObject*)&button);
QCOMPARE(qscriptvalue_cast<QObject*>(variant2), (QObject*)&button);
QCOMPARE(qscriptvalue_cast<QWidget*>(variant2), (QWidget*)&button);
QCOMPARE(qscriptvalue_cast<QPushButton*>(variant2), &button);
- QScriptValue variant3 = eng.newVariant(qVariantFromValue(&button));
+ QScriptValue variant3 = eng.newVariant(QVariant::fromValue(&button));
QVERIFY(variant3.isQObject());
QCOMPARE(variant3.toQObject(), (QObject*)&button);
QCOMPARE(qscriptvalue_cast<QObject*>(variant3), (QObject*)&button);
@@ -1524,7 +1524,7 @@ void tst_QScriptValue::toDateTime()
QDateTime dt = eng.evaluate("new Date(0)").toDateTime();
QVERIFY(dt.isValid());
QCOMPARE(dt.timeSpec(), Qt::LocalTime);
- QCOMPARE(dt.toUTC(), QDateTime(QDate(1970, 1, 1), QTime(0, 0, 0), Qt::UTC));
+ QCOMPARE(dt.toUTC(), QDateTime::fromMSecsSinceEpoch(0, Qt::UTC));
QVERIFY(!eng.evaluate("[]").toDateTime().isValid());
QVERIFY(!eng.evaluate("{}").toDateTime().isValid());
@@ -3580,7 +3580,7 @@ void tst_QScriptValue::castToPointer()
double *dp = qscriptvalue_cast<double*>(v);
QVERIFY(dp == 0);
- QScriptValue v2 = eng.newVariant(qVariantFromValue(ip));
+ QScriptValue v2 = eng.newVariant(QVariant::fromValue(ip));
QCOMPARE(qscriptvalue_cast<int*>(v2), ip);
}
{
@@ -3593,7 +3593,7 @@ void tst_QScriptValue::castToPointer()
QBrush *bp = qscriptvalue_cast<QBrush*>(v);
QVERIFY(bp == 0);
- QScriptValue v2 = eng.newVariant(qVariantFromValue(cp));
+ QScriptValue v2 = eng.newVariant(QVariant::fromValue(cp));
QCOMPARE(qscriptvalue_cast<QColor*>(v2), cp);
}
}
diff --git a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
index bdb5e1e..a8826a2 100644
--- a/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
+++ b/tests/benchmarks/script/qscriptqobject/tst_qscriptqobject.cpp
@@ -565,8 +565,8 @@ void tst_QScriptQObject::readDynamicProperty_data()
QTest::newRow("int") << QVariant(123);
QTest::newRow("double") << QVariant(double(123.0));
QTest::newRow("string") << QVariant(QString::fromLatin1("hello"));
- QTest::newRow("QObject*") << qVariantFromValue((QObject*)this);
- QTest::newRow("CustomType") << qVariantFromValue(CustomType());
+ QTest::newRow("QObject*") << QVariant::fromValue((QObject*)this);
+ QTest::newRow("CustomType") << QVariant::fromValue(CustomType());
}
// Reads a dynamic property from JS. The purpose of this benchmark is