From 500996b13b96d2868a7da78d782108c2996684ec Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 4 Dec 2009 11:14:37 +0100 Subject: Stylesheets example: Fix warning about multiple &-mnemonics. Reviewed-by: Olivier Goffart --- examples/widgets/stylesheet/mainwindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/stylesheet/mainwindow.ui b/examples/widgets/stylesheet/mainwindow.ui index 740d37b..2b232df 100644 --- a/examples/widgets/stylesheet/mainwindow.ui +++ b/examples/widgets/stylesheet/mainwindow.ui @@ -41,7 +41,7 @@ Please read the LICENSE file before checking - I &accept the terms and &conditions + I accept the terms and &conditions -- cgit v0.12 From 9c8a41a157cf9ffbb6d839d05c4502fef59e21c6 Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 4 Dec 2009 13:57:44 +0100 Subject: Added auto test for the cursor position when doing block undo and redo Block changes in different selections happens quite frequently with Qt Creator, e.g. when renaming local variables. This test tests the desired cursor position behaviour: after an undo, the cursor should be where it was when the block operation started. After a redo, the cursor should be where it was after the block operation ended. --- tests/auto/qtextcursor/tst_qtextcursor.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp index d910c8d..d0c2afd 100644 --- a/tests/auto/qtextcursor/tst_qtextcursor.cpp +++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp @@ -149,6 +149,8 @@ private slots: void adjustCursorsOnInsert(); + void cursorPositionWithBlockUndoAndRedo(); + private: int blockCount(); @@ -1747,9 +1749,33 @@ void tst_QTextCursor::adjustCursorsOnInsert() QCOMPARE(selection.anchor(), posAfter); doc->undo(); +} +void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo() +{ + cursor.insertText("AAAABBBBCCCCDDDD"); + cursor.beginEditBlock(); + cursor.setPosition(12); + int cursorPositionBefore = cursor.position(); + cursor.insertText("*"); + cursor.setPosition(8); + cursor.insertText("*"); + cursor.setPosition(4); + cursor.insertText("*"); + cursor.setPosition(0); + cursor.insertText("*"); + int cursorPositionAfter = cursor.position(); + cursor.endEditBlock(); + QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD"); + QCOMPARE(12, cursorPositionBefore); + QCOMPARE(1, cursorPositionAfter); - + doc->undo(&cursor); + QVERIFY(doc->toPlainText() == "AAAABBBBCCCCDDDD"); + QCOMPARE(cursor.position(), cursorPositionBefore); + doc->redo(&cursor); + QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD"); + QCOMPARE(cursor.position(), cursorPositionAfter); } QTEST_MAIN(tst_QTextCursor) -- cgit v0.12 From 3046bffe2feda63ed7719f8f0db9b576013720db Mon Sep 17 00:00:00 2001 From: mae Date: Fri, 4 Dec 2009 14:04:41 +0100 Subject: Fix cursor positiong after block undo and redo Block changes in different selections happens quite frequently with Qt Creator, e.g. when renaming local variables. The desired behaviour which the tst_QTextCursor::cursorPositionWIthBLockUndoAndRedo() tests, is like this: after an undo, the cursor should be where it was when the block operation started. After a redo, the cursor should be where it was after the block operation ended. Reviewed-by: Simon Hausmann --- src/gui/text/qtextdocument_p.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 18e1ffc..b015198 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -870,6 +870,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) undoEnabled = false; beginEditBlock(); + int editPos = -1; while (1) { if (undo) --undoState; @@ -881,11 +882,13 @@ int QTextDocumentPrivate::undoRedo(bool undo) remove(c.pos, c.length, (QTextUndoCommand::Operation)c.operation); PMDEBUG(" erase: from %d, length %d", c.pos, c.length); c.command = QTextUndoCommand::Removed; + editPos = c.pos; break; case QTextUndoCommand::Removed: PMDEBUG(" insert: format %d (from %d, length %d, strpos=%d)", c.format, c.pos, c.length, c.strPos); insert_string(c.pos, c.strPos, c.length, c.format, (QTextUndoCommand::Operation)c.operation); c.command = QTextUndoCommand::Inserted; + editPos = c.pos + c.length; break; case QTextUndoCommand::BlockInserted: case QTextUndoCommand::BlockAdded: @@ -895,6 +898,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) c.command = QTextUndoCommand::BlockRemoved; else c.command = QTextUndoCommand::BlockDeleted; + editPos = c.pos; break; case QTextUndoCommand::BlockRemoved: case QTextUndoCommand::BlockDeleted: @@ -905,6 +909,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) c.command = QTextUndoCommand::BlockInserted; else c.command = QTextUndoCommand::BlockAdded; + editPos = c.pos + 1; break; case QTextUndoCommand::CharFormatChanged: { resetBlockRevision = -1; // ## TODO @@ -915,6 +920,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) int oldFormat = it.value()->format; setCharFormat(c.pos, c.length, formats.charFormat(c.format)); c.format = oldFormat; + editPos = c.pos + c.length; break; } case QTextUndoCommand::BlockFormatChanged: { @@ -937,6 +943,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) group->blockFormatChanged(it); } documentChange(it.position(), it.length()); + editPos = -1; break; } case QTextUndoCommand::GroupFormatChange: { @@ -946,6 +953,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) int oldFormat = formats.objectFormatIndex(c.objectIndex); changeObjectFormat(object, c.format); c.format = oldFormat; + editPos = -1; break; } case QTextUndoCommand::Custom: @@ -954,6 +962,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) c.custom->undo(); else c.custom->redo(); + editPos = -1; break; default: Q_ASSERT(false); @@ -979,8 +988,7 @@ int QTextDocumentPrivate::undoRedo(bool undo) break; } undoEnabled = true; - int editPos = -1; - if (docChangeFrom >= 0) { + if (editPos < 0 && docChangeFrom >= 0) { editPos = qMin(docChangeFrom + docChangeLength, length() - 1); } endEditBlock(); -- cgit v0.12 From 72edf630344a8625a6dd848a8655e685c536e009 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 Dec 2009 14:12:00 +0100 Subject: remove dead file --- tools/qdoc3/documentation.pri | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 tools/qdoc3/documentation.pri diff --git a/tools/qdoc3/documentation.pri b/tools/qdoc3/documentation.pri deleted file mode 100644 index d952183..0000000 --- a/tools/qdoc3/documentation.pri +++ /dev/null @@ -1,5 +0,0 @@ -# NOTE: THIS FILE IS SHARED BY qdoc3.pro AND projects.pro -# -# So while changing this file, please make sure to that your changes -# work in root qt soure dir with (n)make docs and for building with qdoc -# -- cgit v0.12 From 599ffaef76eb92af2bbce6e5baff539958bfdd14 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 4 Dec 2009 14:54:34 +0100 Subject: make qdoc3 a proper tools subtarget and install it needed for building qtmobility and qtcreator docs without magic. Reviewed-by: Daniel Molkentin --- doc/doc.pri | 5 +---- tools/qdoc3/qdoc3.pro | 2 ++ tools/tools.pro | 2 ++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index d4fdcd8..463c447 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -34,12 +34,9 @@ win32-g++:isEmpty(QMAKE_SH) { QT_DOCUMENTATION = $$replace(QT_DOCUMENTATION, "/", "\\\\") } - -!wince*:!cross_compile:SUBDIRS += tools/qdoc3 - # Build rules: adp_docs.commands = ($$QDOC $$ADP_DOCS_QDOCCONF_FILE) -adp_docs.depends += sub-tools-qdoc3 +adp_docs.depends += sub-tools # qdoc3 qch_docs.commands = $$QT_DOCUMENTATION qch_docs.depends += sub-tools diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index bacef3f..441bf39 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -105,3 +105,5 @@ SOURCES += apigenerator.cpp \ webxmlgenerator.cpp \ yyindent.cpp +target.path = $$[QT_INSTALL_BINS] +INSTALLS += target diff --git a/tools/tools.pro b/tools/tools.pro index 87ba3c9..4cff507 100644 --- a/tools/tools.pro +++ b/tools/tools.pro @@ -31,5 +31,7 @@ contains(QT_CONFIG, dbus):SUBDIRS += qdbus !wince*:contains(QT_CONFIG, xmlpatterns): SUBDIRS += xmlpatterns xmlpatternsvalidator embedded: SUBDIRS += makeqpf +!wince*:!cross_compile:SUBDIRS += qdoc3 + CONFIG+=ordered QTDIR_build:REQUIRES = "contains(QT_CONFIG, full-config)" -- cgit v0.12 From 614faf7ac155ad3baef7ef62526f9ce4b2cc1e5a Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Mon, 7 Dec 2009 17:39:19 +1000 Subject: Missed file --- .../declarative/qmlecmascript/data/exceptionProducesWarning.qml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml new file mode 100644 index 0000000..44722a9 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml @@ -0,0 +1,8 @@ +import Qt 4.6 +import Qt.test 1.0 + +MyQmlObject { + Component.onCompleted: + { throw(123,"JS exception") } +} + -- cgit v0.12 From 0a9aa40dd9865e61f2799a6396ce8dcaa68329c5 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 7 Dec 2009 16:22:20 +0100 Subject: little imporvements and 1 warning less --- src/declarative/qml/qmlengine.cpp | 2 +- src/declarative/qml/qmlmetaproperty.cpp | 2 +- src/declarative/util/qmlanimation.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index bd6d540..429225a 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -147,7 +147,7 @@ QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv) newQMetaObject(StaticQtMetaObject::get()); globalObject().setProperty(QLatin1String("Qt"), qtObject); - offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace('/', QDir::separator()) + offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator()) + QDir::separator() + QLatin1String("QML") + QDir::separator() + QLatin1String("OfflineStorage"); qt_add_qmlxmlhttprequest(this); diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index a1ea90d..9c7aff8 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -806,7 +806,7 @@ bool QmlMetaPropertyPrivate::write(QObject *object, const QmlPropertyCache::Data if (value.userType() == QVariant::Double) { double integral; double fractional = modf(value.toDouble(), &integral); - if (qFuzzyCompare(fractional, (double)0.0)) + if (qFuzzyIsNull(fractional)) v.convert(QVariant::Int); } return writeEnumProperty(prop, coreIdx, object, v, flags); diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 8afe667..a4f67ac 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -2064,8 +2064,8 @@ void QmlPropertyAnimation::prepare(QmlMetaProperty &p) d->property = d->userProperty; if (!d->rangeIsSet) { - d->va->setStartValue(QVariant(0.0f)); - d->va->setEndValue(QVariant(1.0f)); + d->va->setStartValue(qreal(0)); + d->va->setEndValue(qreal(1)); d->rangeIsSet = true; } @@ -2227,8 +2227,8 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, if (data->actions.count()) { if (!d->rangeIsSet) { - d->va->setStartValue(QVariant(0.0f)); - d->va->setEndValue(QVariant(1.0f)); + d->va->setStartValue(qreal(0)); + d->va->setEndValue(qreal(1)); d->rangeIsSet = true; } d->va->setAnimValue(data, QAbstractAnimation::DeleteWhenStopped); -- cgit v0.12 From 29e5c9b27302e455b1ae9d324687ded3a40066d2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 08:24:32 +1000 Subject: Fix leaks. --- src/declarative/graphicsitems/qmlgraphicsloader.cpp | 2 ++ src/declarative/qml/qmlengine.cpp | 2 ++ tools/qmlviewer/qmlviewer.cpp | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicsloader.cpp b/src/declarative/graphicsitems/qmlgraphicsloader.cpp index 86239cf..bb1020c 100644 --- a/src/declarative/graphicsitems/qmlgraphicsloader.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsloader.cpp @@ -263,6 +263,7 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded() QObject *obj = component->create(ctxt); if (obj) { + ctxt->setParent(obj); item = qobject_cast(obj); if (item) { item->setParentItem(q); @@ -271,6 +272,7 @@ void QmlGraphicsLoaderPrivate::_q_sourceLoaded() } } else { delete obj; + delete ctxt; source = QUrl(); } emit q->sourceChanged(); diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index 3e7ac8e..4709b05 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -200,6 +200,8 @@ QmlEnginePrivate::~QmlEnginePrivate() namedNodeMapClass = 0; delete sqlQueryClass; sqlQueryClass = 0; + delete globalClass; + globalClass = 0; for(int ii = 0; ii < bindValues.count(); ++ii) clear(bindValues[ii]); diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 8d8d66a..a8901f9 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -506,7 +506,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) if (!flatmenu) settingsMenu->addAction(recordOptions); - QMenu *propertiesMenu = new QMenu(tr("Properties")); + QMenu *propertiesMenu = settingsMenu->addMenu(tr("Properties")); QActionGroup *orientation = new QActionGroup(parent); orientation->setExclusive(true); portraitOrientation = new QAction(tr("orientation: Portrait"), parent); @@ -521,8 +521,6 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) orientation->addAction(landscapeOrientation); propertiesMenu->addAction(landscapeOrientation); - settingsMenu->addMenu(propertiesMenu); - if (flatmenu) flatmenu->addSeparator(); QMenu *helpMenu = flatmenu ? flatmenu : menu->addMenu(tr("&Help")); -- cgit v0.12 From 023790d6b243254f88d3aa429750ac872f16a9bf Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 09:00:09 +1000 Subject: Fix docs. --- src/declarative/qml/qmlengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index d489d74..f45b7b8 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -311,7 +311,7 @@ QmlWorkerScriptEngine *QmlEnginePrivate::getWorkerScriptEngine() \code QmlEngine engine; - QmlComponent component(&engine, "Text { text: \"Hello world!\" }"); + QmlComponent component(&engine, "import Qt 4.6\nText { text: \"Hello world!\" }", QUrl()); QmlGraphicsItem *item = qobject_cast(component.create()); //add item to view, etc -- cgit v0.12 From 95e441ebe51c11256c6888186b155782d0c5655d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 10:12:52 +1000 Subject: Add barebones i18n documentation. --- doc/src/declarative/declarativeui.qdoc | 1 + doc/src/declarative/qmli18n.qdoc | 66 ++++++++++++++++++++++++++++++++++ doc/src/declarative/qmlreference.qdoc | 1 + 3 files changed, 68 insertions(+) create mode 100644 doc/src/declarative/qmli18n.qdoc diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index b383836..637e5f1 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -100,6 +100,7 @@ completely new applications. QML is fully \l {Extending QML}{extensible from C+ \o \l {QML Elements} \o \l {QML Global Object} \o \l {Extending QML} +\o \l {QML Internationalization} \o \l {QtDeclarative Module} \endlist */ diff --git a/doc/src/declarative/qmli18n.qdoc b/doc/src/declarative/qmli18n.qdoc new file mode 100644 index 0000000..55ed3d7 --- /dev/null +++ b/doc/src/declarative/qmli18n.qdoc @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmli18n.html +\title QML Internationalization + +Strings in QML can be marked for translation using the qsTr(), qsTranslate(), +QT_TR_NOOP(), and QT_TRANSLATE_NOOP() functions. + +For example: +\qml +Text { text: qsTr("Pictures") } +\endqml + +These functions are standard QtScript functions; for more details see +QScriptEngine::installTranslatorFunctions(). + +QML relies on the core internationalization capabilities provided by Qt. These +capabilities are described more fully in: +\list +\o \l {Internationalization with Qt} +\o \l {Qt Linguist Manual} +\endlist + +You can test a translation in qmlviewer using the -translation option. + +*/ diff --git a/doc/src/declarative/qmlreference.qdoc b/doc/src/declarative/qmlreference.qdoc index 2c79aeb..614bc18 100644 --- a/doc/src/declarative/qmlreference.qdoc +++ b/doc/src/declarative/qmlreference.qdoc @@ -90,5 +90,6 @@ \list \o \l {elements}{QML Elements} \o \l {QML Global Object} + \o \l {QML Internationalization} \endlist */ -- cgit v0.12 From ad2a9bd8f0c0b57e1e40f5f93af21c018ceac86e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 11:14:18 +1000 Subject: Fix crash. --- src/gui/graphicsview/qgraphicsitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index bc47872..dd76f1c 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -2181,7 +2181,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo } // Enable subfocus - if (newVisible) { + if (scene && newVisible) { QGraphicsItem *p = parent; bool done = false; while (p) { -- cgit v0.12 From 8669c43cf65743efff36a005d433f5965ffe22f2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 11:43:06 +1000 Subject: Add barebones debugging documentation. --- doc/src/declarative/qmldebugging.qdoc | 71 +++++++++++++++++++++++++++++++++++ doc/src/declarative/qmli18n.qdoc | 2 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 doc/src/declarative/qmldebugging.qdoc diff --git a/doc/src/declarative/qmldebugging.qdoc b/doc/src/declarative/qmldebugging.qdoc new file mode 100644 index 0000000..b5b58a6 --- /dev/null +++ b/doc/src/declarative/qmldebugging.qdoc @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qmldebugging.html +\title Debugging QML + +\section1 Logging + +console.log can be used to print debugging information to the console. For example: + +\qml +Rectangle { + width: 200; height: 200 + MouseRegion { + anchors.fill: parent + onClicked: console.log("clicked") + } +} +\endqml + +\section1 The QML Inspector + +qmldebugger provides an experimental inspector to aid with debugging. It can +be run as a Qt Creator plugin or as a standalone application. + +\section1 Debugging Transitions + +When a transition doesn't look quite right, it can be helpful to view it in slow +motion to see more clearly what is happening. \l {qmlviewer} provides a menu option +"Slow Down Animations" to facilitate this. + +*/ diff --git a/doc/src/declarative/qmli18n.qdoc b/doc/src/declarative/qmli18n.qdoc index 55ed3d7..4b62fcb 100644 --- a/doc/src/declarative/qmli18n.qdoc +++ b/doc/src/declarative/qmli18n.qdoc @@ -61,6 +61,6 @@ capabilities are described more fully in: \o \l {Qt Linguist Manual} \endlist -You can test a translation in qmlviewer using the -translation option. +You can test a translation in \l {qmlviewer} using the -translation option. */ -- cgit v0.12 From 3e1b7110c1161b740c32ed0ee390f7030e8208ed Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 15:11:23 +1000 Subject: Fix leaks. --- src/declarative/graphicsitems/qmlgraphicslistview.cpp | 2 ++ src/declarative/qml/qmlcompileddata.cpp | 3 +++ src/declarative/qml/qmlpropertycache.cpp | 1 - src/declarative/qml/qmlworkerscript.cpp | 1 + src/declarative/util/qmlanimation_p_p.h | 2 ++ 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicslistview.cpp b/src/declarative/graphicsitems/qmlgraphicslistview.cpp index 7fb6454..135262c 100644 --- a/src/declarative/graphicsitems/qmlgraphicslistview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicslistview.cpp @@ -1256,6 +1256,8 @@ QmlGraphicsListView::~QmlGraphicsListView() d->clear(); if (d->ownModel) delete d->model; + delete d->header; + delete d->footer; } /*! diff --git a/src/declarative/qml/qmlcompileddata.cpp b/src/declarative/qml/qmlcompileddata.cpp index 8b165c6..198b574 100644 --- a/src/declarative/qml/qmlcompileddata.cpp +++ b/src/declarative/qml/qmlcompileddata.cpp @@ -176,6 +176,9 @@ QmlCompiledData::~QmlCompiledData() for (int ii = 0; ii < propertyCaches.count(); ++ii) propertyCaches.at(ii)->release(); + for (int ii = 0; ii < contextCaches.count(); ++ii) + contextCaches.at(ii)->release(); + if (importCache) importCache->release(); diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 7e3a1c4..bad8ad8 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -198,7 +198,6 @@ QmlPropertyCache *QmlPropertyCache::create(QmlEngine *engine, const QMetaObject cache->stringCache.insert(methodName, data); cache->identifierCache.insert(data->identifier.identifier, data); data->addref(); - data->addref(); } return cache; diff --git a/src/declarative/qml/qmlworkerscript.cpp b/src/declarative/qml/qmlworkerscript.cpp index 5c281bb..a0d6ef0 100644 --- a/src/declarative/qml/qmlworkerscript.cpp +++ b/src/declarative/qml/qmlworkerscript.cpp @@ -389,6 +389,7 @@ QmlWorkerScriptEngine::QmlWorkerScriptEngine(QObject *parent) QmlWorkerScriptEngine::~QmlWorkerScriptEngine() { + qDeleteAll(d->workers); delete d; d = 0; } diff --git a/src/declarative/util/qmlanimation_p_p.h b/src/declarative/util/qmlanimation_p_p.h index fbd7114..2f911b4 100644 --- a/src/declarative/util/qmlanimation_p_p.h +++ b/src/declarative/util/qmlanimation_p_p.h @@ -102,6 +102,7 @@ public: QActionAnimation(QObject *parent = 0) : QAbstractAnimation(parent), animAction(0), policy(KeepWhenStopped), running(false) {} QActionAnimation(QAbstractAnimationAction *action, QObject *parent = 0) : QAbstractAnimation(parent), animAction(action), policy(KeepWhenStopped), running(false) {} + ~QActionAnimation() { if (policy == DeleteWhenStopped) { delete animAction; animAction = 0; } } virtual int duration() const { return 0; } void setAnimAction(QAbstractAnimationAction *action, DeletionPolicy p) { @@ -145,6 +146,7 @@ class QmlTimeLineValueAnimator : public QVariantAnimation Q_OBJECT public: QmlTimeLineValueAnimator(QObject *parent = 0) : QVariantAnimation(parent), animValue(0), fromSourced(0), policy(KeepWhenStopped) {} + ~QmlTimeLineValueAnimator() { if (policy == DeleteWhenStopped) { delete animValue; animValue = 0; } } void setAnimValue(QmlTimeLineValue *value, DeletionPolicy p) { if (state() == Running) -- cgit v0.12 From cb745eacdb1c1e009f7f115d88dd03bdb9c16180 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 15:37:49 +1000 Subject: Use QApplication::startDragDistance() instead of pressDragLength Make pressTime settable (especially useful to turn it off). --- .../graphicsitems/qmlgraphicswebview.cpp | 36 +++++++++++++++++++--- .../graphicsitems/qmlgraphicswebview_p.h | 5 +++ 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qmlgraphicswebview.cpp b/src/declarative/graphicsitems/qmlgraphicswebview.cpp index 1fdf557..85fd0d7 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview.cpp +++ b/src/declarative/graphicsitems/qmlgraphicswebview.cpp @@ -103,8 +103,7 @@ public: QBasicTimer pressTimer; QPoint pressPoint; - int pressTime; // milliseconds before it's a "hold" XXX not currently settable - static const int pressDragLength = 15; // XXX #pixels before it's no longer a "hold"; device-specific + int pressTime; // milliseconds before it's a "hold" void updateWindowObjects(); class WindowObjectList : public QmlConcreteList @@ -612,6 +611,28 @@ bool QmlGraphicsWebView::heuristicZoom(int clickX, int clickY, qreal maxzoom) } } +/*! + \qmlproperty int WebView::pressGrabTime + + The number of milliseconds the user must press before the WebView + starts passing move events through to the web engine (rather than + letting other QML elements such as a Flickable take them). + + Defaults to 400ms. Set to 0 to always grab and pass move events to + the web engine. +*/ +int QmlGraphicsWebView::pressGrabTime() const +{ + Q_D(const QmlGraphicsWebView); + return d->pressTime; +} + +void QmlGraphicsWebView::setPressGrabTime(int ms) +{ + Q_D(QmlGraphicsWebView); + d->pressTime = ms; +} + void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QmlGraphicsWebView); @@ -620,8 +641,13 @@ void QmlGraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent *event) QMouseEvent *me = sceneMouseEventToMouseEvent(event); d->pressPoint = me->pos(); - d->pressTimer.start(d->pressTime,this); - setKeepMouseGrab(false); + if (d->pressTime) { + d->pressTimer.start(d->pressTime,this); + setKeepMouseGrab(false); + } else { + grabMouse(); + setKeepMouseGrab(true); + } page()->event(me); event->setAccepted( @@ -684,7 +710,7 @@ void QmlGraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QMouseEvent *me = sceneMouseEventToMouseEvent(event); if (d->pressTimer.isActive()) { - if ((me->pos() - d->pressPoint).manhattanLength() > d->pressDragLength) { + if ((me->pos() - d->pressPoint).manhattanLength() > QApplication::startDragDistance()) { d->pressTimer.stop(); } } diff --git a/src/declarative/graphicsitems/qmlgraphicswebview_p.h b/src/declarative/graphicsitems/qmlgraphicswebview_p.h index 0b2ba07..f5edb7a 100644 --- a/src/declarative/graphicsitems/qmlgraphicswebview_p.h +++ b/src/declarative/graphicsitems/qmlgraphicswebview_p.h @@ -99,6 +99,8 @@ class Q_DECLARATIVE_EXPORT QmlGraphicsWebView : public QmlGraphicsPaintedItem Q_PROPERTY(QString html READ html WRITE setHtml) + Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime) + Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) @@ -135,6 +137,9 @@ public: Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; + int pressGrabTime() const; + void setPressGrabTime(int); + int preferredWidth() const; void setPreferredWidth(int); int preferredHeight() const; -- cgit v0.12 From 06d949102aa44ab4764f97cdb606b02d3dfe04c9 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 15:47:50 +1000 Subject: Compile with 4.6.x --- src/declarative/graphicsitems/qmlgraphicstextedit.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 747e2fb..4bd3a49 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp @@ -871,7 +871,10 @@ void QmlGraphicsTextEditPrivate::init() q->setFlag(QGraphicsItem::ItemAcceptsInputMethod); control = new QTextControl(q); + +#if QT_VERSION >= 0x040700 // XXX see bug QT-2236 control->setIgnoreUnusedNavigationEvents(true); +#endif QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); -- cgit v0.12 From 1389d2690f19378fc9e83426c0038a65e23ed1c8 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 15:56:38 +1000 Subject: undebug --- src/declarative/qml/qmlsqldatabase.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 6ddd5e5..c3c3ca3 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -409,7 +409,6 @@ void qt_add_qmlsqldatabase(QScriptEngine *engine) { QScriptValue openDatabase = engine->newFunction(qmlsqldatabase_open_sync, 4); engine->globalObject().setProperty(QLatin1String("openDatabaseSync"), openDatabase); -qDebug() << "qt_add_qmlsqldatabase" << engine; QScriptValue sqlExceptionPrototype = engine->newObject(); for (int i=0; sqlerror[i]; ++i) -- cgit v0.12 From 8bbe541a602f5bea707bb5e042f9399e5bcd0b15 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 15:58:07 +1000 Subject: Remove debug. --- src/declarative/qml/qmlsqldatabase.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/qml/qmlsqldatabase.cpp b/src/declarative/qml/qmlsqldatabase.cpp index 6ddd5e5..c3c3ca3 100644 --- a/src/declarative/qml/qmlsqldatabase.cpp +++ b/src/declarative/qml/qmlsqldatabase.cpp @@ -409,7 +409,6 @@ void qt_add_qmlsqldatabase(QScriptEngine *engine) { QScriptValue openDatabase = engine->newFunction(qmlsqldatabase_open_sync, 4); engine->globalObject().setProperty(QLatin1String("openDatabaseSync"), openDatabase); -qDebug() << "qt_add_qmlsqldatabase" << engine; QScriptValue sqlExceptionPrototype = engine->newObject(); for (int i=0; sqlerror[i]; ++i) -- cgit v0.12 From abef2069a4f1afbbf373ec0b667838dadd926798 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 8 Dec 2009 16:00:34 +1000 Subject: Fix leak. --- src/declarative/graphicsitems/qmlgraphicsrepeater.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp index a650999..99f0faa 100644 --- a/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsrepeater.cpp @@ -56,6 +56,8 @@ QmlGraphicsRepeaterPrivate::QmlGraphicsRepeaterPrivate() QmlGraphicsRepeaterPrivate::~QmlGraphicsRepeaterPrivate() { + if (ownModel) + delete model; } QML_DEFINE_TYPE(Qt,4,6,Repeater,QmlGraphicsRepeater) -- cgit v0.12 From d39d4e4d553fc72fce5e6716ec8ab4224db0b08b Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 16:08:54 +1000 Subject: It's private header, so it's only a 4.6.1 dependency. --- src/declarative/graphicsitems/qmlgraphicstextedit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 4bd3a49..0b8bc83 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp @@ -872,7 +872,7 @@ void QmlGraphicsTextEditPrivate::init() control = new QTextControl(q); -#if QT_VERSION >= 0x040700 // XXX see bug QT-2236 +#if QT_VERSION >= 0x040601 // XXX see bug QT-2236 control->setIgnoreUnusedNavigationEvents(true); #endif -- cgit v0.12 From a8944d4786fa0afae27a8843183ec1a12e586c5f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 16:27:50 +1000 Subject: document script extension problem --- src/declarative/qml/qmlengine.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index f45b7b8..63d5b70 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -150,8 +150,15 @@ QmlScriptEngine::QmlScriptEngine(QmlEnginePrivate *priv) offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator()) + QDir::separator() + QLatin1String("QML") + QDir::separator() + QLatin1String("OfflineStorage"); + + qt_add_qmlxmlhttprequest(this); qt_add_qmlsqldatabase(this); + // XXX A Multimedia "Qt.Sound" class also needs to be made available, + // XXX but we don't want a dependency in that cirection. + // XXX When the above a done some better way, that way should also be + // XXX used to add Qt.Sound class. + //types qtObject.setProperty(QLatin1String("rgba"), newFunction(QmlEnginePrivate::rgba, 4)); -- cgit v0.12 From 6883b651998983d44e0eb0e6930e903a760f0107 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 8 Dec 2009 16:59:00 +1000 Subject: Add info about qmldebugger and its creator plugin, with screenshot. --- doc/src/declarative/pics/qmldebugger-creator.png | Bin 0 -> 170972 bytes doc/src/declarative/qmldebugging.qdoc | 53 ++++++++++++++++++++- .../creatorplugin/QmlInspector.pluginspec | 12 ++--- tools/qmldebugger/creatorplugin/README | 6 +++ 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 doc/src/declarative/pics/qmldebugger-creator.png diff --git a/doc/src/declarative/pics/qmldebugger-creator.png b/doc/src/declarative/pics/qmldebugger-creator.png new file mode 100644 index 0000000..da1e22d Binary files /dev/null and b/doc/src/declarative/pics/qmldebugger-creator.png differ diff --git a/doc/src/declarative/qmldebugging.qdoc b/doc/src/declarative/qmldebugging.qdoc index b5b58a6..13ad5f7 100644 --- a/doc/src/declarative/qmldebugging.qdoc +++ b/doc/src/declarative/qmldebugging.qdoc @@ -59,8 +59,57 @@ Rectangle { \section1 The QML Inspector -qmldebugger provides an experimental inspector to aid with debugging. It can -be run as a Qt Creator plugin or as a standalone application. +The \c qmldebugger tool provides an experimental inspector to aid with debugging. +It can be run as a Qt Creator plugin or as a standalone application. + +\section2 Qt Creator plugin + +The Qt Creator plugin currently builds against Qt Creator 1.3. + +To build the Qt Creator plugin: + +\list +\o Set an environment variable \c CREATOR_SRC_DIR that points to the Qt Creator + source directory +\o Set an environment variable \c CREATOR_BUILD_DIR that points to the Qt Creator + build directory +\o Run \c qmake on \c $QTDIR/tools/qmldebugger/qmldebugger.pro +\endlist + +This builds the plugin into your Qt Creator installation. + +The plugin adds a "QML Inspect" mode into Qt Creator that provides: + +\list +\o An object tree showing all objects and their children +\o The current property values for the object selected in the object tree + (this table is dynamically updated for all properties that have property changed + notifications) +\o An expression evaluator for querying and setting values dynamically +\o A table of watched properties (double-click on a property in the property + table to add it to the watch table) +\o A graph that shows the frame rate of your application +\endlist + + +To start the debugger, open a QML project and click the "QML Inspect" mode, then click the green +"play" button in the toolbar of the bottom-right debugger window. + +\image qmldebugger-creator.png + + +\section2 Standalone qmldebugger tool + +To run the standalone \c qmldebugger tool, set an environment variable \c QML_DEBUG_SERVER_PORT +to an available port number and run the \c qmlviewer. For example: + +\code + QML_DEBUG_SERVER_PORT=3768 qmlviewer myqmlfile.qml +\endcode + +Then in another process, start the \c qmldebugger tool, enter the port number into the corresponding spinbox +in the top right hand corner, and press the "Connect" button. + \section1 Debugging Transitions diff --git a/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec b/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec index cdba135..1cf12cf 100644 --- a/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec +++ b/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec @@ -19,10 +19,10 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. Qml support http://qt.nokia.com - - - - - + + + + + - \ No newline at end of file + diff --git a/tools/qmldebugger/creatorplugin/README b/tools/qmldebugger/creatorplugin/README index e7e205e..5723dca 100644 --- a/tools/qmldebugger/creatorplugin/README +++ b/tools/qmldebugger/creatorplugin/README @@ -1,5 +1,11 @@ +The qmldebugger Qt Creator plugin currently builds with Qt Creator 1.3. + To enable this project, qmldebugger.pro requires that these two environment variables be defined: CREATOR_SRC_DIR -> source directory for Qt Creator CREATOR_BUILD_DIR -> build directory for Qt Creator + +Once these are defined, run qmake on qmldebugger.pro. + +The project will be built into Creator's plugin directory. -- cgit v0.12 From 7cfbd79775692b3acc98cfd39d6a6384f3b59b89 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Tue, 8 Dec 2009 17:01:35 +1000 Subject: Compile when in a module. --- tools/qmlviewer/qmlfolderlistmodel.cpp | 2 +- tools/qmlviewer/qmlviewer.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qmlviewer/qmlfolderlistmodel.cpp b/tools/qmlviewer/qmlfolderlistmodel.cpp index 4cbc426..4f33f31 100644 --- a/tools/qmlviewer/qmlfolderlistmodel.cpp +++ b/tools/qmlviewer/qmlfolderlistmodel.cpp @@ -42,7 +42,7 @@ #include "qmlfolderlistmodel.h" #include #include -#include +#include class QmlFolderListModelPrivate { diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index dcf420e..831c680 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -43,8 +43,8 @@ #include "ui_recopts.h" #include "qmlviewer.h" -#include -#include +#include +#include #include "qml.h" #include #include -- cgit v0.12