Changeset 846 for trunk/doc/src/examples/completer.qdoc
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/doc/src/examples/completer.qdoc
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 7 7 ** This file is part of the documentation of the Qt Toolkit. 8 8 ** 9 ** $QT_BEGIN_LICENSE: LGPL$9 ** $QT_BEGIN_LICENSE:L$ 10 10 ** Commercial Usage 11 11 ** Licensees holding valid Qt Commercial licenses may use this file in 12 12 ** accordance with the Qt Commercial License Agreement provided with the 13 ** Software or, alternatively, in accordance with the terms contained in 14 ** a written agreement between you and Nokia. 15 ** 16 ** GNU Lesser General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU Lesser 18 ** General Public License version 2.1 as published by the Free Software 19 ** Foundation and appearing in the file LICENSE.LGPL included in the 20 ** packaging of this file. Please review the following information to 21 ** ensure the GNU Lesser General Public License version 2.1 requirements 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 23 ** 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 ** 28 ** GNU General Public License Usage 29 ** Alternatively, this file may be used under the terms of the GNU 30 ** General Public License version 3.0 as published by the Free Software 31 ** Foundation and appearing in the file LICENSE.GPL included in the 32 ** packaging of this file. Please review the following information to 33 ** ensure the GNU General Public License version 3.0 requirements will be 34 ** met: http://www.gnu.org/copyleft/gpl.html. 13 ** Software or, alternatively, in accordance with the terms contained in a 14 ** written agreement between you and Nokia. 15 ** 16 ** GNU Free Documentation License 17 ** Alternatively, this file may be used under the terms of the GNU Free 18 ** Documentation License version 1.3 as published by the Free Software 19 ** Foundation and appearing in the file included in the packaging of this 20 ** file. 35 21 ** 36 22 ** If you have questions regarding the use of this file, please contact … … 49 35 \image completer-example.png 50 36 51 This example uses a custom item model, \c DirModel, and a QCompleter object.37 This example uses a custom item model, \c Model, and a QCompleter object. 52 38 QCompleter is a class that provides completions based on an item model. The 53 39 type of model, the completion mode, and the case sensitivity can be … … 62 48 \quotefile examples/tools/completer/completer.qrc 63 49 64 \section1 DirModel Class Definition65 66 The \c DirModel class is a subclass of QDirModel, which provides a data50 \section1 Model Class Definition 51 52 The \c Model, which provides a data 67 53 model for the local filesystem. 68 54 69 \snippet examples/tools/completer/ dirmodel.h 055 \snippet examples/tools/completer/model.h 0 70 56 71 57 This class only has a constructor and a \c data() function as it is only 72 58 created to enable \c data() to return the entire file path for the 73 display role, unlike \l{Q DirModel}'s \c data() function that only returns59 display role, unlike \l{QModel}'s \c data() function that only returns 74 60 the folder and not the drive label. This is further explained in 75 \c DirModel's implementation.76 77 \section1 DirModel Class Implementation78 79 The constructor for the \c DirModel class is used to pass \a parent to80 Q DirModel.81 82 \snippet examples/tools/completer/ dirmodel.cpp 061 \c Model's implementation. 62 63 \section1 Model Class Implementation 64 65 The constructor for the \c Model class is used to pass \a parent to 66 QModel. 67 68 \snippet examples/tools/completer/model.cpp 0 83 69 84 70 As mentioned earlier, the \c data() function is reimplemented in order to 85 71 get it to return the entire file parth for the display role. For example, 86 with a Q DirModel, you will see "Program Files" in the view. However, with87 \c DirModel, you will see "C:\\Program Files".88 89 \snippet examples/tools/completer/ dirmodel.cpp 172 with a QModel, you will see "Program Files" in the view. However, with 73 \c Model, you will see "C:\\Program Files". 74 75 \snippet examples/tools/completer/model.cpp 1 90 76 91 77 The screenshots below illustrate this difference: … … 121 107 122 108 We set up three QComboBox objects, \c modelComb, \c modeCombo and 123 \c caseCombo. By default, the \c modelCombo is set to Q DirModel,109 \c caseCombo. By default, the \c modelCombo is set to QModel, 124 110 the \c modeCombo is set to "Filtered Popup" and the \c caseCombo is set 125 111 to "Case Insensitive". … … 203 189 204 190 A \c switch statement is used to change the item model based on the index 205 of \c modelCombo. If \c case is 0, we use an unsorted Q DirModel, providing191 of \c modelCombo. If \c case is 0, we use an unsorted QModel, providing 206 192 us with a file path excluding the drive label. 207 193
Note:
See TracChangeset
for help on using the changeset viewer.