summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc94
-rw-r--r--doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc49
2 files changed, 143 insertions, 0 deletions
diff --git a/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc b/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc
new file mode 100644
index 0000000..6c83c80
--- /dev/null
+++ b/doc/src/howtos/qmlbestpractices/qmlbestpractices-coding.qdoc
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qml-best-practices-coding.html
+ \ingroup qml-best-practices
+ \contentspage QML Best Practices Guides
+ \previouspage QML Best Practices Guides
+ \startpage QML Best Practices Guides
+ \title QML Best Practices: Coding Conventions
+
+ \brief QML Coding Conventions and Importing Files
+
+ There are many different ways to code using QML. These are a set of
+ guidelines to help your code look better and consistent.
+
+ \section1 Coding Conventions
+
+ The official QML Coding Conventions may be found at
+ \l {QML Coding Conventions}. This is the recommended convention that will be
+ used throughout the QML documentation.
+
+ In addition, Qt's official code style may be found at the \l {Qt Coding Style}.
+
+ \section1 Importing Files into QML
+
+ To import items such as directories, use the "import" keyword, similar to
+ the way the \c {import QtQuick 1.0} statement is used.
+
+ \qml
+ import QtQuick 1.0
+ import QtWebKit 1.0
+ import "subdirectory"
+ import "script.js"
+ \endqml
+
+ To facilitate the importation of QML components, it is best to begin the QML
+ file with an uppercase character. This way, the user can simply declare the
+ component using the file name as the component name. For example, if a QML
+ component is in a file named \c Button.qml, then the user may import the
+ component by declaring a \c {Button {}}. Note that this method only works if
+ the QML files are in the same directory.
+
+ \qml
+ import QtQuick 1.0
+
+ Rectangle {
+ width: 50; height: 50
+
+ Button {} //Button is defined in Button.qml in the same directory
+ }
+ \endqml
+
+ It is also possible to import QML files which have file names that begin in
+ lower case or files in a different directory by using a \c qmldir file.
+
+ A \c qmldir file tells your QML application which QML components, plugins,
+ or directories to import. The \c qmldir file must reside in an imported
+ directory.
+
+ \code
+ //A very simple qmldir file
+
+ Button ./custom.qml //a QML component called Button in the file custom.qml
+ plugin FilePlugin ./plugins //a plugin called FileDialog in the plugins directory
+ \endcode
+
+ By using the \c qmldir file, users may import any QML file and assign any
+ valid QML component name to the component.
+*/
diff --git a/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc b/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc
new file mode 100644
index 0000000..0f6d74b
--- /dev/null
+++ b/doc/src/howtos/qmlbestpractices/qmlbestpractices-datatypes.qdoc
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*!
+ \page qml-best-practices-datatypes.html
+ \ingroup qml-best-practices
+ \contentspage QML Best Practices Guides
+ \previouspage QML Best Practices Guides
+ \startpage QML Best Practices Guides
+ \title QML Best Practices: Data Types
+
+ \brief Using Basic Data Types and Custom Types in QML
+
+ QML supports many basic data types, Qt data types, and custom data types.
+
+ \section1 Basic Data Types
+
+ \section1 Qt Data Types
+
+ \section1 Exporting Qt Types to QML
+
+ Programmers may create C++ data structures and expose them to QML, making
+ data accessible from QML.
+
+ \section2 Using QStringLists in QML
+*/