diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-08 07:12:42 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-08 07:12:42 (GMT) |
commit | 3c34240b013e6bd251b35cd66a59fdabbfe7335f (patch) | |
tree | ec50a1fac90ef22a58e7c692375bbbb5f2b98b21 | |
parent | b6170b833f424e641446d5cec40d2021dcfa2a0a (diff) | |
parent | 7cfbd79775692b3acc98cfd39d6a6384f3b59b89 (diff) | |
download | Qt-3c34240b013e6bd251b35cd66a59fdabbfe7335f.zip Qt-3c34240b013e6bd251b35cd66a59fdabbfe7335f.tar.gz Qt-3c34240b013e6bd251b35cd66a59fdabbfe7335f.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
32 files changed, 323 insertions, 40 deletions
diff --git a/doc/doc.pri b/doc/doc.pri index a5e4a82..9d7d5da 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -35,12 +35,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/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/pics/qmldebugger-creator.png b/doc/src/declarative/pics/qmldebugger-creator.png Binary files differnew file mode 100644 index 0000000..da1e22d --- /dev/null +++ b/doc/src/declarative/pics/qmldebugger-creator.png diff --git a/doc/src/declarative/qmldebugging.qdoc b/doc/src/declarative/qmldebugging.qdoc new file mode 100644 index 0000000..13ad5f7 --- /dev/null +++ b/doc/src/declarative/qmldebugging.qdoc @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** 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 + +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 + +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 new file mode 100644 index 0000000..4b62fcb --- /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 \l {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 */ 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 @@ <string>Please read the LICENSE file before checking</string> </property> <property name="text" > - <string>I &accept the terms and &conditions</string> + <string>I accept the terms and &conditions</string> </property> </widget> </item> 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/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<QmlGraphicsItem *>(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/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) diff --git a/src/declarative/graphicsitems/qmlgraphicstextedit.cpp b/src/declarative/graphicsitems/qmlgraphicstextedit.cpp index 747e2fb..0b8bc83 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 >= 0x040601 // XXX see bug QT-2236 control->setIgnoreUnusedNavigationEvents(true); +#endif QObject::connect(control, SIGNAL(updateRequest(QRectF)), q, SLOT(updateImgCache(QRectF))); 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<QObject *> @@ -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; 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/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp index bd6d540..63d5b70 100644 --- a/src/declarative/qml/qmlengine.cpp +++ b/src/declarative/qml/qmlengine.cpp @@ -147,11 +147,18 @@ 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); 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)); @@ -233,6 +240,8 @@ QmlEnginePrivate::~QmlEnginePrivate() typeNameClass = 0; delete listClass; listClass = 0; + delete globalClass; + globalClass = 0; for(int ii = 0; ii < bindValues.count(); ++ii) clear(bindValues[ii]); @@ -309,7 +318,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<QmlGraphicsItem *>(component.create()); //add item to view, etc 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/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/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) 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.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); 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) 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) { 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(); 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") } +} + 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) 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 -# 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/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.</license> <description>Qml support</description> <url>http://qt.nokia.com</url> <dependencyList> - <dependency name="QmlProjectManager" version="1.3.80"/> - <dependency name="ProjectExplorer" version="1.3.80"/> - <dependency name="CppTools" version="1.3.80"/> - <dependency name="CppEditor" version="1.3.80"/> - <dependency name="Help" version="1.3.80"/> + <dependency name="QmlProjectManager" version="1.3.0"/> + <dependency name="ProjectExplorer" version="1.3.0"/> + <dependency name="CppTools" version="1.3.0"/> + <dependency name="CppEditor" version="1.3.0"/> + <dependency name="Help" version="1.3.0"/> </dependencyList> -</plugin>
\ No newline at end of file +</plugin> 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. 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 <QDirModel> #include <QDebug> -#include <QtDeclarative/qmlcontext.h> +#include <qmlcontext.h> class QmlFolderListModelPrivate { diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp index 1811327..831c680 100644 --- a/tools/qmlviewer/qmlviewer.cpp +++ b/tools/qmlviewer/qmlviewer.cpp @@ -43,8 +43,8 @@ #include "ui_recopts.h" #include "qmlviewer.h" -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlengine.h> +#include <qmlcontext.h> +#include <qmlengine.h> #include "qml.h" #include <private/qperformancelog_p_p.h> #include <private/qabstractanimation_p.h> @@ -547,7 +547,7 @@ void QmlViewer::createMenu(QMenuBar *menu, QMenu *flatmenu) settingsMenu->addAction(fullscreenAction); #endif - 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); @@ -562,8 +562,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")); 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)" |