Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rename QDeclarative symbols to QQuick and QQml
Symbols beginning with QDeclarative are already exported
by the quick1 module.

Users can apply the bin/rename-qtdeclarative-symbols.sh
script to modify client code using the previous names of the
renamed symbols.

Task-number: QTBUG-23737
Change-Id: Ifaa482663767634931e8711a8e9bf6e404859e66
Reviewed-by: Martin Jones <martin.jones@nokia.com>
  • Loading branch information
Matthew Vogt authored and Qt by Nokia committed Feb 24, 2012
1 parent 6a42a6e commit b855240
Show file tree
Hide file tree
Showing 5,928 changed files with 153,592 additions and 152,791 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
639 changes: 639 additions & 0 deletions bin/rename-qtdeclarative-symbols.sh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/src/localstorage/localstorage.qdoc
Expand Up @@ -43,7 +43,7 @@ provide the ability to access local storage in an SQL database.

These databases are user-specific and QML-specific, but accessible to all QML applications.
They are stored in the \c Databases subdirectory
of QDeclarativeEngine::offlineStoragePath(), currently as SQLite databases.
of QQmlEngine::offlineStoragePath(), currently as SQLite databases.

Database connections are automatically closed during Javascript garbage collection.

Expand Down
2 changes: 1 addition & 1 deletion doc/src/qml/basictypes.qdoc
Expand Up @@ -180,7 +180,7 @@
\div{float-right}
\inlineimage declarative-colors.png
\enddiv
\snippet doc/src/snippets/declarative/colors.qml colors
\snippet doc/src/snippets/qml/colors.qml colors

Or with the \l{QML:Qt::rgba()}{Qt.rgba()}, \l{QML:Qt::hsla()}{Qt.hsla()}, \l{QML:Qt::darker()}{Qt.darker()},
\l{QML:Qt::lighter()}{Qt.lighter()} or \l{QML:Qt::tint()}{Qt.tint()} functions:
Expand Down
10 changes: 5 additions & 5 deletions doc/src/qml/c++models.qdoc
Expand Up @@ -57,7 +57,7 @@ models.

\bold{Note:} There is no way for the view to know that the contents of a QStringList
have changed. If the QStringList changes, it will be necessary to reset
the model by calling QDeclarativeContext::setContextProperty() again.
the model by calling QQmlContext::setContextProperty() again.


\section1 QObjectList-based model
Expand Down Expand Up @@ -92,7 +92,7 @@ models.

Note: There is no way for the view to know that the contents of a QList
have changed. If the QList changes, it will be necessary to reset
the model by calling QDeclarativeContext::setContextProperty() again.
the model by calling QQmlContext::setContextProperty() again.


\section1 QAbstractItemModel
Expand Down Expand Up @@ -160,18 +160,18 @@ models.

\section1 Exposing C++ Data Models to QML

The above examples use QDeclarativeContext::setContextProperty() to set
The above examples use QQmlContext::setContextProperty() to set
model values directly in QML components. An alternative to this is to
register the C++ model class as a QML type from a QML C++ plugin using
QDeclarativeExtensionPlugin. This would allow the model classes to be
QQmlExtensionPlugin. This would allow the model classes to be
created directly as elements within QML:

\table
\row

\o
\code
class MyModelPlugin : public QDeclarativeExtensionPlugin
class MyModelPlugin : public QQmlExtensionPlugin
{
public:
void registerTypes(const char *uri)
Expand Down
20 changes: 10 additions & 10 deletions doc/src/qml/codingconventions.qdoc
Expand Up @@ -52,7 +52,7 @@ For better readability, we separate these different parts with an empty line.

For example, a hypothetical \i photo QML object would look like this:

\snippet doc/src/snippets/declarative/codingconventions/photo.qml 0
\snippet doc/src/snippets/qml/codingconventions/photo.qml 0


\section1 Grouped Properties
Expand All @@ -62,11 +62,11 @@ we use the \i {group notation} rather than the \i {dot notation} to improve read

For example, this:

\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 0
\snippet doc/src/snippets/qml/codingconventions/dotproperties.qml 0

can be written like this:

\snippet doc/src/snippets/declarative/codingconventions/dotproperties.qml 1
\snippet doc/src/snippets/qml/codingconventions/dotproperties.qml 1


\section1 Private Properties
Expand All @@ -78,7 +78,7 @@ the implementation. As a convention, private properties begin with two
accessible but is not meant for public use. Note that QML and JavaScript will
grant the user access to these properties.

\snippet doc/src/snippets/declarative/codingconventions/private.qml 0
\snippet doc/src/snippets/qml/codingconventions/private.qml 0


\section1 Lists
Expand All @@ -89,30 +89,30 @@ For example, it is very common for a component to only have one state.

In this case, instead of:

\snippet doc/src/snippets/declarative/codingconventions/lists.qml 0
\snippet doc/src/snippets/qml/codingconventions/lists.qml 0

we will write this:

\snippet doc/src/snippets/declarative/codingconventions/lists.qml 1
\snippet doc/src/snippets/qml/codingconventions/lists.qml 1


\section1 JavaScript Code

If the script is a single expression, we recommend writing it inline:

\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 0
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 0

If the script is only a couple of lines long, we generally use a block:

\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 1
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 1

If the script is more than a couple of lines long or can be used by different objects, we recommend creating a function and calling it like this:

\snippet doc/src/snippets/declarative/codingconventions/javascript.qml 2
\snippet doc/src/snippets/qml/codingconventions/javascript.qml 2

For long scripts, we will put the functions in their own JavaScript file and import it like this:

\snippet doc/src/snippets/declarative/codingconventions/javascript-imports.qml 0
\snippet doc/src/snippets/qml/codingconventions/javascript-imports.qml 0

*/

Expand Down
10 changes: 5 additions & 5 deletions doc/src/qml/debugging.qdoc
Expand Up @@ -148,11 +148,11 @@ If you set \c {QML_IMPORT_TRACE=1} before running the \l {QML Viewer}
(or your QML C++ application), you will see output similar to this:

\code
QDeclarativeImportDatabase::addImportPath "/qt-sdk/imports"
QDeclarativeImportDatabase::addImportPath "/qt-sdk/bin/QMLViewer.app/Contents/MacOS"
QDeclarativeImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
QDeclarativeImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
QDeclarativeImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
QQmlImportDatabase::addImportPath "/qt-sdk/imports"
QQmlImportDatabase::addImportPath "/qt-sdk/bin/QMLViewer.app/Contents/MacOS"
QQmlImportDatabase::addToImport 0x106237370 "." -1.-1 File as ""
QQmlImportDatabase::addToImport 0x106237370 "Qt" 4.7 Library as ""
QQmlImportDatabase::resolveType "Rectangle" = "QDeclarativeRectangle"
\endcode


Expand Down
32 changes: 16 additions & 16 deletions doc/src/qml/dynamicobjects.qdoc
Expand Up @@ -80,31 +80,31 @@ the component. This function can take one or two arguments:

Here is an example. First there is \c Sprite.qml, which defines a simple QML component:

\snippet doc/src/snippets/declarative/Sprite.qml 0
\snippet doc/src/snippets/qml/Sprite.qml 0

Our main application file, \c main.qml, imports a \c componentCreation.js JavaScript file
that will create \c Sprite objects:

\snippet doc/src/snippets/declarative/createComponent.qml 0
\snippet doc/src/snippets/qml/createComponent.qml 0

Here is \c componentCreation.js. Notice it checks whether the component \l{Component::status}{status} is
\c Component.Ready before calling \l {Component::createObject()}{createObject()}
in case the QML file is loaded over a network and thus is not ready immediately.

\snippet doc/src/snippets/declarative/componentCreation.js vars
\snippet doc/src/snippets/qml/componentCreation.js vars
\codeline
\snippet doc/src/snippets/declarative/componentCreation.js func
\snippet doc/src/snippets/declarative/componentCreation.js remote
\snippet doc/src/snippets/declarative/componentCreation.js func-end
\snippet doc/src/snippets/qml/componentCreation.js func
\snippet doc/src/snippets/qml/componentCreation.js remote
\snippet doc/src/snippets/qml/componentCreation.js func-end
\codeline
\snippet doc/src/snippets/declarative/componentCreation.js finishCreation
\snippet doc/src/snippets/qml/componentCreation.js finishCreation

If you are certain the QML file to be loaded is a local file, you could omit the \c finishCreation()
function and call \l {Component::createObject()}{createObject()} immediately:

\snippet doc/src/snippets/declarative/componentCreation.js func
\snippet doc/src/snippets/declarative/componentCreation.js local
\snippet doc/src/snippets/declarative/componentCreation.js func-end
\snippet doc/src/snippets/qml/componentCreation.js func
\snippet doc/src/snippets/qml/componentCreation.js local
\snippet doc/src/snippets/qml/componentCreation.js func-end

Notice in both instances, \l {Component::createObject()}{createObject()} is called with
\c appWindow passed as an argument so that the created object will become a child of the
Expand All @@ -124,7 +124,7 @@ use the signal \c connect() method. See
If the QML is not defined until runtime, you can create a QML item from
a string of QML using the \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example:

\snippet doc/src/snippets/declarative/createQmlObject.qml 0
\snippet doc/src/snippets/qml/createQmlObject.qml 0

The first argument is the string of QML to create. Just like in a new file, you will need to
import any types you wish to use. The second argument is the parent item for the new item;
Expand All @@ -145,7 +145,7 @@ The actual creation context depends on how an item is created:

\list
\o If \l {QML:Qt::createComponent()}{Qt.createComponent()} is used, the creation context
is the QDeclarativeContext in which this method is called
is the QQmlContext in which this method is called
\o If \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
if called, the creation context is the context of the parent item passed to this method
\o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()}
Expand Down Expand Up @@ -181,8 +181,8 @@ component. Each instance runs a NumberAnimation, and when the animation has fini
\o \c SelfDestroyingRect.qml

\row
\o \snippet doc/src/snippets/declarative/dynamicObjects-destroy.qml 0
\o \snippet doc/src/snippets/declarative/SelfDestroyingRect.qml 0
\o \snippet doc/src/snippets/qml/dynamicObjects-destroy.qml 0
\o \snippet doc/src/snippets/qml/SelfDestroyingRect.qml 0

\endtable

Expand All @@ -209,6 +209,6 @@ destroyed if they were dynamically created.
Objects created with \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}
can similarly be destroyed using \c destroy():

\snippet doc/src/snippets/declarative/createQmlObject.qml 0
\snippet doc/src/snippets/declarative/createQmlObject.qml destroy
\snippet doc/src/snippets/qml/createQmlObject.qml 0
\snippet doc/src/snippets/qml/createQmlObject.qml destroy
*/
30 changes: 15 additions & 15 deletions doc/src/qml/extending-tutorial.qdoc
Expand Up @@ -100,14 +100,14 @@ Here is our \c PieChart class, defined in \c piechart.h:

\snippet declarative/tutorials/extending/chapter1-basics/piechart.h 0

The class inherits from QDeclarativeItem because we want to override
QDeclarativeItem::paint() in order to draw. If the class just represented some
The class inherits from QQuickItem because we want to override
QQuickItem::paint() in order to draw. If the class just represented some
data type and was not an item that actually needed to be displayed, it could simply inherit
from QObject. Or, if we want to extend the functionality of an existing QObject-based
class, it could inherit from that class instead.

The \c PieChart class defines the two properties, \c name and \c color, with the Q_PROPERTY macro,
and overrides QDeclarativeItem::paint(). The class implementation in \c piechart.cpp
and overrides QQuickItem::paint(). The class implementation in \c piechart.cpp
simply sets and returns the \c m_name and \c m_color values as appropriate, and
implements \c paint() to draw a simple pie chart. It also turns off the
QGraphicsItem::ItemHasNoContents flag to enable painting:
Expand All @@ -127,7 +127,7 @@ converted to a QColor object for the PieChart \c color property. Automatic conve
provided for various other \l {QML Basic Types}{basic types}; for example, a string
like "640x480" can be automatically converted to a QSize value.

We'll also create a C++ application that uses a QDeclarativeView to run and
We'll also create a C++ application that uses a QQuickView to run and
display \c app.qml. The application must register the \c PieChart type
using the qmlRegisterType() function, to allow it to be used from QML. If
you don't register the type, \c app.qml won't be able to create a \c PieChart.
Expand Down Expand Up @@ -265,7 +265,7 @@ int-type property to store an identifier for each chart:

\code
// C++
class PieChart : public QDeclarativeItem
class PieChart : public QQuickItem
{
Q_PROPERTY(int chartId READ chartId WRITE setChartId NOTIFY chartIdChanged)
...
Expand Down Expand Up @@ -306,7 +306,7 @@ we assign an \c PieSlice value which itself contains a \c color:

\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml 0

Like \c PieChart, this new \c PieSlice type inherits from QDeclarativeItem and declares
Like \c PieChart, this new \c PieSlice type inherits from QQuickItem and declares
its properties with Q_PROPERTY():

\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/pieslice.h 0
Expand All @@ -324,7 +324,7 @@ and associated method signatures:

There is one thing to be aware of when implementing \c setPieSlice(). The \c PieSlice
is a visual item, so it must be set as a child of the \c PieChart using
QDeclarativeItem::setParentItem() so that the \c PieChart knows to paint this child
QQuickItem::setParentItem() so that the \c PieChart knows to paint this child
item when its contents are drawn:

\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/piechart.cpp 0
Expand Down Expand Up @@ -359,7 +359,7 @@ have a \c slices property that accepts a list of \c PieSlice items:
\image extending-tutorial-chapter5.png

To do this, we replace the \c pieSlice property in \c PieChart with a \c slices property,
declared as a QDeclarativeListProperty type. The QDeclarativeListProperty class enables the
declared as a QQmlListProperty type. The QQmlListProperty class enables the
creation of list properties in QML extensions. We replace the \c pieSlice()
function with a \c slices() function that returns a list of slices, and add
an internal \c append_slice() function (discussed below). We also use a QList to
Expand All @@ -372,17 +372,17 @@ store the internal list of slices as \c m_slices:
\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.h 2

Although the \c slices property does not have an associated \c WRITE function,
it is still modifiable because of the way QDeclarativeListProperty works.
it is still modifiable because of the way QQmlListProperty works.
In the \c PieChart implementation, we implement \c PieChart::slices() to
return a QDeclarativeListProperty value and indicate that the internal
return a QQmlListProperty value and indicate that the internal
\c PieChart::append_slice() function is to be called whenever a request is made from QML
to add items to the list:

\snippet declarative/tutorials/extending/chapter5-listproperties/piechart.cpp 0

The \c append_slice() function simply sets the parent item as before,
and adds the new item to the \c m_slices list. As you can see, the append function for a
QDeclarativeListProperty is called with two arguments: the list property, and
QQmlListProperty is called with two arguments: the list property, and
the item that is to be appended.

The \c PieSlice class has also been modified to include \c fromAngle and \c angleSpan
Expand All @@ -400,7 +400,7 @@ The complete code can be seen in the updated \c examples/tutorials/extending/cha
\example declarative/tutorials/extending/chapter6-plugins

Currently the \c PieChart and \c PieSlice types are used by \c app.qml,
which is displayed using a QDeclarativeView in a C++ application. An alternative
which is displayed using a QQuickView in a C++ application. An alternative
way to use our QML extension is to create a plugin library to make it available
to the QML engine. This allows \c app.qml to be loaded with the \l {QML Viewer}
(or some other QML \l{Qt Declarative UI Runtime}{runtime} application) instead of writing a \c main.cpp file and
Expand All @@ -414,8 +414,8 @@ To create a plugin library, we need:
\o A \l{Writing a qmldir file}{qmldir} file that tells the QML engine to load the plugin
\endlist

First, we create a plugin class named \c ChartsPlugin. It subclasses QDeclarativeExtensionPlugin
and registers our QML types in the inherited \l{QDeclarativeExtensionPlugin::}{registerTypes()} method. It also calls
First, we create a plugin class named \c ChartsPlugin. It subclasses QQmlExtensionPlugin
and registers our QML types in the inherited \l{QQmlExtensionPlugin::}{registerTypes()} method. It also calls
Q_EXPORT_PLUGIN2 for Qt's \l{How to Create Qt Plugins}{plugin system}.

Here is the \c ChartsPlugin definition in \c chartsplugin.h:
Expand Down Expand Up @@ -464,7 +464,7 @@ In this tutorial, we've shown the basic steps for creating a QML extension:
\o Add callable methods using Q_INVOKABLE or Qt slots, and connect to Qt signals with an \c onSignal syntax
\o Add property bindings by defining \l{Qt's Property System}{NOTIFY} signals
\o Define custom property types if the built-in types are not sufficient
\o Define list property types using QDeclarativeListProperty
\o Define list property types using QQmlListProperty
\o Create a plugin library by defining a Qt plugin and writing a \c qmldir file
\endlist

Expand Down
18 changes: 9 additions & 9 deletions doc/src/qml/integrating.qdoc
Expand Up @@ -38,25 +38,25 @@ depending on the characteristics of your existing UI code.
\section1 Integrating with a \l{QWidget}-based UI

If you have an existing QWidget-based UI, QML widgets can be integrated into
it using QDeclarativeView. QDeclarativeView is a subclass of QWidget so you
it using QQuickView. QQuickView is a subclass of QWidget so you
can add it to your user interface like any other QWidget. Use
QDeclarativeView::setSource() to load a QML file into the view, then add the
QQuickView::setSource() to load a QML file into the view, then add the
view to your UI:

\code
QDeclarativeView *qmlView = new QDeclarativeView;
QQuickView *qmlView = new QQuickView;
qmlView->setSource(QUrl::fromLocalFile("myqml.qml"));

QWidget *widget = myExistingWidget();
QVBoxLayout *layout = new QVBoxLayout(widget);
layout->addWidget(qmlView);
\endcode

The one drawback to this approach is that QDeclarativeView is slower to initialize
and uses more memory than a QWidget, and creating large numbers of QDeclarativeView
The one drawback to this approach is that QQuickView is slower to initialize
and uses more memory than a QWidget, and creating large numbers of QQuickView
objects may lead to performance degradation. If this is the case, it may be
better to rewrite your widgets in QML, and load the widgets from a main QML widget
instead of using QDeclarativeView.
instead of using QQuickView.

Keep in mind that QWidgets were designed for a different type of user interface
than QML, so it is not always a good idea to port a QWidget-based application to
Expand All @@ -71,16 +71,16 @@ of simple and dynamic elements.

If you have an existing UI based on the \l{Graphics View Framework},
you can integrate QML widgets directly into your QGraphicsScene. Use
QDeclarativeComponent to create a QGraphicsObject from a QML file, and
QQmlComponent to create a QGraphicsObject from a QML file, and
place the graphics object into your scene using \l{QGraphicsScene::addItem()}, or
reparent it to an item already in the \l{QGraphicsScene}.

For example:

\code
QGraphicsScene* scene = myExistingGraphicsScene();
QDeclarativeEngine *engine = new QDeclarativeEngine;
QDeclarativeComponent component(engine, QUrl::fromLocalFile("myqml.qml"));
QQmlEngine *engine = new QQmlEngine;
QQmlComponent component(engine, QUrl::fromLocalFile("myqml.qml"));
QGraphicsObject *object =
qobject_cast<QGraphicsObject *>(component.create());
scene->addItem(object);
Expand Down

0 comments on commit b855240

Please sign in to comment.