summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsgridview.cpp8
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsitem.cpp4
-rw-r--r--src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp2
-rw-r--r--src/declarative/graphicsitems/qmlgraphicswebview.cpp2
-rw-r--r--src/declarative/qml/parser/qmljsgrammar_p.h2
-rw-r--r--src/declarative/qml/parser/qmljslexer.cpp20
-rw-r--r--src/declarative/qml/parser/qmljsparser.cpp14
-rw-r--r--src/declarative/qml/qmlcompiler.cpp187
-rw-r--r--src/declarative/qml/qmlcomponent.cpp6
-rw-r--r--src/declarative/qml/qmldom.cpp2
-rw-r--r--src/declarative/qml/qmlengine.cpp40
-rw-r--r--src/declarative/qml/qmlenginedebug.cpp10
-rw-r--r--src/declarative/qml/qmlerror.cpp4
-rw-r--r--src/declarative/qml/qmlexpression.h2
-rw-r--r--src/declarative/qml/qmlglobalscriptclass.cpp2
-rw-r--r--src/declarative/qml/qmlinfo.cpp12
-rw-r--r--src/declarative/qml/qmlmetaproperty.cpp10
-rw-r--r--src/declarative/qml/qmlmetatype.cpp2
-rw-r--r--src/declarative/qml/qmlmetatype.h14
-rw-r--r--src/declarative/qml/qmlobjectscriptclass.cpp4
-rw-r--r--src/declarative/qml/qmlsqldatabase.cpp2
-rw-r--r--src/declarative/qml/qmlvme.cpp24
-rw-r--r--src/declarative/qml/qmlworkerscript.cpp14
-rw-r--r--src/declarative/qml/qmlworkerscript_p.h3
-rw-r--r--src/declarative/qml/qmlxmlhttprequest.cpp2
-rw-r--r--src/declarative/util/qmlanimation.cpp2
-rw-r--r--src/declarative/util/qmllistaccessor.cpp4
-rw-r--r--src/declarative/util/qmllistmodel.cpp2
-rw-r--r--src/declarative/util/qmlpropertychanges.cpp4
-rw-r--r--src/declarative/util/qmlsystempalette.cpp4
-rw-r--r--src/declarative/util/qmlxmllistmodel.cpp4
31 files changed, 202 insertions, 210 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
index f4d94aa..7279ea6 100644
--- a/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsgridview.cpp
@@ -317,10 +317,10 @@ public:
QmlEaseFollow *highlightXAnimator;
QmlEaseFollow *highlightYAnimator;
- int ownModel : 1;
- int wrap : 1;
- int autoHighlight : 1;
- int fixCurrentVisibility : 1;
+ bool ownModel : 1;
+ bool wrap : 1;
+ bool autoHighlight : 1;
+ bool fixCurrentVisibility : 1;
};
void QmlGraphicsGridViewPrivate::init()
diff --git a/src/declarative/graphicsitems/qmlgraphicsitem.cpp b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
index 68a565d..ef4dfc2 100644
--- a/src/declarative/graphicsitems/qmlgraphicsitem.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsitem.cpp
@@ -1266,7 +1266,7 @@ QVariant QmlGraphicsKeysAttached::inputMethodQuery(Qt::InputMethodQuery query) c
QGraphicsItem *i = d->finalFocusProxy(d->targets.at(ii));
if (i && (i->flags() & QGraphicsItem::ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check?
QVariant v = static_cast<QmlGraphicsItemAccessor *>(i)->doInputMethodQuery(query);
- if (v.type() == QVariant::RectF)
+ if (v.userType() == QVariant::RectF)
v = d->item->mapRectFromItem(i, v.toRectF()); //### cost?
return v;
}
@@ -2990,7 +2990,7 @@ QDebug operator<<(QDebug debug, QmlGraphicsItem *item)
debug << item->metaObject()->className() << "(this =" << ((void*)item)
<< ", parent =" << ((void*)item->parentItem())
<< ", geometry =" << QRectF(item->pos(), QSizeF(item->width(), item->height()))
- << ", z =" << item->zValue() << ")";
+ << ", z =" << item->zValue() << ')';
return debug;
}
diff --git a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp b/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
index 3fd14bb..f50b79b 100644
--- a/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicsscalegrid.cpp
@@ -133,7 +133,7 @@ QmlGraphicsGridScaledImage::QmlGraphicsGridScaledImage(QIODevice *data)
while(!data->atEnd()) {
QString line = QString::fromUtf8(data->readLine().trimmed());
- if (line.isEmpty() || line.startsWith(QLatin1String("#")))
+ if (line.isEmpty() || line.startsWith(QLatin1Char('#')))
continue;
QStringList list = line.split(QLatin1Char(':'));
diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
index d2b8289..1fdf557 100644
--- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp
@@ -1186,7 +1186,7 @@ QmlGraphicsWebPage::~QmlGraphicsWebPage()
void QmlGraphicsWebPage::javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
{
- qWarning() << sourceID << ":" << lineNumber << ":" << message;
+ qWarning() << sourceID << ':' << lineNumber << ':' << message;
}
QString QmlGraphicsWebPage::chooseFile(QWebFrame *originatingFrame, const QString& oldFile)
diff --git a/src/declarative/qml/parser/qmljsgrammar_p.h b/src/declarative/qml/parser/qmljsgrammar_p.h
index d607e8d..3717a1f 100644
--- a/src/declarative/qml/parser/qmljsgrammar_p.h
+++ b/src/declarative/qml/parser/qmljsgrammar_p.h
@@ -169,7 +169,7 @@ public:
};
static const char *const spell [];
- static const int lhs [];
+ static const unsigned char lhs [];
static const int rhs [];
static const int goto_default [];
static const int action_default [];
diff --git a/src/declarative/qml/parser/qmljslexer.cpp b/src/declarative/qml/parser/qmljslexer.cpp
index e9ea604..cf3ed34 100644
--- a/src/declarative/qml/parser/qmljslexer.cpp
+++ b/src/declarative/qml/parser/qmljslexer.cpp
@@ -49,7 +49,7 @@
#include "qmljsengine_p.h"
#include "qmljsgrammar_p.h"
-#include <QtGui/qapplication.h>
+#include <QtCore/qcoreapplication.h>
#include <ctype.h>
#include <stdlib.h>
@@ -551,7 +551,7 @@ int Lexer::lex()
else {
setDone(Bad);
err = IllegalCharacter;
- errmsg = qApp->translate("QmlParser", "Illegal character");
+ errmsg = QCoreApplication::translate("QmlParser", "Illegal character");
}
}
break;
@@ -565,7 +565,7 @@ int Lexer::lex()
} else if (current == 0 || isLineTerminator()) {
setDone(Bad);
err = UnclosedStringLiteral;
- errmsg = qApp->translate("QmlParser", "Unclosed string at end of line");
+ errmsg = QCoreApplication::translate("QmlParser", "Unclosed string at end of line");
} else if (current == '\\') {
state = InEscapeSequence;
} else {
@@ -591,7 +591,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalEscapeSequence;
- errmsg = qApp->translate("QmlParser", "Illegal escape squence");
+ errmsg = QCoreApplication::translate("QmlParser", "Illegal escape squence");
}
} else if (current == 'x')
state = InHexEscape;
@@ -637,7 +637,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalUnicodeEscapeSequence;
- errmsg = qApp->translate("QmlParser", "Illegal unicode escape sequence");
+ errmsg = QCoreApplication::translate("QmlParser", "Illegal unicode escape sequence");
}
break;
case InSingleLineComment:
@@ -663,7 +663,7 @@ int Lexer::lex()
if (current == 0) {
setDone(Bad);
err = UnclosedComment;
- errmsg = qApp->translate("QmlParser", "Unclosed comment at end of file");
+ errmsg = QCoreApplication::translate("QmlParser", "Unclosed comment at end of file");
driver->addComment(startpos, tokenLength(), startlineno, startcolumn);
} else if (isLineTerminator()) {
shiftWindowsLineBreak();
@@ -750,7 +750,7 @@ int Lexer::lex()
} else {
setDone(Bad);
err = IllegalExponentIndicator;
- errmsg = qApp->translate("QmlParser", "Illegal syntax for exponential number");
+ errmsg = QCoreApplication::translate("QmlParser", "Illegal syntax for exponential number");
}
break;
case InExponent:
@@ -776,7 +776,7 @@ int Lexer::lex()
&& isIdentLetter(current)) {
state = Bad;
err = IllegalIdentifier;
- errmsg = qApp->translate("QmlParser", "Identifier cannot start with numeric literal");
+ errmsg = QCoreApplication::translate("QmlParser", "Identifier cannot start with numeric literal");
}
// terminate string
@@ -1107,7 +1107,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (1) {
if (isLineTerminator() || current == 0) {
- errmsg = qApp->translate("QmlParser", "Unterminated regular expression literal");
+ errmsg = QCoreApplication::translate("QmlParser", "Unterminated regular expression literal");
return false;
}
else if (current != '/' || lastWasEscape == true)
@@ -1131,7 +1131,7 @@ bool Lexer::scanRegExp(RegExpBodyPrefix prefix)
while (isIdentLetter(current)) {
int flag = Ecma::RegExp::flagFromChar(current);
if (flag == 0) {
- errmsg = qApp->translate("QmlParser", "Invalid regular expression flag '%0'")
+ errmsg = QCoreApplication::translate("QmlParser", "Invalid regular expression flag '%0'")
.arg(QChar(current));
return false;
}
diff --git a/src/declarative/qml/parser/qmljsparser.cpp b/src/declarative/qml/parser/qmljsparser.cpp
index 7a81557..8ca3c30 100644
--- a/src/declarative/qml/parser/qmljsparser.cpp
+++ b/src/declarative/qml/parser/qmljsparser.cpp
@@ -49,7 +49,7 @@
#include "qmljsnodepool_p.h"
#include <QtCore/QtDebug>
-#include <QtGui/QApplication>
+#include <QtCore/QCoreApplication>
#include <QVarLengthArray>
#include <string.h>
@@ -266,7 +266,7 @@ case 18: {
QString text;
for (AST::UiQualifiedId *q = qualifiedId; q; q = q->next) {
text += q->name->asString();
- if (q->next) text += QLatin1String(".");
+ if (q->next) text += QLatin1Char('.');
}
node = makeAstNode<AST::UiImport>(driver->nodePool(), qualifiedId);
node->fileNameToken = loc(2);
@@ -1722,7 +1722,7 @@ case 337: {
yylloc.startColumn += yylloc.length;
yylloc.length = 0;
- //const QString msg = qApp->translate("QmlParser", "Missing `;'");
+ //const QString msg = QCoreApplication::translate("QmlParser", "Missing `;'");
//diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg));
first_token = &token_buffer[0];
@@ -1747,7 +1747,7 @@ case 337: {
token_buffer[1].loc = yylloc = location(lexer);
if (t_action(errorState, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
+ const QString msg = QCoreApplication::translate("QmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token_buffer[0].token]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
action = errorState;
@@ -1775,7 +1775,7 @@ case 337: {
for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) {
int a = t_action(errorState, *tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
+ const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = *tk;
@@ -1798,7 +1798,7 @@ case 337: {
int a = t_action(errorState, tk);
if (a > 0 && t_action(a, yytoken)) {
- const QString msg = qApp->translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
+ const QString msg = QCoreApplication::translate("QmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk]));
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
yytoken = tk;
@@ -1811,7 +1811,7 @@ case 337: {
}
}
- const QString msg = qApp->translate("QmlParser", "Syntax error");
+ const QString msg = QCoreApplication::translate("QmlParser", "Syntax error");
diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg));
}
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp
index 2404702..108e3cc 100644
--- a/src/declarative/qml/qmlcompiler.cpp
+++ b/src/declarative/qml/qmlcompiler.cpp
@@ -74,7 +74,7 @@
#include <QRectF>
#include <QAtomicInt>
#include <QtCore/qdebug.h>
-#include <QtGui/qapplication.h>
+#include <QCoreApplication>
QT_BEGIN_NAMESPACE
@@ -165,7 +165,7 @@ bool QmlCompiler::isSignalPropertyName(const QByteArray &name)
For example:
\code
- COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name)));
+ COMPILE_EXCEPTION(property, QCoreApplication::translate("QmlCompiler","Error for property \"%1\"").arg(QString::fromUtf8(property->name)));
\endcode
*/
#define COMPILE_EXCEPTION(token, desc) \
@@ -203,7 +203,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
QString string = v->value.asScript();
if (!prop.isWritable())
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop.name())));
if (prop.isEnumType()) {
int value;
@@ -212,7 +212,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
} else
value = prop.enumerator().keyToValue(string.toUtf8().constData());
if (value == -1)
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unknown enumeration"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unknown enumeration"));
return true;
}
int type = prop.userType();
@@ -220,61 +220,61 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
case -1:
break;
case QVariant::String:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: string expected"));
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: string expected"));
break;
case QVariant::Url:
- if (!v->value.isString()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: url expected"));
+ if (!v->value.isString()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: url expected"));
break;
case QVariant::UInt:
{
bool ok;
string.toUInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsigned int expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unsigned int expected"));
}
break;
case QVariant::Int:
{
bool ok;
string.toInt(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: int expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: int expected"));
}
break;
case QMetaType::Float:
{
bool ok;
string.toFloat(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: float expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: float expected"));
}
break;
case QVariant::Double:
{
bool ok;
string.toDouble(&ok);
- if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: double expected"));
+ if (!v->value.isNumber() || !ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: double expected"));
}
break;
case QVariant::Color:
{
QColor c = QmlStringConverters::colorFromString(string);
- if (!c.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: color expected"));
+ if (!c.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: color expected"));
}
break;
case QVariant::Date:
{
QDate d = QDate::fromString(string, Qt::ISODate);
- if (!d.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: date expected"));
+ if (!d.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: date expected"));
}
break;
case QVariant::Time:
{
QTime time = QTime::fromString(string, Qt::ISODate);
- if (!time.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: time expected"));
+ if (!time.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: time expected"));
}
break;
case QVariant::DateTime:
{
QDateTime dateTime = QDateTime::fromString(string, Qt::ISODate);
- if (!dateTime.isValid()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: datetime expected"));
+ if (!dateTime.isValid()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: datetime expected"));
}
break;
case QVariant::Point:
@@ -282,7 +282,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QPointF point = QmlStringConverters::pointFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: point expected"));
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: point expected"));
}
break;
case QVariant::Size:
@@ -290,7 +290,7 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QSizeF size = QmlStringConverters::sizeFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: size expected"));
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: size expected"));
}
break;
case QVariant::Rect:
@@ -298,30 +298,28 @@ bool QmlCompiler::testLiteralAssignment(const QMetaProperty &prop,
{
bool ok;
QRectF rect = QmlStringConverters::rectFFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: rect expected"));
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: rect expected"));
}
break;
case QVariant::Bool:
{
- if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: boolean expected"));
+ if (!v->value.isBoolean()) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: boolean expected"));
}
break;
case QVariant::Vector3D:
{
bool ok;
QVector3D point = QmlStringConverters::vector3DFromString(string, &ok);
- if (!ok) COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: 3D vector expected"));
+ if (!ok) COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: 3D vector expected"));
}
break;
default:
{
- int t = prop.type();
- if (t == QVariant::UserType)
- t = prop.userType();
+ int t = prop.userType();
QmlMetaType::StringConverter converter =
QmlMetaType::customStringConverter(t);
if (!converter)
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type()))));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid property assignment: unsupported type \"%1\"").arg(QString::fromLatin1(QVariant::typeToName(prop.type()))));
}
break;
}
@@ -517,9 +515,7 @@ void QmlCompiler::genLiteralAssignment(const QMetaProperty &prop,
break;
default:
{
- int t = prop.type();
- if (t == QVariant::UserType)
- t = prop.userType();
+ int t = prop.userType();
int index = output->customTypeData.count();
instr.type = QmlInstruction::AssignCustomType;
instr.assignCustomType.propertyIndex = prop.propertyIndex();
@@ -1046,22 +1042,22 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
Property *idProp = 0;
if (obj->properties.count() > 1 ||
(obj->properties.count() == 1 && obj->properties.begin().key() != "id"))
- COMPILE_EXCEPTION(*obj->properties.begin(), qApp->translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(*obj->properties.begin(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
if (!obj->scriptBlockObjects.isEmpty())
- COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), qApp->translate("QmlCompiler","Invalid component specification"));
+ COMPILE_EXCEPTION(obj->scriptBlockObjects.first(), QCoreApplication::translate("QmlCompiler","Invalid component specification"));
if (obj->properties.count())
idProp = *obj->properties.begin();
if (idProp && (idProp->value || idProp->values.count() > 1 || !isValidId(idProp->values.first()->primitive())))
- COMPILE_EXCEPTION(idProp, qApp->translate("QmlCompiler","Invalid component id specification"));
+ COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QmlCompiler","Invalid component id specification"));
if (idProp) {
QString idVal = idProp->values.first()->primitive();
if (compileState.ids.contains(idVal))
- COMPILE_EXCEPTION(idProp, qApp->translate("QmlCompiler","id is not unique"));
+ COMPILE_EXCEPTION(idProp, QCoreApplication::translate("QmlCompiler","id is not unique"));
obj->id = idVal;
addId(idVal, obj);
@@ -1071,14 +1067,14 @@ bool QmlCompiler::buildComponent(QmlParser::Object *obj,
if (obj->defaultProperty &&
(obj->defaultProperty->value || obj->defaultProperty->values.count() > 1 ||
(obj->defaultProperty->values.count() == 1 && !obj->defaultProperty->values.first()->object)))
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid component body specification"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Invalid component body specification"));
Object *root = 0;
if (obj->defaultProperty && obj->defaultProperty->values.count())
root = obj->defaultProperty->values.first()->object;
if (!root)
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Cannot create empty component specification"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Cannot create empty component specification"));
// Build the component tree
COMPILE_CHECK(buildComponentFromRoot(root, ctxt));
@@ -1095,11 +1091,11 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
Property *source = *script->properties.begin();
if (script->defaultProperty)
- COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script block. Specify either the source property or inline script"));
+ COMPILE_EXCEPTION(source, QCoreApplication::translate("QmlCompiler","Invalid Script block. Specify either the source property or inline script"));
if (source->value || source->values.count() != 1 ||
source->values.at(0)->object || !source->values.at(0)->value.isStringList())
- COMPILE_EXCEPTION(source, qApp->translate("QmlCompiler","Invalid Script source value"));
+ COMPILE_EXCEPTION(source, QCoreApplication::translate("QmlCompiler","Invalid Script source value"));
QStringList sources = source->values.at(0)->value.asStringList();
@@ -1123,7 +1119,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
}
} else if (!script->properties.isEmpty()) {
- COMPILE_EXCEPTION(*script->properties.begin(), qApp->translate("QmlCompiler","Properties cannot be set on Script block"));
+ COMPILE_EXCEPTION(*script->properties.begin(), QCoreApplication::translate("QmlCompiler","Properties cannot be set on Script block"));
} else if (script->defaultProperty) {
QString scriptCode;
@@ -1137,7 +1133,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
if (lineNumber == 1)
lineNumber = v->location.start.line;
if (v->object || !v->value.isString())
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Invalid Script block"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Invalid Script block"));
if (ii == 0) {
currentLocation = v->location.start;
@@ -1145,7 +1141,7 @@ bool QmlCompiler::buildScript(QmlParser::Object *obj, QmlParser::Object *script)
}
while (currentLocation.line < v->location.start.line) {
- scriptCode.append(QLatin1String("\n"));
+ scriptCode.append(QLatin1Char('\n'));
currentLocation.line++;
currentLocation.column = 0;
}
@@ -1267,7 +1263,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
} else {
if (prop->value || prop->values.count() > 1)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Incorrectly specified signal"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Incorrectly specified signal"));
prop->index = sigIdx;
obj->addSignalProperty(prop);
@@ -1280,7 +1276,7 @@ bool QmlCompiler::buildSignal(QmlParser::Property *prop, QmlParser::Object *obj,
QString script = prop->values.at(0)->value.asScript().trimmed();
if (script.isEmpty())
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty signal assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Empty signal assignment"));
}
}
@@ -1316,7 +1312,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
const BindingContext &ctxt)
{
if (prop->isEmpty())
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Empty property assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Empty property assignment"));
const QMetaObject *metaObject = obj->metaObject();
Q_ASSERT(metaObject);
@@ -1328,7 +1324,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
// Attached properties cannot be used on sub-objects. Sub-objects
// always exist in a binding sub-context, which is what we test
// for here.
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Attached properties cannot be used here"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Attached properties cannot be used here"));
}
QmlType *type = 0;
@@ -1343,11 +1339,11 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
ctxt));
return true;
} else if (!type || !type->attachedPropertiesType()) {
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
}
if (!prop->value)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1376,12 +1372,7 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
// We can't error here as the "id" property does not require a
// successful index resolution
if (p.name()) {
- int t = p.type();
-
- if (t == QVariant::UserType)
- t = p.userType();
-
- prop->type = t;
+ prop->type = p.userType();
}
}
@@ -1405,9 +1396,9 @@ bool QmlCompiler::buildProperty(QmlParser::Property *prop,
} else if (prop->index == -1) {
if (prop->isDefault) {
- COMPILE_EXCEPTION(prop->values.first(), qApp->translate("QmlCompiler","Cannot assign to non-existant default property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant default property"));
} else {
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
}
} else if (prop->value) {
@@ -1439,12 +1430,12 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
const BindingContext &ctxt)
{
if (!nsProp->value)
- COMPILE_EXCEPTION(nsProp, qApp->translate("QmlCompiler","Invalid use of namespace"));
+ COMPILE_EXCEPTION(nsProp, QCoreApplication::translate("QmlCompiler","Invalid use of namespace"));
foreach (Property *prop, nsProp->value->properties) {
if (!isAttachedPropertyName(prop->name))
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Not an attached property name"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Not an attached property name"));
// Setup attached property data
@@ -1453,10 +1444,10 @@ QmlCompiler::buildPropertyInNamespace(QmlEnginePrivate::ImportedNamespace *ns,
&type, 0, 0, 0);
if (!type || !type->attachedPropertiesType())
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Non-existant attached object"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Non-existant attached object"));
if (!prop->value)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid attached object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid attached object assignment"));
Q_ASSERT(type->attachedPropertiesFunction());
prop->index = type->index();
@@ -1626,13 +1617,13 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
if (prop->value ||
prop->values.count() > 1 ||
prop->values.at(0)->object)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid use of id property"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid use of id property"));
QmlParser::Value *idValue = prop->values.at(0);
QString val = idValue->primitive();
if (!isValidId(val))
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","\"%1\" is not a valid object id").arg(val));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","\"%1\" is not a valid object id").arg(val));
// We disallow id's that conflict with import prefixes and types
QmlEnginePrivate::ImportedNamespace *ns = 0;
@@ -1640,12 +1631,12 @@ bool QmlCompiler::buildIdProperty(QmlParser::Property *prop,
QmlEnginePrivate::get(engine)->resolveType(unit->imports, val.toUtf8(),
&type, 0, 0, 0, &ns);
if (type)
- COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with type name"));
+ COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QmlCompiler","id conflicts with type name"));
if (ns)
- COMPILE_EXCEPTION(idValue, qApp->translate("QmlCompiler","id conflicts with namespace prefix"));
+ COMPILE_EXCEPTION(idValue, QCoreApplication::translate("QmlCompiler","id conflicts with namespace prefix"));
if (compileState.ids.contains(val))
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","id is not unique"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","id is not unique"));
prop->values.at(0)->type = Value::Id;
@@ -1720,7 +1711,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
Q_ASSERT(prop->index != -1);
if (prop->values.count())
- COMPILE_EXCEPTION(prop->values.first(), qApp->translate("QmlCompiler", "Invalid value in grouped property"));
+ COMPILE_EXCEPTION(prop->values.first(), QCoreApplication::translate("QmlCompiler", "Invalid value in grouped property"));
if (prop->type < (int)QVariant::UserType) {
QmlEnginePrivate *ep =
@@ -1730,7 +1721,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
prop->value, obj, ctxt.incr()));
obj->addValueTypeProperty(prop);
} else {
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid grouped property access"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid grouped property access"));
}
} else {
@@ -1738,7 +1729,7 @@ bool QmlCompiler::buildGroupedProperty(QmlParser::Property *prop,
prop->value->metatype =
QmlEnginePrivate::get(engine)->metaObjectForType(prop->type);
if (!prop->value->metatype)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid grouped property access"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid grouped property access"));
obj->addGroupedProperty(prop);
@@ -1754,22 +1745,22 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
const BindingContext &ctxt)
{
if (obj->defaultProperty)
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Invalid property use"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Invalid property use"));
obj->metatype = type->metaObject();
foreach (Property *prop, obj->properties) {
int idx = type->metaObject()->indexOfProperty(prop->name.constData());
if (idx == -1)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(prop->name)));
QMetaProperty p = type->metaObject()->property(idx);
prop->index = idx;
prop->type = p.userType();
if (prop->value)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Property assignment expected"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Property assignment expected"));
if (prop->values.count() != 1)
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Single property assignment expected"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Single property assignment expected"));
Value *value = prop->values.at(0);
@@ -1777,7 +1768,7 @@ bool QmlCompiler::buildValueTypeProperty(QObject *type,
bool isPropertyValue = output->types.at(value->object->type).type->propertyValueSourceCast() != -1;
bool isPropertyInterceptor = output->types.at(value->object->type).type->propertyValueInterceptorCast() != -1;
if (!isPropertyValue && !isPropertyInterceptor) {
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Unexpected object assignment"));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Unexpected object assignment"));
} else {
COMPILE_CHECK(buildObject(value->object, ctxt));
@@ -1835,12 +1826,12 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
// at runtime.
if (!listTypeIsInterface) {
if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
}
}
} else {
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign primitives to lists"));
}
}
@@ -1859,19 +1850,19 @@ bool QmlCompiler::buildListProperty(QmlParser::Property *prop,
// at runtime.
if (!listTypeIsInterface) {
if (!canCoerce(listType, v->object)) {
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign object to list"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign object to list"));
}
}
} else if (v->value.isScript()) {
if (assignedBinding)
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Can only assign one binding to lists"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Can only assign one binding to lists"));
assignedBinding = true;
COMPILE_CHECK(buildBinding(v, prop, ctxt));
v->type = Value::PropertyBinding;
} else {
- COMPILE_EXCEPTION(v, qApp->translate("QmlCompiler","Cannot assign primitives to lists"));
+ COMPILE_EXCEPTION(v, QCoreApplication::translate("QmlCompiler","Cannot assign primitives to lists"));
}
}
@@ -1886,10 +1877,10 @@ bool QmlCompiler::buildScriptStringProperty(QmlParser::Property *prop,
const BindingContext &ctxt)
{
if (prop->values.count() > 1)
- COMPILE_EXCEPTION(prop->values.at(1), qApp->translate("QmlCompiler", "Cannot assign multiple values to a script property"));
+ COMPILE_EXCEPTION(prop->values.at(1), QCoreApplication::translate("QmlCompiler", "Cannot assign multiple values to a script property"));
if (prop->values.at(0)->object || !prop->values.at(0)->value.isScript())
- COMPILE_EXCEPTION(prop->values.at(0), qApp->translate("QmlCompiler", "Invalid property assignment: script expected"));
+ COMPILE_EXCEPTION(prop->values.at(0), QCoreApplication::translate("QmlCompiler", "Invalid property assignment: script expected"));
obj->addScriptStringProperty(prop, ctxt.stack);
@@ -2015,7 +2006,7 @@ bool QmlCompiler::buildPropertyObjectAssignment(QmlParser::Property *prop,
buildDynamicMeta(prop->parent, ForceCreation);
v->type = isPropertyValue ? Value::ValueSource : Value::ValueInterceptor;
} else {
- COMPILE_EXCEPTION(v->object, qApp->translate("QmlCompiler","Cannot assign object to property"));
+ COMPILE_EXCEPTION(v->object, QCoreApplication::translate("QmlCompiler","Cannot assign object to property"));
}
}
@@ -2060,12 +2051,12 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
if (prop.isDefaultProperty) {
if (seenDefaultProperty)
- COMPILE_EXCEPTION(&prop, qApp->translate("QmlCompiler","Duplicate default property"));
+ COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QmlCompiler","Duplicate default property"));
seenDefaultProperty = true;
}
if (propNames.contains(prop.name))
- COMPILE_EXCEPTION(&prop, qApp->translate("QmlCompiler","Duplicate property name"));
+ COMPILE_EXCEPTION(&prop, QCoreApplication::translate("QmlCompiler","Duplicate property name"));
propNames.insert(prop.name);
}
@@ -2073,13 +2064,13 @@ bool QmlCompiler::checkDynamicMeta(QmlParser::Object *obj)
for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
QByteArray name = obj->dynamicSignals.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate signal name"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Duplicate signal name"));
methodNames.insert(name);
}
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
QByteArray name = obj->dynamicSlots.at(ii).name;
if (methodNames.contains(name))
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","Duplicate method name"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","Duplicate method name"));
methodNames.insert(name);
}
@@ -2101,7 +2092,7 @@ bool QmlCompiler::mergeDynamicMetaProperties(QmlParser::Object *obj)
property = obj->getProperty(p.name);
if (property->value)
- COMPILE_EXCEPTION(property, qApp->translate("QmlCompiler","Invalid property nesting"));
+ COMPILE_EXCEPTION(property, QCoreApplication::translate("QmlCompiler","Invalid property nesting"));
for (int ii = 0; ii < p.defaultValue->values.count(); ++ii) {
Value *v = p.defaultValue->values.at(ii);
@@ -2147,7 +2138,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
if (-1 != propIdx) {
QMetaProperty prop = obj->metaObject()->property(propIdx);
if (prop.isFinal())
- COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Cannot override FINAL property"));
+ COMPILE_EXCEPTION(&p, QCoreApplication::translate("QmlCompiler","Cannot override FINAL property"));
}
if (p.isDefaultProperty &&
@@ -2172,7 +2163,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
QmlEnginePrivate *priv = QmlEnginePrivate::get(engine);
if (!priv->resolveType(unit->imports, p.customType, &qmltype,
&url, 0, 0, 0))
- COMPILE_EXCEPTION(&p, qApp->translate("QmlCompiler","Invalid property type"));
+ COMPILE_EXCEPTION(&p, QCoreApplication::translate("QmlCompiler","Invalid property type"));
if (!qmltype) {
QmlCompositeTypeData *tdata = priv->typeManager.get(url);
@@ -2186,7 +2177,7 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
}
if (p.type == Object::DynamicProperty::Custom) {
- type = customTypeName + "*";
+ type = customTypeName + '*';
propertyType = QMetaType::QObjectStar;
} else {
readonly = true;
@@ -2255,12 +2246,12 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
for (int ii = 0; ii < obj->dynamicSignals.count(); ++ii) {
const Object::DynamicSignal &s = obj->dynamicSignals.at(ii);
- QByteArray sig(s.name + "(");
+ QByteArray sig(s.name + '(');
for (int jj = 0; jj < s.parameterTypes.count(); ++jj) {
- if (jj) sig.append(",");
+ if (jj) sig.append(',');
sig.append(s.parameterTypes.at(jj));
}
- sig.append(")");
+ sig.append(')');
QMetaMethodBuilder b = builder.addSignal(sig);
b.setParameterNames(s.parameterNames);
((QmlVMEMetaData *)dynamicData.data())->signalCount++;
@@ -2268,12 +2259,12 @@ bool QmlCompiler::buildDynamicMeta(QmlParser::Object *obj, DynamicMetaMode mode)
for (int ii = 0; ii < obj->dynamicSlots.count(); ++ii) {
const Object::DynamicSlot &s = obj->dynamicSlots.at(ii);
- QByteArray sig(s.name + "(");
+ QByteArray sig(s.name + '(');
for (int jj = 0; jj < s.parameterNames.count(); ++jj) {
- if (jj) sig.append(",");
+ if (jj) sig.append(',');
sig.append("QVariant");
}
- sig.append(")");
+ sig.append(')');
QMetaMethodBuilder b = builder.addSlot(sig);
b.setReturnType("QVariant");
b.setParameterNames(s.parameterNames);
@@ -2333,24 +2324,24 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
const Object::DynamicProperty &prop)
{
if (!prop.defaultValue)
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location"));
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","No property alias location"));
if (prop.defaultValue->values.count() != 1 ||
prop.defaultValue->values.at(0)->object ||
!prop.defaultValue->values.at(0)->value.isScript())
- COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
QmlJS::AST::Node *node = prop.defaultValue->values.at(0)->value.asAST();
if (!node)
- COMPILE_EXCEPTION(obj, qApp->translate("QmlCompiler","No property alias location")); // ### Can this happen?
+ COMPILE_EXCEPTION(obj, QCoreApplication::translate("QmlCompiler","No property alias location")); // ### Can this happen?
QStringList alias = astNodeToStringList(node);
if (alias.count() != 1 && alias.count() != 2)
- COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
if (!compileState.ids.contains(alias.at(0)))
- COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
Object *idObject = compileState.ids[alias.at(0)];
@@ -2363,7 +2354,7 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
propIdx = idObject->metaObject()->indexOfProperty(alias.at(1).toUtf8().constData());
if (-1 == propIdx)
- COMPILE_EXCEPTION(prop.defaultValue, qApp->translate("QmlCompiler","Invalid alias location"));
+ COMPILE_EXCEPTION(prop.defaultValue, QCoreApplication::translate("QmlCompiler","Invalid alias location"));
QMetaProperty aliasProperty = idObject->metaObject()->property(propIdx);
writable = aliasProperty.isWritable();
@@ -2374,7 +2365,7 @@ bool QmlCompiler::compileAlias(QMetaObjectBuilder &builder,
typeName = aliasProperty.typeName();
} else {
typeName = idObject->metaObject()->className();
- typeName += "*";
+ typeName += '*';
}
if (typeName.endsWith('*'))
@@ -2402,7 +2393,7 @@ bool QmlCompiler::buildBinding(QmlParser::Value *value,
QMetaProperty mp = prop->parent->metaObject()->property(prop->index);
if (!mp.isWritable() && !QmlMetaType::isList(prop->type))
- COMPILE_EXCEPTION(prop, qApp->translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
+ COMPILE_EXCEPTION(prop, QCoreApplication::translate("QmlCompiler","Invalid property assignment: \"%1\" is a read-only property").arg(QString::fromUtf8(prop->name)));
BindingReference reference;
reference.expression = value->value;
diff --git a/src/declarative/qml/qmlcomponent.cpp b/src/declarative/qml/qmlcomponent.cpp
index b66e026..0bd51c3 100644
--- a/src/declarative/qml/qmlcomponent.cpp
+++ b/src/declarative/qml/qmlcomponent.cpp
@@ -499,9 +499,9 @@ QString QmlComponent::errorsString() const
if(!isError())
return ret;
foreach(const QmlError &e, d->errors) {
- ret += e.url().toString() + QLatin1String(":") +
- QString::number(e.line()) + QLatin1String(" ") +
- e.description() + QLatin1String("\n");
+ ret += e.url().toString() + QLatin1Char(':') +
+ QString::number(e.line()) + QLatin1Char(' ') +
+ e.description() + QLatin1Char('\n');
}
return ret;
}
diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp
index 8812c31..705c0cf 100644
--- a/src/declarative/qml/qmldom.cpp
+++ b/src/declarative/qml/qmldom.cpp
@@ -611,7 +611,7 @@ QmlDomObjectPrivate::properties(QmlParser::Property *property) const
}
- QByteArray name(property->name + ".");
+ QByteArray name(property->name + '.');
for (Properties::Iterator iter = rv.begin(); iter != rv.end(); ++iter)
iter->second.prepend(name);
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index ce5b4a4..3e7ac8e 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -505,7 +505,7 @@ QmlDeclarativeData::QmlDeclarativeData(QmlContext *ctxt)
{
}
-void QmlDeclarativeData::destroyed(QObject *object)
+void QmlDeclarativeData::destroyed(QObject * /*object*/)
{
if (deferredComponent)
deferredComponent->release();
@@ -767,9 +767,9 @@ QScriptValue QmlEnginePrivate::lighter(QScriptContext *ctxt, QScriptEngine *engi
return engine->nullValue();
QVariant v = ctxt->argument(0).toVariant();
QColor color;
- if (v.type() == QVariant::Color)
+ if (v.userType() == QVariant::Color)
color = v.value<QColor>();
- else if (v.type() == QVariant::String) {
+ else if (v.userType() == QVariant::String) {
bool ok;
color = QmlStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
@@ -786,9 +786,9 @@ QScriptValue QmlEnginePrivate::darker(QScriptContext *ctxt, QScriptEngine *engin
return engine->nullValue();
QVariant v = ctxt->argument(0).toVariant();
QColor color;
- if (v.type() == QVariant::Color)
+ if (v.userType() == QVariant::Color)
color = v.value<QColor>();
- else if (v.type() == QVariant::String) {
+ else if (v.userType() == QVariant::String) {
bool ok;
color = QmlStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
@@ -877,7 +877,7 @@ QScriptValue QmlEnginePrivate::consoleLog(QScriptContext *ctxt, QScriptEngine *e
// does just ignore the format letter, which makes it pointless.
}
- qDebug("%s",msg.data());
+ qDebug(msg.constData());
return e->newVariant(QVariant(true));
}
@@ -888,7 +888,7 @@ void QmlEnginePrivate::sendQuit ()
emit q->quit ();
}
-QScriptValue QmlEnginePrivate::quit(QScriptContext *ctxt, QScriptEngine *e)
+QScriptValue QmlEnginePrivate::quit(QScriptContext * /*ctxt*/, QScriptEngine *e)
{
QmlEnginePrivate *qe = get (e);
qe->sendQuit ();
@@ -921,9 +921,9 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
//get color
QVariant v = ctxt->argument(0).toVariant();
QColor color;
- if (v.type() == QVariant::Color)
+ if (v.userType() == QVariant::Color)
color = v.value<QColor>();
- else if (v.type() == QVariant::String) {
+ else if (v.userType() == QVariant::String) {
bool ok;
color = QmlStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
@@ -934,9 +934,9 @@ QScriptValue QmlEnginePrivate::tint(QScriptContext *ctxt, QScriptEngine *engine)
//get tint color
v = ctxt->argument(1).toVariant();
QColor tintColor;
- if (v.type() == QVariant::Color)
+ if (v.userType() == QVariant::Color)
tintColor = v.value<QColor>();
- else if (v.type() == QVariant::String) {
+ else if (v.userType() == QVariant::String) {
bool ok;
tintColor = QmlStringConverters::colorFromString(v.toString(), &ok);
if (!ok)
@@ -1037,7 +1037,7 @@ struct QmlEnginePrivate::ImportedNamespace {
if (isBuiltin.at(i)) {
QByteArray qt = urls.at(i).toUtf8();
- qt += "/";
+ qt += '/';
qt += type;
QmlType *t = QmlMetaType::qmlType(qt,vmaj,vmin);
if (vmajor) *vmajor = vmaj;
@@ -1048,7 +1048,7 @@ struct QmlEnginePrivate::ImportedNamespace {
return true;
}
} else {
- QUrl url = QUrl(urls.at(i) + QLatin1String("/") + QString::fromUtf8(type) + QLatin1String(".qml"));
+ QUrl url = QUrl(urls.at(i) + QLatin1Char('/') + QString::fromUtf8(type) + QLatin1String(".qml"));
QString qmldircontent = qmlDirContent.at(i);
if (vmaj || vmin || !qmldircontent.isEmpty()) {
// Check version file - XXX cache these in QmlEngine!
@@ -1167,7 +1167,7 @@ public:
if (s->find(unqualifiedtype,vmajor,vminor,type_return,url_return))
return true;
if (s->urls.count() == 1 && !s->isBuiltin[0] && !s->isLibrary[0] && url_return) {
- *url_return = QUrl(s->urls[0]+QLatin1String("/")).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
+ *url_return = QUrl(s->urls[0]+QLatin1Char('/')).resolved(QUrl(QString::fromUtf8(unqualifiedtype) + QLatin1String(".qml")));
return true;
}
}
@@ -1188,7 +1188,7 @@ public:
int ref;
private:
- friend class QmlEnginePrivate::Imports;
+ friend struct QmlEnginePrivate::Imports;
QmlEnginePrivate::ImportedNamespace unqualifiedset;
QHash<QString,QmlEnginePrivate::ImportedNamespace* > set;
};
@@ -1233,7 +1233,7 @@ static QmlTypeNameCache *cacheForNamespace(QmlEngine *engine, const QmlEnginePri
if (!set.isBuiltin.at(ii))
continue;
- QByteArray base = set.urls.at(ii).toUtf8() + "/";
+ QByteArray base = set.urls.at(ii).toUtf8() + '/';
int major = set.majversions.at(ii);
int minor = set.minversions.at(ii);
@@ -1375,7 +1375,7 @@ bool QmlEnginePrivate::addToImport(Imports* imports, const QString& qmldirconten
{
bool ok = imports->d->add(imports->d->base,qmldircontent,uri,prefix,vmaj,vmin,importType,fileImportPath);
if (qmlImportTrace())
- qDebug() << "QmlEngine::addToImport(" << imports << uri << prefix << vmaj << "." << vmin << (importType==QmlScriptParser::Import::Library? "Library" : "File") << ": " << ok;
+ qDebug() << "QmlEngine::addToImport(" << imports << uri << prefix << vmaj << '.' << vmin << (importType==QmlScriptParser::Import::Library? "Library" : "File") << ": " << ok;
return ok;
}
@@ -1405,9 +1405,9 @@ bool QmlEnginePrivate::resolveType(const Imports& imports, const QByteArray& typ
if (imports.d->find(type,vmaj,vmin,type_return,url_return)) {
if (qmlImportTrace()) {
if (type_return && *type_return)
- qDebug() << "QmlEngine::resolveType" << type << "=" << (*type_return)->typeName();
+ qDebug() << "QmlEngine::resolveType" << type << '=' << (*type_return)->typeName();
if (url_return)
- qDebug() << "QmlEngine::resolveType" << type << "=" << *url_return;
+ qDebug() << "QmlEngine::resolveType" << type << '=' << *url_return;
}
return true;
}
@@ -1451,7 +1451,7 @@ void QmlEnginePrivate::registerCompositeType(QmlCompiledData *data)
{
QByteArray name = data->root->className();
- QByteArray ptr = name + "*";
+ QByteArray ptr = name + '*';
QByteArray lst = "QmlList<" + ptr + ">*";
int ptr_type = QMetaType::registerType(ptr.constData(), voidptr_destructor,
diff --git a/src/declarative/qml/qmlenginedebug.cpp b/src/declarative/qml/qmlenginedebug.cpp
index 034e4f5..6cb57b2 100644
--- a/src/declarative/qml/qmlenginedebug.cpp
+++ b/src/declarative/qml/qmlenginedebug.cpp
@@ -115,7 +115,7 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
QVariant value = prop.read(obj);
rv.value = valueContents(value);
- if (prop.type() < QVariant::UserType) {
+ if (prop.userType() < QVariant::UserType) {
rv.type = QmlObjectProperty::Basic;
} else if (QmlMetaType::isObject(prop.userType())) {
rv.type = QmlObjectProperty::Object;
@@ -129,10 +129,10 @@ QmlEngineDebugServer::propertyData(QObject *obj, int propIdx)
QVariant QmlEngineDebugServer::valueContents(const QVariant &value) const
{
- if (value.type() < QVariant::UserType)
+ int userType = value.userType();
+ if (userType < QVariant::UserType)
return value;
- int userType = value.userType();
if (QmlMetaType::isList(userType) || QmlMetaType::isQmlList(userType)) {
int count = QmlMetaType::listCount(value);
@@ -189,7 +189,7 @@ void QmlEngineDebugServer::buildObjectDump(QDataStream &message,
prop.value = expr->expression();
QObject *scope = expr->scopeObject();
if (scope) {
- QString sig = scope->metaObject()->method(signal->index()).signature();
+ QString sig = QLatin1String(scope->metaObject()->method(signal->index()).signature());
int lparen = sig.indexOf(QLatin1Char('('));
if (lparen >= 0) {
QString methodName = sig.mid(0, lparen);
@@ -280,7 +280,7 @@ QmlEngineDebugServer::objectData(QObject *object)
QmlType *type = QmlMetaType::qmlType(object->metaObject());
if (type) {
- QString typeName = type->qmlTypeName();
+ QString typeName = QLatin1String(type->qmlTypeName());
int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
rv.objectType = lastSlash < 0 ? typeName : typeName.mid(lastSlash+1);
} else {
diff --git a/src/declarative/qml/qmlerror.cpp b/src/declarative/qml/qmlerror.cpp
index 7cb68cf..d9ca20d 100644
--- a/src/declarative/qml/qmlerror.cpp
+++ b/src/declarative/qml/qmlerror.cpp
@@ -196,9 +196,9 @@ void QmlError::setColumn(int column)
QString QmlError::toString() const
{
QString rv;
- rv = url().toString() + QLatin1String(":") + QString::number(line());
+ rv = url().toString() + QLatin1Char(':') + QString::number(line());
if(column() != -1)
- rv += QLatin1String(":") + QString::number(column());
+ rv += QLatin1Char(':') + QString::number(column());
rv += QLatin1String(": ") + description();
diff --git a/src/declarative/qml/qmlexpression.h b/src/declarative/qml/qmlexpression.h
index c019f21..4fdfc3f 100644
--- a/src/declarative/qml/qmlexpression.h
+++ b/src/declarative/qml/qmlexpression.h
@@ -92,7 +92,7 @@ public Q_SLOTS:
QVariant value(bool *isUndefined = 0);
Q_SIGNALS:
- virtual void valueChanged();
+ void valueChanged();
protected:
QmlExpression(QmlContext *, const QString &, QObject *,
diff --git a/src/declarative/qml/qmlglobalscriptclass.cpp b/src/declarative/qml/qmlglobalscriptclass.cpp
index 478a874..5387e03 100644
--- a/src/declarative/qml/qmlglobalscriptclass.cpp
+++ b/src/declarative/qml/qmlglobalscriptclass.cpp
@@ -97,7 +97,7 @@ void QmlGlobalScriptClass::setProperty(QScriptValue &object,
Q_UNUSED(id);
Q_UNUSED(value);
QString error = QLatin1String("Invalid write to global property \"") +
- name.toString() + QLatin1String("\"");
+ name.toString() + QLatin1Char('\"');
engine()->currentContext()->throwError(error);
}
diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp
index 2dbc968..27f5426 100644
--- a/src/declarative/qml/qmlinfo.cpp
+++ b/src/declarative/qml/qmlinfo.cpp
@@ -44,7 +44,7 @@
#include "qmldeclarativedata_p.h"
#include "qmlcontext.h"
-#include <QtGui/qapplication.h>
+#include <QCoreApplication>
QT_BEGIN_NAMESPACE
@@ -88,17 +88,17 @@ QmlInfo::QmlInfo(const QObject *object)
if (ddata) {
if (ddata->outerContext) {
pos += ddata->outerContext->baseUrl().toString();
- pos += QLatin1String(":");
+ pos += QLatin1Char(':');
pos += QString::number(ddata->lineNumber);
- pos += QLatin1String(":");
+ pos += QLatin1Char(':');
pos += QString::number(ddata->columnNumber);
} else {
- pos += qApp->translate("QmlInfo","unknown location");
+ pos += QCoreApplication::translate("QmlInfo","unknown location");
}
} else {
- pos += qApp->translate("QmlInfo","unknown location");
+ pos += QCoreApplication::translate("QmlInfo","unknown location");
}
- pos += QLatin1String(")");
+ pos += QLatin1Char(')');
*this << pos;
nospace();
}
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp
index 2b3b385..a1ea90d 100644
--- a/src/declarative/qml/qmlmetaproperty.cpp
+++ b/src/declarative/qml/qmlmetaproperty.cpp
@@ -455,7 +455,7 @@ QString QmlMetaProperty::name() const
// ###
if (!d->object) {
} else if (type() & ValueTypeProperty) {
- QString rv = d->core.name(d->object) + QLatin1String(".");
+ QString rv = d->core.name(d->object) + QLatin1Char('.');
QmlEnginePrivate *ep = d->context?QmlEnginePrivate::get(d->context->engine()):0;
QmlValueType *valueType = 0;
@@ -724,16 +724,16 @@ bool QmlMetaPropertyPrivate::writeEnumProperty(const QMetaProperty &prop, int id
QVariant v = value;
if (prop.isEnumType()) {
QMetaEnum menum = prop.enumerator();
- if (v.type() == QVariant::String
+ if (v.userType() == QVariant::String
#ifdef QT3_SUPPORT
- || v.type() == QVariant::CString
+ || v.userType() == QVariant::CString
#endif
) {
if (prop.isFlagType())
v = QVariant(menum.keysToValue(value.toByteArray()));
else
v = QVariant(menum.keyToValue(value.toByteArray()));
- } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) {
+ } else if (v.userType() != QVariant::Int && v.userType() != QVariant::UInt) {
int enumMetaTypeId = QMetaType::type(QByteArray(menum.scope()) + "::" + menum.name());
if ((enumMetaTypeId == 0) || (v.userType() != enumMetaTypeId) || !v.constData())
return false;
@@ -803,7 +803,7 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data
QMetaProperty prop = object->metaObject()->property(property.coreIndex);
QVariant v = value;
// Enum values come through the script engine as doubles
- if (value.type() == QVariant::Double) {
+ if (value.userType() == QVariant::Double) {
double integral;
double fractional = modf(value.toDouble(), &integral);
if (qFuzzyCompare(fractional, (double)0.0))
diff --git a/src/declarative/qml/qmlmetatype.cpp b/src/declarative/qml/qmlmetatype.cpp
index edf8974..fbb3952 100644
--- a/src/declarative/qml/qmlmetatype.cpp
+++ b/src/declarative/qml/qmlmetatype.cpp
@@ -460,7 +460,7 @@ int QmlMetaType::registerType(const QmlPrivate::MetaTypeIds &id, QmlPrivate::Fun
QByteArray name = uri;
if (uri)
- name += "/";
+ name += '/';
name += cname;
name.replace('.','/');
diff --git a/src/declarative/qml/qmlmetatype.h b/src/declarative/qml/qmlmetatype.h
index d17b44f..e0c65c5 100644
--- a/src/declarative/qml/qmlmetatype.h
+++ b/src/declarative/qml/qmlmetatype.h
@@ -151,7 +151,7 @@ public:
private:
friend class QmlMetaType;
friend class QmlTypePrivate;
- friend class QmlMetaTypeData;
+ friend struct QmlMetaTypeData;
QmlType(int, int, int, QmlPrivate::Func, const char *, int);
QmlType(int, int, int, QmlPrivate::Func, const char *, int, int, const QMetaObject *, QmlAttachedPropertiesFunc, const QMetaObject *, int, int, int, QmlPrivate::CreateFunc, const QMetaObject *, int, QmlCustomParser *);
~QmlType();
@@ -164,7 +164,7 @@ int qmlRegisterType(const char *typeName)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
@@ -185,7 +185,7 @@ int qmlRegisterType(const char *uri, int version_maj, int version_min, const cha
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
@@ -207,7 +207,7 @@ int qmlRegisterExtendedType(const char *typeName)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
@@ -235,7 +235,7 @@ int qmlRegisterExtendedType(const char *uri, int version_maj, int version_min, c
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
@@ -266,7 +266,7 @@ int qmlRegisterInterface(const char *typeName)
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
@@ -281,7 +281,7 @@ int qmlRegisterCustomType(const char *uri, int version_maj, int version_min, con
{
QByteArray name(typeName);
QmlPrivate::MetaTypeIds ids = {
- qRegisterMetaType<T *>(QByteArray(name + "*").constData()),
+ qRegisterMetaType<T *>(QByteArray(name + '*').constData()),
qRegisterMetaType<T *>(QByteArray("QList<" + name + "*>*").constData()),
qRegisterMetaType<T *>(QByteArray("QmlList<" + name + "*>*").constData())
};
diff --git a/src/declarative/qml/qmlobjectscriptclass.cpp b/src/declarative/qml/qmlobjectscriptclass.cpp
index 86ee29c..7a2b132 100644
--- a/src/declarative/qml/qmlobjectscriptclass.cpp
+++ b/src/declarative/qml/qmlobjectscriptclass.cpp
@@ -307,10 +307,10 @@ QScriptValue QmlObjectScriptClass::tostring(QScriptContext *context, QScriptEngi
if (!objectName.isEmpty()) {
ret += QLatin1String(", \"");
ret += objectName;
- ret += QLatin1String("\"");
+ ret += QLatin1Char('\"');
}
- ret += QLatin1String(")");
+ ret += QLatin1Char(')');
}else{
ret += QLatin1String("null");
}
diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp
index b550f96..2efe988 100644
--- a/src/declarative/qml/qmlsqldatabase.cpp
+++ b/src/declarative/qml/qmlsqldatabase.cpp
@@ -196,7 +196,7 @@ static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *
return engine->undefinedValue();
}
-static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine *engine)
+static QScriptValue qmlsqldatabase_executeSql_outsidetransaction(QScriptContext *context, QScriptEngine * /*engine*/)
{
THROW_SQL(DATABASE_ERR,QmlEngine::tr("executeSql called outside transaction()"));
}
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index 116163a..e3fc288 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -71,7 +71,7 @@
#include <QRectF>
#include <QtCore/qdebug.h>
#include <QtCore/qvarlengtharray.h>
-#include <QtGui/qapplication.h>
+#include <QtCore/qcoreapplication.h>
QT_BEGIN_NAMESPACE
@@ -194,7 +194,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
if(types.at(instr.create.type).component)
vmeErrors << types.at(instr.create.type).component->errors();
- VME_EXCEPTION(qApp->translate("QmlVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
}
QmlDeclarativeData *ddata = QmlDeclarativeData::get(o);
@@ -500,7 +500,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
QMetaProperty prop =
target->metaObject()->property(instr.assignCustomType.propertyIndex);
if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type))
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
void *a[] = { (void *)v.data(), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@@ -522,15 +522,15 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
QMetaMethod method = QmlMetaType::defaultMethod(assign);
if (method.signature() == 0)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
QMetaObject::connect(target, prop.coreIndex(), assign, method.methodIndex());
} else {
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
}
@@ -704,7 +704,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
if (iid)
ptr = assign->qt_metacast(iid);
if (!ptr)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object to list"));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object to list"));
if (list.qmlListInterface) {
@@ -750,7 +750,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
}
if (!ok)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign object to interface property"));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign object to interface property"));
}
break;
@@ -761,7 +761,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
if (!qmlObject)
- VME_EXCEPTION(qApp->translate("QmlVME","Unable to create attached object"));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Unable to create attached object"));
stack.push(qmlObject);
}
@@ -779,7 +779,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
if (!list)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign to null list"));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign to null list"));
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
}
@@ -797,7 +797,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
QMetaObject::metacall(target, QMetaObject::ReadProperty,
instr.fetchQmlList.property, a);
if (!list)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot assign to null list"));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot assign to null list"));
qliststack.push(ListInstance(list, instr.fetchQmlList.type));
}
@@ -816,7 +816,7 @@ QObject *QmlVME::run(QmlVMEStack<QObject *> &stack, QmlContext *ctxt,
instr.fetch.property, a);
if (!obj)
- VME_EXCEPTION(qApp->translate("QmlVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
+ VME_EXCEPTION(QCoreApplication::translate("QmlVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
stack.push(obj);
}
diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp
index 2a3dbce..2e1f16b 100644
--- a/src/declarative/qml/qmlworkerscript.cpp
+++ b/src/declarative/qml/qmlworkerscript.cpp
@@ -276,7 +276,7 @@ QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &
} else if (value.isArray()) {
QVariantList list;
- quint32 length = (quint32)value.property("length").toNumber();
+ quint32 length = (quint32)value.property(QLatin1String("length")).toNumber();
for (quint32 ii = 0; ii < length; ++ii) {
QVariant v = scriptValueToVariant(ii);
@@ -303,21 +303,21 @@ QVariant QmlWorkerScriptEnginePrivate::scriptValueToVariant(const QScriptValue &
QScriptValue QmlWorkerScriptEnginePrivate::variantToScriptValue(const QVariant &value, QScriptEngine *engine)
{
- if (value.type() == QVariant::Bool) {
+ if (value.userType() == QVariant::Bool) {
return QScriptValue(value.toBool());
- } else if (value.type() == QVariant::String) {
+ } else if (value.userType() == QVariant::String) {
return QScriptValue(value.toString());
- } else if (value.type() == (QVariant::Type)QMetaType::QReal) {
+ } else if (value.userType() == QMetaType::QReal) {
return QScriptValue(value.toReal());
- } else if (value.type() == (QVariant::Type)QMetaType::QVariantList) {
+ } else if (value.userType() == QMetaType::QVariantList) {
QVariantList list = qvariant_cast<QVariantList>(value);
QScriptValue rv = engine->newArray(list.count());
- for (quint32 ii = 0; ii < list.count(); ++ii)
+ for (quint32 ii = 0; ii < quint32(list.count()); ++ii)
rv.setProperty(ii, variantToScriptValue(list.at(ii), engine));
return rv;
- } else if (value.type() == (QVariant::Type)QMetaType::QVariantHash) {
+ } else if (value.userType() == QMetaType::QVariantHash) {
QVariantHash hash = qvariant_cast<QVariantHash>(value);
diff --git a/src/declarative/qml/qmlworkerscript_p.h b/src/declarative/qml/qmlworkerscript_p.h
index 51efc4b..1ec7af3 100644
--- a/src/declarative/qml/qmlworkerscript_p.h
+++ b/src/declarative/qml/qmlworkerscript_p.h
@@ -84,8 +84,9 @@ private:
class QmlWorkerScript : public QObject, public QmlParserStatus
{
Q_OBJECT
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged);
+ Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ Q_INTERFACES(QmlParserStatus)
public:
QmlWorkerScript(QObject *parent = 0);
virtual ~QmlWorkerScript();
diff --git a/src/declarative/qml/qmlxmlhttprequest.cpp b/src/declarative/qml/qmlxmlhttprequest.cpp
index d1705a1..a5d6cd7 100644
--- a/src/declarative/qml/qmlxmlhttprequest.cpp
+++ b/src/declarative/qml/qmlxmlhttprequest.cpp
@@ -1053,7 +1053,7 @@ void QmlXMLHttpRequest::addHeader(const QString &name, const QString &value)
QByteArray utfname = name.toUtf8();
if (m_request.hasRawHeader(utfname)) {
- m_request.setRawHeader(utfname, m_request.rawHeader(utfname) + "," + value.toUtf8());
+ m_request.setRawHeader(utfname, m_request.rawHeader(utfname) + ',' + value.toUtf8());
} else {
m_request.setRawHeader(utfname, value.toUtf8());
}
diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp
index 5886724..00e3056 100644
--- a/src/declarative/util/qmlanimation.cpp
+++ b/src/declarative/util/qmlanimation.cpp
@@ -1532,7 +1532,7 @@ QML_DEFINE_TYPE(Qt,4,6,ParallelAnimation,QmlParallelAnimation)
//convert a variant from string type to another animatable type
void QmlPropertyAnimationPrivate::convertVariant(QVariant &variant, int type)
{
- if (variant.type() != QVariant::String) {
+ if (variant.userType() != QVariant::String) {
variant.convert((QVariant::Type)type);
return;
}
diff --git a/src/declarative/util/qmllistaccessor.cpp b/src/declarative/util/qmllistaccessor.cpp
index 1e051b7..00b8220 100644
--- a/src/declarative/util/qmllistaccessor.cpp
+++ b/src/declarative/util/qmllistaccessor.cpp
@@ -73,9 +73,9 @@ void QmlListAccessor::setList(const QVariant &v, QmlEngine *engine)
if (!d.isValid()) {
m_type = Invalid;
- } else if (d.type() == QVariant::StringList) {
+ } else if (d.userType() == QVariant::StringList) {
m_type = StringList;
- } else if (d.type() == (QVariant::Type)QMetaType::QVariantList) {
+ } else if (d.userType() == QMetaType::QVariantList) {
m_type = VariantList;
} else if (d.canConvert(QVariant::Int)) {
m_type = Integer;
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index 00c99f6..995a7a4 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -902,7 +902,7 @@ static void dump(ModelNode *node, int ind)
}
for (QHash<QString, ModelNode *>::ConstIterator iter = node->properties.begin(); iter != node->properties.end(); ++iter) {
- qWarning().nospace() << indent << "Property " << iter.key() << ":";
+ qWarning().nospace() << indent << "Property " << iter.key() << ':';
dump(iter.value(), ind + 1);
}
}
diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp
index b9ec67a..48e026e 100644
--- a/src/declarative/util/qmlpropertychanges.cpp
+++ b/src/declarative/util/qmlpropertychanges.cpp
@@ -209,7 +209,7 @@ QmlPropertyChangesParser::compileList(QList<QPair<QByteArray, QVariant> > &list,
QmlCustomParserProperty prop =
qvariant_cast<QmlCustomParserProperty>(value);
- QByteArray pre = propName + ".";
+ QByteArray pre = propName + '.';
compileList(list, pre, prop);
} else {
@@ -384,7 +384,7 @@ QmlPropertyChanges::ActionList QmlPropertyChanges::actions()
a.restore = restoreEntryValues();
if (a.property.propertyType() == QVariant::Url &&
- (a.toValue.type() == QVariant::String || a.toValue.type() == QVariant::ByteArray) && !a.toValue.isNull())
+ (a.toValue.userType() == QVariant::String || a.toValue.userType() == QVariant::ByteArray) && !a.toValue.isNull())
a.toValue.setValue(qmlContext(this)->resolvedUrl(QUrl(a.toValue.toString())));
list << a;
diff --git a/src/declarative/util/qmlsystempalette.cpp b/src/declarative/util/qmlsystempalette.cpp
index d43a971..39d8f3e 100644
--- a/src/declarative/util/qmlsystempalette.cpp
+++ b/src/declarative/util/qmlsystempalette.cpp
@@ -80,7 +80,7 @@ QmlSystemPalette::QmlSystemPalette(QObject *parent)
: QObject(*(new QmlSystemPalettePrivate), parent)
{
Q_D(QmlSystemPalette);
- d->palette = qApp->palette();
+ d->palette = QApplication::palette();
d->group = QPalette::Active;
qApp->installEventFilter(this);
}
@@ -293,7 +293,7 @@ bool QmlSystemPalette::event(QEvent *event)
{
Q_D(QmlSystemPalette);
if (event->type() == QEvent::ApplicationPaletteChange) {
- d->palette = qApp->palette();
+ d->palette = QApplication::palette();
emit paletteChanged();
return true;
}
diff --git a/src/declarative/util/qmlxmllistmodel.cpp b/src/declarative/util/qmlxmllistmodel.cpp
index 6f8da9c..46ef739 100644
--- a/src/declarative/util/qmlxmllistmodel.cpp
+++ b/src/declarative/util/qmlxmllistmodel.cpp
@@ -259,7 +259,7 @@ void QmlXmlQuery::doQueryJob()
QXmlResultItems result;
QXmlQuery countquery;
countquery.bindVariable(QLatin1String("inputDocument"), &b);
- countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1String(")"));
+ countquery.setQuery(namespaces + QLatin1String("count(") + prefix + QLatin1Char(')'));
countquery.evaluateTo(&result);
QXmlItem item(result.next());
if (item.isAtomicValue())
@@ -267,7 +267,7 @@ void QmlXmlQuery::doQueryJob()
}
//qDebug() << count;
- m_prefix = namespaces + prefix + QLatin1String("/");
+ m_prefix = namespaces + prefix + QLatin1Char('/');
m_data = xml;
if (count > 0)
m_size = count;