diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2012-09-19 09:15:38 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-21 19:59:16 +0200 |
commit | d1f74b8ddf7a6f26f8b2a689cc728282bc68125c (patch) | |
tree | d3e369cdf317aedde6018ebf8adfb4ba17129e00 /examples/tools/doc/src | |
parent | d16c565ca6a55788435c52ad45647eda67854d80 (diff) |
Move examples to proper location.
Change-Id: Ib808f5d99cb8217f8786411b531fa5bc7fa5250a
Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'examples/tools/doc/src')
-rw-r--r-- | examples/tools/doc/src/customcompleter.qdoc | 34 | ||||
-rw-r--r-- | examples/tools/doc/src/customtype.qdoc | 18 |
2 files changed, 26 insertions, 26 deletions
diff --git a/examples/tools/doc/src/customcompleter.qdoc b/examples/tools/doc/src/customcompleter.qdoc index 98a95e47a4..7cf00a275b 100644 --- a/examples/tools/doc/src/customcompleter.qdoc +++ b/examples/tools/doc/src/customcompleter.qdoc @@ -43,7 +43,7 @@ that has a list of words to help QCompleter complete words. This file contains the following: - \quotefile examples/tools/customcompleter/customcompleter.qrc + \quotefile customcompleter/customcompleter.qrc \section1 TextEdit Class Definition @@ -54,7 +54,7 @@ contains a private function \c textUnderCursor() and a private instance of QCompleter, \c c. - \snippet examples/tools/customcompleter/textedit.h 0 + \snippet customcompleter/textedit.h 0 \section1 TextEdit Class Implementation @@ -63,11 +63,11 @@ the \c TextEdit object, using the \l{QTextEdit::setPlainText()}{setPlainText()} function. - \snippet examples/tools/customcompleter/textedit.cpp 0 + \snippet customcompleter/textedit.cpp 0 In addition, \c TextEdit also includes a default destructor: - \snippet examples/tools/customcompleter/textedit.cpp 1 + \snippet customcompleter/textedit.cpp 1 The \c setCompleter() function accepts a \a completer and sets it up. We use \c{if (c)} to check if \c c has been initialized. If it has been @@ -75,7 +75,7 @@ the signal from the slot. This is to ensure that no previous completer object is still connected to the slot. - \snippet examples/tools/customcompleter/textedit.cpp 2 + \snippet customcompleter/textedit.cpp 2 We then instantiate \c c with \a completer and set it as \c{TextEdit}'s widget. The completion mode and case sensitivity are also set and then @@ -84,7 +84,7 @@ The \c completer() function is a getter function that returns \c c. - \snippet examples/tools/customcompleter/textedit.cpp 3 + \snippet customcompleter/textedit.cpp 3 The completer pops up the options available, based on the contents of \e wordlist.txt, but the text cursor is responsible for filling in the @@ -99,7 +99,7 @@ completer's widget is \c TextEdit before using \c tc to insert the extra characters to complete the word. - \snippet examples/tools/customcompleter/textedit.cpp 4 + \snippet customcompleter/textedit.cpp 4 The figure below illustrates this process: @@ -116,13 +116,13 @@ The \c textUnderCursor() function uses a QTextCursor, \c tc, to select a word under the cursor and return it. - \snippet examples/tools/customcompleter/textedit.cpp 5 + \snippet customcompleter/textedit.cpp 5 The \c TextEdit class reimplements \l{QWidget::focusInEvent()} {focusInEvent()} function, which is an event handler used to receive keyboard focus events for the widget. - \snippet examples/tools/customcompleter/textedit.cpp 6 + \snippet customcompleter/textedit.cpp 6 The \l{QAbstractScrollArea::keyPressEvent()}{keyPressEvent()} is reimplemented to ignore key events like Qt::Key_Enter, Qt::Key_Return, @@ -131,12 +131,12 @@ If there is an active completer, we cannot process the shortcut, Ctrl+E. - \snippet examples/tools/customcompleter/textedit.cpp 7 + \snippet customcompleter/textedit.cpp 7 We also handle other modifiers and shortcuts for which we do not want the completer to respond to. - \snippet examples/tools/customcompleter/textedit.cpp 8 + \snippet customcompleter/textedit.cpp 8 Finally, we pop up the completer. @@ -147,7 +147,7 @@ \c createMenu() and \c modelFromFile() as well as private instances of QCompleter and \c TextEdit. - \snippet examples/tools/customcompleter/mainwindow.h 0 + \snippet customcompleter/mainwindow.h 0 \section1 MainWindow Class Implementation @@ -157,31 +157,31 @@ to populate the \c completer. The \c{MainWindow}'s central widget is set to \c TextEdit and its size is set to 500 x 300. - \snippet examples/tools/customcompleter/mainwindow.cpp 0 + \snippet customcompleter/mainwindow.cpp 0 The \c createMenu() function creates the necessary QAction objects needed for the "File" and "Help" menu and their \l{QAction::triggered()} {triggered()} signals are connected to the \c quit(), \c about(), and \c aboutQt() slots respectively. - \snippet examples/tools/customcompleter/mainwindow.cpp 1 + \snippet customcompleter/mainwindow.cpp 1 The \c modelFromFile() function accepts a \a fileName and attempts to extract the contents of this file into a QStringListModel. We display the Qt::WaitCursor when we are populating the QStringList, \c words, and restore the mouse cursor when we are done. - \snippet examples/tools/customcompleter/mainwindow.cpp 2 + \snippet customcompleter/mainwindow.cpp 2 The \c about() function provides a brief description about the Custom Completer example. - \snippet examples/tools/customcompleter/mainwindow.cpp 3 + \snippet customcompleter/mainwindow.cpp 3 \section1 \c main() Function The \c main() function instantiates \c MainWindow and invokes the \l{QWidget::show()}{show()} function. - \snippet examples/tools/customcompleter/main.cpp 0 + \snippet customcompleter/main.cpp 0 */ diff --git a/examples/tools/doc/src/customtype.qdoc b/examples/tools/doc/src/customtype.qdoc index b2f86d6890..e6511a08b4 100644 --- a/examples/tools/doc/src/customtype.qdoc +++ b/examples/tools/doc/src/customtype.qdoc @@ -56,7 +56,7 @@ of information (a QString and a QStringList), each of which can be read using trivial getter functions: - \snippet examples/tools/customtype/message.h custom type definition + \snippet customtype/message.h custom type definition The default constructor, copy constructor and destructor are all required, and must be public, if the type is to be integrated into the @@ -67,14 +67,14 @@ To enable the type to be used with QVariant, we declare it using the Q_DECLARE_METATYPE() macro: - \snippet examples/tools/customtype/message.h custom type meta-type declaration + \snippet customtype/message.h custom type meta-type declaration We do not need to write any additional code to accompany this macro. To allow us to see a readable description of each \c Message object when it is sent to the debug output stream, we define a streaming operator: - \snippet examples/tools/customtype/message.h custom type streaming operator + \snippet customtype/message.h custom type streaming operator This facility is useful if you need to insert tracing statements in your code for debugging purposes. @@ -84,11 +84,11 @@ The implementation of the default constructor, copy constructor and destructor are straightforward for the \c Message class: - \snippet examples/tools/customtype/message.cpp Message class implementation + \snippet customtype/message.cpp Message class implementation The streaming operator is implemented in the following way: - \snippet examples/tools/customtype/message.cpp custom type streaming operator + \snippet customtype/message.cpp custom type streaming operator Here, we want to represent each value depending on how many lines are stored in the message body. We stream text to the QDebug object passed to the @@ -99,7 +99,7 @@ We include the code for the getter functions for completeness: - \snippet examples/tools/customtype/message.cpp getter functions + \snippet customtype/message.cpp getter functions With the type fully defined, implemented, and integrated with the meta-object system, we can now use it. @@ -109,13 +109,13 @@ In the example's \c{main()} function, we show how a \c Message object can be printed to the console by sending it to the debug stream: - \snippet examples/tools/customtype/main.cpp printing a custom type + \snippet customtype/main.cpp printing a custom type You can use the type with QVariant in exactly the same way as you would use standard Qt value types. Here's how to store a value using the QVariant::setValue() function: - \snippet examples/tools/customtype/main.cpp storing a custom value + \snippet customtype/main.cpp storing a custom value Alternatively, the QVariant::fromValue() and qVariantSetValue() functions can be used if you are using a compiler without support for member template @@ -124,7 +124,7 @@ The value can be retrieved using the QVariant::value() member template function: - \snippet examples/tools/customtype/main.cpp retrieving a custom value + \snippet customtype/main.cpp retrieving a custom value Alternatively, the qVariantValue() template function can be used if you are using a compiler without support for member template functions. |