From e92c1976a6bc1a73b45f182a72b75d1617f677ca Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 5 Sep 2012 16:53:23 +0200 Subject: Fix example includes for qdoc. Change-Id: Ifa6a99db27ce51529489bf077a839a3107b524d2 Reviewed-by: Qt Doc Bot Reviewed-by: Paul Olav Tvete --- examples/widgets/doc/addressbook.qdoc | 68 +++++------ examples/widgets/doc/affine.qdoc | 2 +- examples/widgets/doc/animatedtiles.qdoc | 2 +- examples/widgets/doc/appchooser.qdoc | 2 +- examples/widgets/doc/application.qdoc | 92 +++++++-------- examples/widgets/doc/basicdrawing.qdoc | 70 ++++++------ examples/widgets/doc/basicgraphicslayouts.qdoc | 26 ++--- examples/widgets/doc/basiclayouts.qdoc | 30 ++--- examples/widgets/doc/basicsortfiltermodel.qdoc | 2 +- examples/widgets/doc/borderlayout.qdoc | 2 +- examples/widgets/doc/boxes.qdoc | 2 +- examples/widgets/doc/calendar.qdoc | 40 +++---- examples/widgets/doc/chart.qdoc | 4 +- examples/widgets/doc/chip.qdoc | 2 +- examples/widgets/doc/classwizard.qdoc | 36 +++--- examples/widgets/doc/coloreditorfactory.qdoc | 12 +- examples/widgets/doc/combowidgetmapper.qdoc | 20 ++-- examples/widgets/doc/composition.qdoc | 2 +- examples/widgets/doc/concentriccircles.qdoc | 32 +++--- examples/widgets/doc/configdialog.qdoc | 2 +- examples/widgets/doc/customsortfiltermodel.qdoc | 42 +++---- examples/widgets/doc/deform.qdoc | 2 +- examples/widgets/doc/diagramscene.qdoc | 146 ++++++++++++------------ examples/widgets/doc/dirview.qdoc | 2 +- examples/widgets/doc/dockwidgets.qdoc | 22 ++-- examples/widgets/doc/dragdroprobot.qdoc | 62 +++++----- examples/widgets/doc/dynamiclayouts.qdoc | 2 +- examples/widgets/doc/easing.qdoc | 2 +- examples/widgets/doc/editabletreemodel.qdoc | 56 ++++----- examples/widgets/doc/elasticnodes.qdoc | 64 +++++------ examples/widgets/doc/embeddeddialogs.qdoc | 2 +- examples/widgets/doc/eventtransitions.qdoc | 16 +-- examples/widgets/doc/extension.qdoc | 14 +-- examples/widgets/doc/factorial.qdoc | 16 +-- examples/widgets/doc/fetchmore.qdoc | 12 +- examples/widgets/doc/findfiles.qdoc | 30 ++--- examples/widgets/doc/flowlayout.qdoc | 28 ++--- examples/widgets/doc/fontsampler.qdoc | 2 +- examples/widgets/doc/frozencolumn.qdoc | 18 +-- examples/widgets/doc/gradients.qdoc | 2 +- examples/widgets/doc/imagecomposition.qdoc | 38 +++--- examples/widgets/doc/interview.qdoc | 2 +- examples/widgets/doc/itemviewspuzzle.qdoc | 2 +- examples/widgets/doc/licensewizard.qdoc | 46 ++++---- examples/widgets/doc/mainwindow.qdoc | 2 +- examples/widgets/doc/mdi.qdoc | 2 +- examples/widgets/doc/menus.qdoc | 26 ++--- examples/widgets/doc/moveblocks.qdoc | 34 +++--- examples/widgets/doc/orderform.qdoc | 60 +++++----- examples/widgets/doc/padnavigator.qdoc | 86 +++++++------- examples/widgets/doc/painterpaths.qdoc | 76 ++++++------ examples/widgets/doc/pathstroke.qdoc | 2 +- examples/widgets/doc/pingpong.qdoc | 16 +-- examples/widgets/doc/pixelator.qdoc | 56 ++++----- examples/widgets/doc/recentfiles.qdoc | 2 +- examples/widgets/doc/rogue.qdoc | 24 ++-- examples/widgets/doc/screenshot.qdoc | 26 ++--- examples/widgets/doc/sdi.qdoc | 2 +- examples/widgets/doc/simpledommodel.qdoc | 42 +++---- examples/widgets/doc/simpletreemodel.qdoc | 42 +++---- examples/widgets/doc/simplewidgetmapper.qdoc | 14 +-- examples/widgets/doc/sipdialog.qdoc | 20 ++-- examples/widgets/doc/spinboxdelegate.qdoc | 22 ++-- examples/widgets/doc/spreadsheet.qdoc | 2 +- examples/widgets/doc/standarddialogs.qdoc | 2 +- examples/widgets/doc/stardelegate.qdoc | 50 ++++---- examples/widgets/doc/states.qdoc | 2 +- examples/widgets/doc/stickman.qdoc | 14 +-- examples/widgets/doc/sub-attaq.qdoc | 2 +- examples/widgets/doc/syntaxhighlighter.qdoc | 34 +++--- examples/widgets/doc/tabdialog.qdoc | 26 ++--- examples/widgets/doc/textedit.qdoc | 2 +- examples/widgets/doc/trafficlight.qdoc | 12 +- examples/widgets/doc/transformations.qdoc | 58 +++++----- examples/widgets/doc/trivialwizard.qdoc | 10 +- examples/widgets/doc/twowaybutton.qdoc | 14 +-- 76 files changed, 929 insertions(+), 929 deletions(-) (limited to 'examples/widgets/doc') diff --git a/examples/widgets/doc/addressbook.qdoc b/examples/widgets/doc/addressbook.qdoc index 2c7ae054d4..9b4ede5775 100644 --- a/examples/widgets/doc/addressbook.qdoc +++ b/examples/widgets/doc/addressbook.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/addressbook + \example itemviews/addressbook \title Address Book Example The address book example shows how to use proxy models to display @@ -87,7 +87,7 @@ \c insertRows(), \c removeRows(), \c setData() and \c flags() functions. - \snippet widgets/itemviews/addressbook/tablemodel.h 0 + \snippet itemviews/addressbook/tablemodel.h 0 Two constructors are used, a default constructor which uses \c TableModel's own \c {QList>} and one @@ -101,7 +101,7 @@ The second constructor initializes the list of pairs in the model, with the parameter value. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 0 + \snippet itemviews/addressbook/tablemodel.cpp 0 The \c rowCount() and \c columnCount() functions return the dimensions of the model. Whereas, \c rowCount()'s value will vary @@ -112,7 +112,7 @@ \note The \c Q_UNUSED() macro prevents the compiler from generating warnings regarding unused parameters. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 1 + \snippet itemviews/addressbook/tablemodel.cpp 1 The \c data() function returns either a \b Name or \b {Address}, based on the contents of the model index @@ -121,7 +121,7 @@ by the QItemSelectionModel, which will be explained with \c AddressWidget. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 2 + \snippet itemviews/addressbook/tablemodel.cpp 2 The \c headerData() function displays the table's header, \b Name and \b Address. If you require numbered entries @@ -129,21 +129,21 @@ have hidden in this example (see the \c AddressWidget implementation). - \snippet widgets/itemviews/addressbook/tablemodel.cpp 3 + \snippet itemviews/addressbook/tablemodel.cpp 3 The \c insertRows() function is called before new data is added, otherwise the data will not be displayed. The \c beginInsertRows() and \c endInsertRows() functions are called to ensure all connected views are aware of the changes. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 4 + \snippet itemviews/addressbook/tablemodel.cpp 4 The \c removeRows() function is called to remove data. Again, \l{QAbstractItemModel::}{beginRemoveRows()} and \l{QAbstractItemModel::}{endRemoveRows()} are called to ensure all connected views are aware of the changes. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 5 + \snippet itemviews/addressbook/tablemodel.cpp 5 The \c setData() function is the function that inserts data into the table, item by item and not row by row. This means that to @@ -152,12 +152,12 @@ \l{QAbstractItemModel::}{dataChanged()} signal as it tells all connected views to update their displays. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 6 + \snippet itemviews/addressbook/tablemodel.cpp 6 The \c flags() function returns the item flags for the given index. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 7 + \snippet itemviews/addressbook/tablemodel.cpp 7 We set the Qt::ItemIsEditable flag because we want to allow the \c TableModel to be edited. Although for this example we don't @@ -171,7 +171,7 @@ the contacts to a file and read them back. Further explanation is given with \c AddressWidget. - \snippet widgets/itemviews/addressbook/tablemodel.cpp 8 + \snippet itemviews/addressbook/tablemodel.cpp 8 \section1 AddressWidget Class Definition @@ -181,7 +181,7 @@ and remove contacts, to save the contacts to a file and to load them from a file. - \snippet widgets/itemviews/addressbook/addresswidget.h 0 + \snippet itemviews/addressbook/addresswidget.h 0 \c AddressWidget extends QTabWidget in order to hold 10 tabs (\c NewAddressTab and the 9 alphabet group tabs) and also @@ -198,7 +198,7 @@ used to indicate that the address book is empty, is added and the rest of the 9 tabs are set up with \c setupTabs(). - \snippet widgets/itemviews/addressbook/addresswidget.cpp 0 + \snippet itemviews/addressbook/addresswidget.cpp 0 The \c setupTabs() function is used to set up the 9 alphabet group tabs, table views and proxy models in @@ -217,7 +217,7 @@ is automatically given a QItemSelectionModel that keeps track of the selected indexes. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 1 + \snippet itemviews/addressbook/addresswidget.cpp 1 The QItemSelectionModel class provides a \l{QItemSelectionModel::selectionChanged()}{selectionChanged} @@ -245,14 +245,14 @@ \c AddDialog object and then calls the second \c addEntry() function to actually add the contact to \c table. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 2 + \snippet itemviews/addressbook/addresswidget.cpp 2 Basic validation is done in the second \c addEntry() function to prevent duplicate entries in the address book. As mentioned with \c TableModel, this is part of the reason why we require the getter method \c getList(). - \snippet widgets/itemviews/addressbook/addresswidget.cpp 3 + \snippet itemviews/addressbook/addresswidget.cpp 3 If the model does not already contain an entry with the same name, we call \c setData() to insert the name and address into the @@ -271,14 +271,14 @@ \c selectionModel from the \c tableView to obtain the selected indexes. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 4a + \snippet itemviews/addressbook/addresswidget.cpp 4a Next we extract data from the row the user intends to edit. This data is displayed in an instance of \c AddDialog with a different window title. The \c table is only updated if changes have been made to data in \c aDialog. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 4b + \snippet itemviews/addressbook/addresswidget.cpp 4b \image addressbook-editdialog.png Screenshot of Dialog to Edit a Contact @@ -288,7 +288,7 @@ \c newAddressTab is re-added to the \c AddressWidget only if the user removes all the contacts in the address book. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 5 + \snippet itemviews/addressbook/addresswidget.cpp 5 The \c writeToFile() function is used to save a file containing all the contacts in the address book. The file is saved in a @@ -296,7 +296,7 @@ are written to \c file using QDataStream. If the file cannot be opened, a QMessageBox is displayed with the related error message. - \snippet widgets/itemviews/addressbook/addresswidget.cpp 6 + \snippet itemviews/addressbook/addresswidget.cpp 6 The \c readFromFile() function loads a file containing all the contacts in the address book, previously saved using @@ -304,7 +304,7 @@ \c{.dat} file into a list of pairs and each of these is added using \c addEntry(). - \snippet widgets/itemviews/addressbook/addresswidget.cpp 7 + \snippet itemviews/addressbook/addresswidget.cpp 7 \section1 NewAddressTab Class Definition @@ -319,7 +319,7 @@ The \c NewAddressTab class extends QWidget and contains a QLabel and QPushButton. - \snippet widgets/itemviews/addressbook/newaddresstab.h 0 + \snippet itemviews/addressbook/newaddresstab.h 0 \section1 NewAddressTab Class Implementation @@ -328,7 +328,7 @@ \c descriptionLabel and connects the \c{addButton}'s signal to the \c{addEntry()} slot. - \snippet widgets/itemviews/addressbook/newaddresstab.cpp 0 + \snippet itemviews/addressbook/newaddresstab.cpp 0 The \c addEntry() function is similar to \c AddressWidget's \c addEntry() in the sense that both functions instantiate an @@ -336,7 +336,7 @@ to \c AddressWidget's \c addEntry() slot by emitting the \c sendDetails() signal. - \snippet widgets/itemviews/addressbook/newaddresstab.cpp 1 + \snippet itemviews/addressbook/newaddresstab.cpp 1 \image signals-n-slots-aw-nat.png @@ -347,7 +347,7 @@ with a QLineEdit and a QTextEdit to input data into the address book. - \snippet widgets/itemviews/addressbook/adddialog.h 0 + \snippet itemviews/addressbook/adddialog.h 0 \image addressbook-adddialog.png @@ -357,7 +357,7 @@ The \c AddDialog's constructor sets up the user interface, creating the necessary widgets and placing them into layouts. - \snippet widgets/itemviews/addressbook/adddialog.cpp 0 + \snippet itemviews/addressbook/adddialog.cpp 0 To give the dialog the desired behavior, we connect the \uicontrol OK and \uicontrol Cancel buttons to the dialog's \l{QDialog::}{accept()} and @@ -376,7 +376,7 @@ \li \inlineimage addressbook-toolsmenu.png \endtable - \snippet widgets/itemviews/addressbook/mainwindow.h 0 + \snippet itemviews/addressbook/mainwindow.h 0 The \c MainWindow class uses an \c AddressWidget as its central widget and provides the File menu with \uicontrol Open, \uicontrol Close and @@ -391,7 +391,7 @@ sets it as its central widget and calls the \c createMenus() function. - \snippet widgets/itemviews/addressbook/mainwindow.cpp 0 + \snippet itemviews/addressbook/mainwindow.cpp 0 The \c createMenus() function sets up the \uicontrol File and \uicontrol Tools menus, connecting the actions to their respective slots. @@ -400,10 +400,10 @@ address book. They are only enabled when one or more contacts are added. - \snippet widgets/itemviews/addressbook/mainwindow.cpp 1a + \snippet itemviews/addressbook/mainwindow.cpp 1a \dots \codeline - \snippet widgets/itemviews/addressbook/mainwindow.cpp 1b + \snippet itemviews/addressbook/mainwindow.cpp 1b Apart from connecting all the actions' signals to their respective slots, we also connect \c AddressWidget's @@ -415,13 +415,13 @@ contacts. This function is a slot connected to \c openAct in the \uicontrol File menu. - \snippet widgets/itemviews/addressbook/mainwindow.cpp 2 + \snippet itemviews/addressbook/mainwindow.cpp 2 The \c saveFile() function allows the user to save a file with the \l{QFileDialog::getSaveFileName()}{save file dialog}. This function is a slot connected to \c saveAct in the \uicontrol File menu. - \snippet widgets/itemviews/addressbook/mainwindow.cpp 3 + \snippet itemviews/addressbook/mainwindow.cpp 3 The \c updateActions() function enables and disables \uicontrol{Edit Entry...} and \uicontrol{Remove Entry} depending on the contents of @@ -430,7 +430,7 @@ is connected to the \c AddressWidget's \c selectionChanged() signal. - \snippet widgets/itemviews/addressbook/mainwindow.cpp 4 + \snippet itemviews/addressbook/mainwindow.cpp 4 \section1 main() Function @@ -438,5 +438,5 @@ The main function for the address book instantiates QApplication and opens a \c MainWindow before running the event loop. - \snippet widgets/itemviews/addressbook/main.cpp 0 + \snippet itemviews/addressbook/main.cpp 0 */ diff --git a/examples/widgets/doc/affine.qdoc b/examples/widgets/doc/affine.qdoc index e6ef8c12f5..c69794d511 100644 --- a/examples/widgets/doc/affine.qdoc +++ b/examples/widgets/doc/affine.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/affine + \example painting/affine \title Affine Transformations In this example we show Qt's ability to perform affine transformations diff --git a/examples/widgets/doc/animatedtiles.qdoc b/examples/widgets/doc/animatedtiles.qdoc index da800ae7e5..4fe25388cf 100644 --- a/examples/widgets/doc/animatedtiles.qdoc +++ b/examples/widgets/doc/animatedtiles.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/animatedtiles + \example animation/animatedtiles \title Animated Tiles Example The Animated Tiles example animates items in a graphics scene. diff --git a/examples/widgets/doc/appchooser.qdoc b/examples/widgets/doc/appchooser.qdoc index ba9ca9a111..092db7c29e 100644 --- a/examples/widgets/doc/appchooser.qdoc +++ b/examples/widgets/doc/appchooser.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/appchooser + \example animation/appchooser \title Application Chooser Example The Application Chooser example shows how to use the Qt state diff --git a/examples/widgets/doc/application.qdoc b/examples/widgets/doc/application.qdoc index 9ad89e0a9a..5465f99e99 100644 --- a/examples/widgets/doc/application.qdoc +++ b/examples/widgets/doc/application.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/application + \example mainwindows/application \title Application Example The Application example shows how to implement a standard GUI @@ -59,7 +59,7 @@ Here's the class definition: - \snippet widgets/mainwindows/application/mainwindow.h 0 + \snippet mainwindows/application/mainwindow.h 0 The public API is restricted to the constructor. In the \c protected section, we reimplement QWidget::closeEvent() to detect @@ -72,7 +72,7 @@ \section1 MainWindow Class Implementation - \snippet widgets/mainwindows/application/mainwindow.cpp 0 + \snippet mainwindows/application/mainwindow.cpp 0 We start by including \c , a header file that contains the definition of all classes in the \l QtCore and \l QtGui @@ -86,8 +86,8 @@ generally a good idea to include only the header files that are strictly necessary from another header file. - \snippet widgets/mainwindows/application/mainwindow.cpp 1 - \snippet widgets/mainwindows/application/mainwindow.cpp 2 + \snippet mainwindows/application/mainwindow.cpp 1 + \snippet mainwindows/application/mainwindow.cpp 2 In the constructor, we start by creating a QPlainTextEdit widget as a child of the main window (the \c this object). Then we call @@ -109,8 +109,8 @@ \c setCurrentFile() function. We'll come back to this later. \target close event handler - \snippet widgets/mainwindows/application/mainwindow.cpp 3 - \snippet widgets/mainwindows/application/mainwindow.cpp 4 + \snippet mainwindows/application/mainwindow.cpp 3 + \snippet mainwindows/application/mainwindow.cpp 4 When the user attempts to close the window, we call the private function \c maybeSave() to give the user the possibility to save @@ -121,8 +121,8 @@ that the application will stay up and running as if nothing happened. - \snippet widgets/mainwindows/application/mainwindow.cpp 5 - \snippet widgets/mainwindows/application/mainwindow.cpp 6 + \snippet mainwindows/application/mainwindow.cpp 5 + \snippet mainwindows/application/mainwindow.cpp 6 The \c newFile() slot is invoked when the user selects \uicontrol{File|New} from the menu. We call \c maybeSave() to save any @@ -131,8 +131,8 @@ update the window title and clear the \l{QWidget::windowModified}{windowModified} flag. - \snippet widgets/mainwindows/application/mainwindow.cpp 7 - \snippet widgets/mainwindows/application/mainwindow.cpp 8 + \snippet mainwindows/application/mainwindow.cpp 7 + \snippet mainwindows/application/mainwindow.cpp 8 The \c open() slot is invoked when the user clicks \uicontrol{File|Open}. We pop up a QFileDialog asking the user to @@ -140,23 +140,23 @@ not an empty string), we call the private function \c loadFile() to actually load the file. - \snippet widgets/mainwindows/application/mainwindow.cpp 9 - \snippet widgets/mainwindows/application/mainwindow.cpp 10 + \snippet mainwindows/application/mainwindow.cpp 9 + \snippet mainwindows/application/mainwindow.cpp 10 The \c save() slot is invoked when the user clicks \uicontrol{File|Save}. If the user hasn't provided a name for the file yet, we call \c saveAs(); otherwise, we call the private function \c saveFile() to actually save the file. - \snippet widgets/mainwindows/application/mainwindow.cpp 11 - \snippet widgets/mainwindows/application/mainwindow.cpp 12 + \snippet mainwindows/application/mainwindow.cpp 11 + \snippet mainwindows/application/mainwindow.cpp 12 In \c saveAs(), we start by popping up a QFileDialog asking the user to provide a name. If the user clicks \uicontrol{Cancel}, the returned file name is empty, and we do nothing. - \snippet widgets/mainwindows/application/mainwindow.cpp 13 - \snippet widgets/mainwindows/application/mainwindow.cpp 14 + \snippet mainwindows/application/mainwindow.cpp 13 + \snippet mainwindows/application/mainwindow.cpp 14 The application's About box is done using one statement, using the QMessageBox::about() static function and relying on its @@ -169,18 +169,18 @@ The \l{Internationalization with Qt} overview covers \l{QObject::tr()}{tr()} in more detail. - \snippet widgets/mainwindows/application/mainwindow.cpp 15 - \snippet widgets/mainwindows/application/mainwindow.cpp 16 + \snippet mainwindows/application/mainwindow.cpp 15 + \snippet mainwindows/application/mainwindow.cpp 16 The \c documentWasModified() slot is invoked each time the text in the QPlainTextEdit changes because of user edits. We call QWidget::setWindowModified() to make the title bar show that the file was modified. How this is done varies on each platform. - \snippet widgets/mainwindows/application/mainwindow.cpp 17 - \snippet widgets/mainwindows/application/mainwindow.cpp 18 + \snippet mainwindows/application/mainwindow.cpp 17 + \snippet mainwindows/application/mainwindow.cpp 18 \dots - \snippet widgets/mainwindows/application/mainwindow.cpp 22 + \snippet mainwindows/application/mainwindow.cpp 22 The \c createActions() private function, which is called from the \c MainWindow constructor, creates \l{QAction}s. The code is very @@ -209,8 +209,8 @@ to this when we review the \c application.qrc file that's part of the project. - \snippet widgets/mainwindows/application/mainwindow.cpp 23 - \snippet widgets/mainwindows/application/mainwindow.cpp 24 + \snippet mainwindows/application/mainwindow.cpp 23 + \snippet mainwindows/application/mainwindow.cpp 24 The \uicontrol{Edit|Cut} and \uicontrol{Edit|Copy} actions must be available only when the QPlainTextEdit contains selected text. We disable them @@ -218,8 +218,8 @@ the QAction::setEnabled() slot, ensuring that the actions are disabled when the text editor has no selection. - \snippet widgets/mainwindows/application/mainwindow.cpp 25 - \snippet widgets/mainwindows/application/mainwindow.cpp 27 + \snippet mainwindows/application/mainwindow.cpp 25 + \snippet mainwindows/application/mainwindow.cpp 27 Creating actions isn't sufficient to make them available to the user; we must also add them to the menu system. This is what \c @@ -244,21 +244,21 @@ Let's now review the toolbars: - \snippet widgets/mainwindows/application/mainwindow.cpp 30 + \snippet mainwindows/application/mainwindow.cpp 30 Creating toolbars is very similar to creating menus. The same actions that we put in the menus can be reused in the toolbars. - \snippet widgets/mainwindows/application/mainwindow.cpp 32 - \snippet widgets/mainwindows/application/mainwindow.cpp 33 + \snippet mainwindows/application/mainwindow.cpp 32 + \snippet mainwindows/application/mainwindow.cpp 33 QMainWindow::statusBar() returns a pointer to the main window's QStatusBar widget. Like with \l{QMainWindow::menuBar()}, the widget is automatically created the first time the function is called. - \snippet widgets/mainwindows/application/mainwindow.cpp 34 - \snippet widgets/mainwindows/application/mainwindow.cpp 36 + \snippet mainwindows/application/mainwindow.cpp 34 + \snippet mainwindows/application/mainwindow.cpp 36 The \c readSettings() function is called from the constructor to load the user's preferences and other application settings. The @@ -281,16 +281,16 @@ to call QWidget::resize() before QWidget::move(). The reason why is given in the \l{Window Geometry} overview. - \snippet widgets/mainwindows/application/mainwindow.cpp 37 - \snippet widgets/mainwindows/application/mainwindow.cpp 39 + \snippet mainwindows/application/mainwindow.cpp 37 + \snippet mainwindows/application/mainwindow.cpp 39 The \c writeSettings() function is called from \c closeEvent(). Writing settings is similar to reading them, except simpler. The arguments to the QSettings constructor must be the same as in \c readSettings(). - \snippet widgets/mainwindows/application/mainwindow.cpp 40 - \snippet widgets/mainwindows/application/mainwindow.cpp 41 + \snippet mainwindows/application/mainwindow.cpp 40 + \snippet mainwindows/application/mainwindow.cpp 41 The \c maybeSave() function is called to save pending changes. If there are pending changes, it pops up a QMessageBox giving the @@ -307,8 +307,8 @@ return value and stop whatever it was doing if the return value is \c false. - \snippet widgets/mainwindows/application/mainwindow.cpp 42 - \snippet widgets/mainwindows/application/mainwindow.cpp 43 + \snippet mainwindows/application/mainwindow.cpp 42 + \snippet mainwindows/application/mainwindow.cpp 43 In \c loadFile(), we use QFile and QTextStream to read in the data. The QFile object provides access to the bytes stored in a @@ -335,15 +335,15 @@ which we'll cover in a moment, and we display the string "File loaded" in the status bar for 2 seconds (2000 milliseconds). - \snippet widgets/mainwindows/application/mainwindow.cpp 44 - \snippet widgets/mainwindows/application/mainwindow.cpp 45 + \snippet mainwindows/application/mainwindow.cpp 44 + \snippet mainwindows/application/mainwindow.cpp 45 Saving a file is very similar to loading one. Here, the QFile::Text flag ensures that on Windows, "\\n" is converted into "\\r\\n" to conform to the Windows convension. - \snippet widgets/mainwindows/application/mainwindow.cpp 46 - \snippet widgets/mainwindows/application/mainwindow.cpp 47 + \snippet mainwindows/application/mainwindow.cpp 46 + \snippet mainwindows/application/mainwindow.cpp 47 The \c setCurrentFile() function is called to reset the state of a few variables when a file is loaded or saved, or when the user @@ -357,15 +357,15 @@ QWidget::setWindowTitle() call shortens the file name to exclude the path. Here's the function: - \snippet widgets/mainwindows/application/mainwindow.cpp 48 - \snippet widgets/mainwindows/application/mainwindow.cpp 49 + \snippet mainwindows/application/mainwindow.cpp 48 + \snippet mainwindows/application/mainwindow.cpp 49 \section1 The main() Function The \c main() function for this application is typical of applications that contain one main window: - \snippet widgets/mainwindows/application/main.cpp 0 + \snippet mainwindows/application/main.cpp 0 \section1 The Resource File @@ -379,7 +379,7 @@ disk. Here's the \c application.qrc file that's used by the Application example: - \quotefile widgets/mainwindows/application/application.qrc + \quotefile mainwindows/application/application.qrc The \c .png files listed in the \c application.qrc file are files that are part of the Application example's source tree. Paths are @@ -389,7 +389,7 @@ The resource file must be mentioned in the \c application.pro file so that \c qmake knows about it: - \snippet widgets/mainwindows/application/application.pro 0 + \snippet mainwindows/application/application.pro 0 \c qmake will produce make rules to generate a file called \c qrc_application.cpp that is linked into the application. This diff --git a/examples/widgets/doc/basicdrawing.qdoc b/examples/widgets/doc/basicdrawing.qdoc index 9e7e7ae65e..899aa361f8 100644 --- a/examples/widgets/doc/basicdrawing.qdoc +++ b/examples/widgets/doc/basicdrawing.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/basicdrawing + \example painting/basicdrawing \title Basic Drawing Example The Basic Drawing example shows how to display basic graphics @@ -68,7 +68,7 @@ window displaying a \c RenderArea widget in addition to several parameter widgets. - \snippet widgets/painting/basicdrawing/window.h 0 + \snippet painting/basicdrawing/window.h 0 We declare the various widgets, and three private slots updating the \c RenderArea widget: The \c shapeChanged() slot updates the @@ -83,14 +83,14 @@ In the constructor we create and initialize the various widgets appearing in the main application window. - \snippet widgets/painting/basicdrawing/window.cpp 1 + \snippet painting/basicdrawing/window.cpp 1 First we create the \c RenderArea widget that will render the currently active shape. Then we create the \uicontrol Shape combobox, and add the associated items (i.e. the different shapes a QPainter can draw). - \snippet widgets/painting/basicdrawing/window.cpp 2 + \snippet painting/basicdrawing/window.cpp 2 QPainter's pen is a QPen object; the QPen class defines how a painter should draw lines and outlines of shapes. A pen has @@ -103,7 +103,7 @@ We create a QSpinBox for the \uicontrol {Pen Width} parameter. - \snippet widgets/painting/basicdrawing/window.cpp 3 + \snippet painting/basicdrawing/window.cpp 3 The pen style defines the line type. The default style is solid (Qt::SolidLine). Setting the style to none (Qt::NoPen) tells the @@ -117,7 +117,7 @@ items (i.e the values of the Qt::PenStyle, Qt::PenCapStyle and Qt::PenJoinStyle enums respectively). - \snippet widgets/painting/basicdrawing/window.cpp 4 + \snippet painting/basicdrawing/window.cpp 4 The QBrush class defines the fill pattern of shapes drawn by a QPainter. The default brush style is Qt::NoBrush. This style tells @@ -127,8 +127,8 @@ We create a QComboBox for the \uicontrol {Brush Style} parameter, and add the associated items (i.e. the values of the Qt::BrushStyle enum). - \snippet widgets/painting/basicdrawing/window.cpp 5 - \snippet widgets/painting/basicdrawing/window.cpp 6 + \snippet painting/basicdrawing/window.cpp 5 + \snippet painting/basicdrawing/window.cpp 6 Antialiasing is a feature that "smoothes" the pixels to create more even and less jagged lines, and can be applied using @@ -138,7 +138,7 @@ We simply create a QCheckBox for the \uicontrol Antialiasing option. - \snippet widgets/painting/basicdrawing/window.cpp 7 + \snippet painting/basicdrawing/window.cpp 7 The \uicontrol Transformations option implies a manipulation of the coordinate system that will appear as if the rendered shape is @@ -148,21 +148,21 @@ QPainter::scale() functions to implement this feature represented in the main application window by a simple QCheckBox. - \snippet widgets/painting/basicdrawing/window.cpp 8 + \snippet painting/basicdrawing/window.cpp 8 Then we connect the parameter widgets with their associated slots using the static QObject::connect() function, ensuring that the \c RenderArea widget is updated whenever the user changes the shape, or any of the other parameters. - \snippet widgets/painting/basicdrawing/window.cpp 9 - \snippet widgets/painting/basicdrawing/window.cpp 10 + \snippet painting/basicdrawing/window.cpp 9 + \snippet painting/basicdrawing/window.cpp 10 Finally, we add the various widgets to a layout, and call the \c shapeChanged(), \c penChanged(), and \c brushChanged() slots to initialize the application. We also turn on antialiasing. - \snippet widgets/painting/basicdrawing/window.cpp 11 + \snippet painting/basicdrawing/window.cpp 11 The \c shapeChanged() slot is called whenever the user changes the currently active shape. @@ -185,7 +185,7 @@ add the following line of code to the beginning of the \c window.cpp file. - \snippet widgets/painting/basicdrawing/window.cpp 0 + \snippet painting/basicdrawing/window.cpp 0 The QComboBox::itemData() function returns the data as a QVariant, so we need to cast the data to \c RenderArea::Shape. If there is @@ -195,20 +195,20 @@ In the end we call the \c RenderArea::setShape() slot to update the \c RenderArea widget. - \snippet widgets/painting/basicdrawing/window.cpp 12 + \snippet painting/basicdrawing/window.cpp 12 We call the \c penChanged() slot whenever the user changes any of the pen parameters. Again we use the QComboBox::itemData() function to retrieve the parameters, and then we call the \c RenderArea::setPen() slot to update the \c RenderArea widget. - \snippet widgets/painting/basicdrawing/window.cpp 13 + \snippet painting/basicdrawing/window.cpp 13 The brushChanged() slot is called whenever the user changes the brush parameter which we retrieve using the QComboBox::itemData() function as before. - \snippet widgets/painting/basicdrawing/window.cpp 14 + \snippet painting/basicdrawing/window.cpp 14 If the brush parameter is a gradient fill, special actions are required. @@ -232,7 +232,7 @@ In the end we call \c RenderArea::setBrush() slot to update the \c RenderArea widget's brush with the QLinearGradient object. - \snippet widgets/painting/basicdrawing/window.cpp 15 + \snippet painting/basicdrawing/window.cpp 15 A similar pattern of actions, as the one used for QLinearGradient, is used in the cases of Qt::RadialGradientPattern and @@ -247,13 +247,13 @@ first argument specifies the center of the conical, and the second specifies the start angle of the interpolation. - \snippet widgets/painting/basicdrawing/window.cpp 16 + \snippet painting/basicdrawing/window.cpp 16 If the brush style is Qt::TexturePattern we create a QBrush from a QPixmap. Then we call \c RenderArea::setBrush() slot to update the \c RenderArea widget with the newly created brush. - \snippet widgets/painting/basicdrawing/window.cpp 17 + \snippet painting/basicdrawing/window.cpp 17 Otherwise we simply create a brush with the given style and a green color, and then call \c RenderArea::setBrush() slot to @@ -264,7 +264,7 @@ The \c RenderArea class inherits QWidget, and renders multiple copies of the currently active shape using a QPainter. - \snippet widgets/painting/basicdrawing/renderarea.h 0 + \snippet painting/basicdrawing/renderarea.h 0 First we define a public \c Shape enum to hold the different shapes that can be rendered by the widget (i.e the shapes that can @@ -287,7 +287,7 @@ In the constructor we initialize some of the widget's variables. - \snippet widgets/painting/basicdrawing/renderarea.cpp 0 + \snippet painting/basicdrawing/renderarea.cpp 0 We set its shape to be a \uicontrol Polygon, its antialiased property to be false and we load an image into the widget's pixmap @@ -296,7 +296,7 @@ will be used to render the background. QPalette::Base is typically white. - \snippet widgets/painting/basicdrawing/renderarea.cpp 2 + \snippet painting/basicdrawing/renderarea.cpp 2 The \c RenderArea inherits QWidget's \l {QWidget::sizeHint()}{sizeHint} property holding the recommended @@ -310,7 +310,7 @@ Our reimplementation of the function returns a QSize with a 400 pixels width and a 200 pixels height. - \snippet widgets/painting/basicdrawing/renderarea.cpp 1 + \snippet painting/basicdrawing/renderarea.cpp 1 \c RenderArea also inherits QWidget's \l{QWidget::minimumSizeHint()}{minimumSizeHint} property holding @@ -324,11 +324,11 @@ Our reimplementation of the function returns a QSize with a 100 pixels width and a 100 pixels height. - \snippet widgets/painting/basicdrawing/renderarea.cpp 3 + \snippet painting/basicdrawing/renderarea.cpp 3 \codeline - \snippet widgets/painting/basicdrawing/renderarea.cpp 4 + \snippet painting/basicdrawing/renderarea.cpp 4 \codeline - \snippet widgets/painting/basicdrawing/renderarea.cpp 5 + \snippet painting/basicdrawing/renderarea.cpp 5 The public \c setShape(), \c setPen() and \c setBrush() slots are called whenever we want to modify a \c RenderArea widget's shape, @@ -340,16 +340,16 @@ repaint; instead it schedules a paint event for processing when Qt returns to the main event loop. - \snippet widgets/painting/basicdrawing/renderarea.cpp 6 + \snippet painting/basicdrawing/renderarea.cpp 6 \codeline - \snippet widgets/painting/basicdrawing/renderarea.cpp 7 + \snippet painting/basicdrawing/renderarea.cpp 7 With the \c setAntialiased() and \c setTransformed() slots we change the state of the properties according to the slot parameter, and call the QWidget::update() slot to make the changes visible in the \c RenderArea widget. - \snippet widgets/painting/basicdrawing/renderarea.cpp 8 + \snippet painting/basicdrawing/renderarea.cpp 8 Then we reimplement the QWidget::paintEvent() function. The first thing we do is to create the graphical objects we will need to @@ -373,7 +373,7 @@ In addition we define a start angle and an arc length that we will use when drawing the \uicontrol Arc, \uicontrol Chord and \uicontrol Pie shapes. - \snippet widgets/painting/basicdrawing/renderarea.cpp 9 + \snippet painting/basicdrawing/renderarea.cpp 9 We create a QPainter for the \c RenderArea widget, and set the painters pen and brush according to the \c RenderArea's pen and @@ -382,7 +382,7 @@ indicates that the engine should antialias edges of primitives if possible. - \snippet widgets/painting/basicdrawing/renderarea.cpp 10 + \snippet painting/basicdrawing/renderarea.cpp 10 Finally, we render the multiple copies of the \c RenderArea's shape. The number of copies is depending on the size of the \c @@ -397,7 +397,7 @@ will be rendered on top of each other in the top left cormer of the \c RenderArea widget. - \snippet widgets/painting/basicdrawing/renderarea.cpp 11 + \snippet painting/basicdrawing/renderarea.cpp 11 If the \uicontrol Transformations parameter option is checked, we do an additional translation of the coordinate system before we rotate @@ -409,7 +409,7 @@ Now, when rendering the shape, it will appear as if it was rotated in three dimensions. - \snippet widgets/painting/basicdrawing/renderarea.cpp 12 + \snippet painting/basicdrawing/renderarea.cpp 12 Next, we identify the \c RenderArea's shape, and render it using the associated QPainter drawing function: @@ -437,7 +437,7 @@ lose the knowledge of this point unless we save the current painter state \e before we start the translating process. - \snippet widgets/painting/basicdrawing/renderarea.cpp 13 + \snippet painting/basicdrawing/renderarea.cpp 13 Then, when we are finished rendering a copy of the shape we can restore the original painter state, with its associated coordinate diff --git a/examples/widgets/doc/basicgraphicslayouts.qdoc b/examples/widgets/doc/basicgraphicslayouts.qdoc index d59484b276..9f52b3eafa 100644 --- a/examples/widgets/doc/basicgraphicslayouts.qdoc +++ b/examples/widgets/doc/basicgraphicslayouts.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/basicgraphicslayouts + \example graphicsview/basicgraphicslayouts \title Basic Graphics Layouts Example The Basic Graphics Layouts example shows how to use the layout classes @@ -40,7 +40,7 @@ The \c Window class is a subclass of QGraphicsWidget. It has a constructor with a QGraphicsWidget \a parent as its parameter. - \snippet widgets/graphicsview/basicgraphicslayouts/window.h 0 + \snippet graphicsview/basicgraphicslayouts/window.h 0 \section1 Window Class Implementation @@ -52,7 +52,7 @@ \c item with a \l{QGraphicsLinearLayout::setStretchFactor()} {stretchFactor}. - \snippet widgets/graphicsview/basicgraphicslayouts/window.cpp 0 + \snippet graphicsview/basicgraphicslayouts/window.cpp 0 We repeat the process: @@ -62,7 +62,7 @@ \li provide a stretch factor. \endlist - \snippet widgets/graphicsview/basicgraphicslayouts/window.cpp 1 + \snippet graphicsview/basicgraphicslayouts/window.cpp 1 We then add \c linear to \c windowLayout, nesting two QGraphicsLinearLayout objects. Apart from the QGraphicsLinearLayout, we @@ -73,7 +73,7 @@ the \l{QGraphicsGridLayout::}{addItem()} function as shown in the code snippet below: - \snippet widgets/graphicsview/basicgraphicslayouts/window.cpp 2 + \snippet graphicsview/basicgraphicslayouts/window.cpp 2 The first item we add to \c grid is placed in the top left cell, spanning four rows. The next two items are placed in the second column, @@ -94,7 +94,7 @@ add an item to a layout, it will be automatically reparented to the widget on which the layout is installed. - \snippet widgets/graphicsview/basicgraphicslayouts/window.cpp 3 + \snippet graphicsview/basicgraphicslayouts/window.cpp 3 Now that we have set up \c grid and added it to \c windowLayout, we install \c windowLayout onto the window object using @@ -112,7 +112,7 @@ {QGraphicsItem::boundingRect()}{boundingRect()} and {QGraphicsItem::paint()}{paint()}. - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.h 0 + \snippet graphicsview/basicgraphicslayouts/layoutitem.h 0 The \c LayoutItem class also has a private instance of QPixmap, \c m_pix. @@ -121,17 +121,17 @@ In \c{LayoutItem}'s constructor, \c m_pix is instantiated and the \c{block.png} image is loaded into it. - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 0 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 0 We use the Q_UNUSED() macro to prevent the compiler from generating warnings regarding unused parameters. - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 1 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 1 The idea behind the \c paint() function is to paint the background rect then paint a rect around the pixmap. - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 2 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 2 The reimplementation of \l{QGraphicsItem::}{boundingRect()} will set the top left corner at (0,0), and the size of it will be @@ -139,7 +139,7 @@ \l{QGraphicsLayoutItem::}{geometry()}. This is the area that we paint within. - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 3 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 3 The reimplementation of \l{QGraphicsLayoutItem::setGeometry()}{setGeometry()} @@ -148,7 +148,7 @@ \l{QGraphicsItem::prepareGeometryChange()}{prepareGeometryChange()}. Finally, we move the item according to \c geom.topLeft(). - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 4 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 4 Since we don't want the size of the item to be smaller than the pixmap, we @@ -159,6 +159,6 @@ The preferred size is the same as the minimum size hint, while we set maximum to be a large value - \snippet widgets/graphicsview/basicgraphicslayouts/layoutitem.cpp 5 + \snippet graphicsview/basicgraphicslayouts/layoutitem.cpp 5 */ diff --git a/examples/widgets/doc/basiclayouts.qdoc b/examples/widgets/doc/basiclayouts.qdoc index 4de4dc529d..a0f083ba58 100644 --- a/examples/widgets/doc/basiclayouts.qdoc +++ b/examples/widgets/doc/basiclayouts.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/layouts/basiclayouts + \example layouts/basiclayouts \title Basic Layouts Example The Basic Layouts example shows how to use the standard layout @@ -44,7 +44,7 @@ \section1 Dialog Class Definition - \snippet widgets/layouts/basiclayouts/dialog.h 0 + \snippet layouts/basiclayouts/dialog.h 0 The \c Dialog class inherits QDialog. It is a custom widget that displays its child widgets using the geometry managers: @@ -58,7 +58,7 @@ \section1 Dialog Class Implementation - \snippet widgets/layouts/basiclayouts/dialog.cpp 0 + \snippet layouts/basiclayouts/dialog.cpp 0 In the constructor, we first use the \c createMenu() function to create and populate a menu bar and the \c createHorizontalGroupBox() @@ -70,7 +70,7 @@ three labels and three input fields: a line edit, a combo box and a spin box. - \snippet widgets/layouts/basiclayouts/dialog.cpp 1 + \snippet layouts/basiclayouts/dialog.cpp 1 We also create a big text editor and a dialog button box. The QDialogButtonBox class is a widget that presents buttons in a @@ -84,7 +84,7 @@ it is automatically reparented to the widget the layout is installed on. - \snippet widgets/layouts/basiclayouts/dialog.cpp 2 + \snippet layouts/basiclayouts/dialog.cpp 2 The main layout is a QVBoxLayout object. QVBoxLayout is a convenience class for a box layout with vertical orientation. @@ -97,14 +97,14 @@ placed in a column. The corresponding convenience classes are QHBoxLayout and QVBoxLayout, respectively. - \snippet widgets/layouts/basiclayouts/dialog.cpp 3 + \snippet layouts/basiclayouts/dialog.cpp 3 When we call the QLayout::setMenuBar() function, the layout places the provided menu bar at the top of the parent widget, and outside the widget's \l {QWidget::contentsRect()}{content margins}. All child widgets are placed below the bottom edge of the menu bar. - \snippet widgets/layouts/basiclayouts/dialog.cpp 4 + \snippet layouts/basiclayouts/dialog.cpp 4 We use the QBoxLayout::addWidget() function to add the widgets to the end of layout. Each widget will get at least its minimum size @@ -113,25 +113,25 @@ and any excess space is shared according to these stretch factors. If not specified, a widget's stretch factor is 0. - \snippet widgets/layouts/basiclayouts/dialog.cpp 5 + \snippet layouts/basiclayouts/dialog.cpp 5 We install the main layout on the \c Dialog widget using the QWidget::setLayout() function, and all of the layout's widgets are automatically reparented to be children of the \c Dialog widget. - \snippet widgets/layouts/basiclayouts/dialog.cpp 6 + \snippet layouts/basiclayouts/dialog.cpp 6 In the private \c createMenu() function we create a menu bar, and add a pull-down \uicontrol File menu containing an \uicontrol Exit option. - \snippet widgets/layouts/basiclayouts/dialog.cpp 7 + \snippet layouts/basiclayouts/dialog.cpp 7 When we create the horizontal group box, we use a QHBoxLayout as the internal layout. We create the buttons we want to put in the group box, add them to the layout and install the layout on the group box. - \snippet widgets/layouts/basiclayouts/dialog.cpp 8 + \snippet layouts/basiclayouts/dialog.cpp 8 In the \c createGridGroupBox() function we use a QGridLayout which lays out widgets in a grid. It takes the space made available to @@ -139,7 +139,7 @@ into rows and columns, and puts each widget it manages into the correct cell. - \snippet widgets/layouts/basiclayouts/dialog.cpp 9 + \snippet layouts/basiclayouts/dialog.cpp 9 For each row in the grid we create a label and an associated line edit, and add them to the layout. The QGridLayout::addWidget() @@ -147,7 +147,7 @@ needs the row and column specifying the grid cell to put the widget in. - \snippet widgets/layouts/basiclayouts/dialog.cpp 10 + \snippet layouts/basiclayouts/dialog.cpp 10 QGridLayout::addWidget() can in addition take arguments specifying the number of rows and columns the cell will be @@ -160,7 +160,7 @@ could, for example, align a widget with the right edge by specifying the alignment to be Qt::AlignRight. - \snippet widgets/layouts/basiclayouts/dialog.cpp 11 + \snippet layouts/basiclayouts/dialog.cpp 11 Each column in a grid layout has a stretch factor. The stretch factor is set using QGridLayout::setColumnStretch() and determines @@ -178,7 +178,7 @@ stretch factor for rows, as well as a QGridLayout::setRowStretch() function. - \snippet widgets/layouts/basiclayouts/dialog.cpp 12 + \snippet layouts/basiclayouts/dialog.cpp 12 In the \c createFormGroupBox() function, we use a QFormLayout to neatly arrange objects into two columns - name and field. diff --git a/examples/widgets/doc/basicsortfiltermodel.qdoc b/examples/widgets/doc/basicsortfiltermodel.qdoc index dbf793894a..0ecf4a0629 100644 --- a/examples/widgets/doc/basicsortfiltermodel.qdoc +++ b/examples/widgets/doc/basicsortfiltermodel.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/basicsortfiltermodel + \example itemviews/basicsortfiltermodel \title Basic Sort/Filter Model Example The Basic Sort/Filter Model example illustrates how to use diff --git a/examples/widgets/doc/borderlayout.qdoc b/examples/widgets/doc/borderlayout.qdoc index b79f252c21..aaff2dda1d 100644 --- a/examples/widgets/doc/borderlayout.qdoc +++ b/examples/widgets/doc/borderlayout.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/layouts/borderlayout + \example layouts/borderlayout \title Border Layout Example The Border Layout example shows how to create a custom layout that arranges diff --git a/examples/widgets/doc/boxes.qdoc b/examples/widgets/doc/boxes.qdoc index 5da7fd2490..aa34a61bc3 100644 --- a/examples/widgets/doc/boxes.qdoc +++ b/examples/widgets/doc/boxes.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/boxes + \example graphicsview/boxes \title Boxes This demo shows Qt's ability to combine advanced OpenGL rendering with the diff --git a/examples/widgets/doc/calendar.qdoc b/examples/widgets/doc/calendar.qdoc index d1a6c06ebe..b7fa7c8617 100644 --- a/examples/widgets/doc/calendar.qdoc +++ b/examples/widgets/doc/calendar.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/richtext/calendar + \example richtext/calendar \title Calendar Example The Calendar example shows how to create rich text content and display it using @@ -52,7 +52,7 @@ allow the user to change the month and year shown. The font size used for the text can also be adjusted. - \snippet widgets/richtext/calendar/mainwindow.h 0 + \snippet richtext/calendar/mainwindow.h 0 The private \c insertCalendar() function performs most of the work, relying on the \c fontSize and \c selectedDate variables to write useful information to @@ -63,7 +63,7 @@ The \c MainWindow constructor sets up the user interface and initializes variables used to generate a calendar for each month. - \snippet widgets/richtext/calendar/mainwindow.cpp 0 + \snippet richtext/calendar/mainwindow.cpp 0 We begin by setting default values for the selected date that will be highlighted in the calendar and the font size to be used. Since we are using a QMainWindow @@ -74,7 +74,7 @@ spin box for the year. These widgets are configured to provide a reasonable range of values for the user to try: - \snippet widgets/richtext/calendar/mainwindow.cpp 1 + \snippet richtext/calendar/mainwindow.cpp 1 We use the \c selectedDate object to obtain the current month and year, and we set these in the combobox and spin box: @@ -82,7 +82,7 @@ The font size is displayed in a spin box which we restrict to a sensible range of values: - \snippet widgets/richtext/calendar/mainwindow.cpp 2 + \snippet richtext/calendar/mainwindow.cpp 2 We construct an editor and use the \c insertCalendar() function to create a calendar for it. Each calendar is displayed in the same text editor; in @@ -93,14 +93,14 @@ effect on the appearance of the calendar unless we make some signal-slot connections: - \snippet widgets/richtext/calendar/mainwindow.cpp 3 + \snippet richtext/calendar/mainwindow.cpp 3 The signals are connected to some simple slots in the \c MainWindow class which we will describe later. We create layouts to manage the widgets we constructed: - \snippet widgets/richtext/calendar/mainwindow.cpp 4 + \snippet richtext/calendar/mainwindow.cpp 4 Finally, the central widget is set for the window. @@ -109,7 +109,7 @@ and \c fontSize variables, to produce a suitable plan for the specified month and year. - \snippet widgets/richtext/calendar/mainwindow.cpp 5 + \snippet richtext/calendar/mainwindow.cpp 5 We begin by clearing the editor's rich text document, and obtain a text cursor from the editor that we will use to add content. We also create a @@ -120,7 +120,7 @@ page with equal space to the left and right of it. All of these properties are set in a QTextTableFormat object: - \snippet widgets/richtext/calendar/mainwindow.cpp 6 + \snippet richtext/calendar/mainwindow.cpp 6 Each cell in the table will be padded and spaced to make the text easier to read. @@ -129,14 +129,14 @@ percentage widths for each of them and set the constraints in the QTextTableFormat: - \snippet widgets/richtext/calendar/mainwindow.cpp 7 + \snippet richtext/calendar/mainwindow.cpp 7 The constraints used for the column widths are only useful if the table has an appropriate number of columns. With the format for the table defined, we construct a new table with one row and seven columns at the current cursor position: - \snippet widgets/richtext/calendar/mainwindow.cpp 8 + \snippet richtext/calendar/mainwindow.cpp 8 We only need one row to start with; more can be added as we need them. Using this approach means that we do not need to perform any date calculations @@ -146,14 +146,14 @@ the cursor is automatically moved inside the newly inserted object. This means that we can immediately start modifying the table from within: - \snippet widgets/richtext/calendar/mainwindow.cpp 9 + \snippet richtext/calendar/mainwindow.cpp 9 Since the table has an outer frame, we obtain the frame and its format so that we can customize it. After making the changes we want, we set the frame's format using the modified format object. We have given the table an outer border one pixel wide. - \snippet widgets/richtext/calendar/mainwindow.cpp 10 + \snippet richtext/calendar/mainwindow.cpp 10 In a similar way, we obtain the cursor's current character format and create customized formats based on it. @@ -163,7 +163,7 @@ insert text. The following loop inserts the days of the week into the table as bold text: - \snippet widgets/richtext/calendar/mainwindow.cpp 11 + \snippet richtext/calendar/mainwindow.cpp 11 For each day of the week, we obtain an existing table cell in the first row (row 0) using the table's \l{QTextTable::cellAt()}{cellAt()} function. Since @@ -176,7 +176,7 @@ purpose, and we use this cursor to insert text using the \c boldFormat character format that we created earlier: - \snippet widgets/richtext/calendar/mainwindow.cpp 12 + \snippet richtext/calendar/mainwindow.cpp 12 Inserting text into document objects usually follows the same pattern. Each object can provide a new cursor that corresponds to the first valid @@ -189,7 +189,7 @@ encountered, it is inserted with a special format (created earlier) that makes it stand out: - \snippet widgets/richtext/calendar/mainwindow.cpp 13 + \snippet richtext/calendar/mainwindow.cpp 13 We add a new row to the table at the end of each week only if the next week falls within the currently selected month. @@ -197,24 +197,24 @@ For each calendar that we create, we change the window title to reflect the currently selected month and year: - \snippet widgets/richtext/calendar/mainwindow.cpp 14 + \snippet richtext/calendar/mainwindow.cpp 14 The \c insertCalendar() function relies on up-to-date values for the month, year, and font size. These are set in the following slots: - \snippet widgets/richtext/calendar/mainwindow.cpp 15 + \snippet richtext/calendar/mainwindow.cpp 15 The \c setFontSize() function simply changes the private \c fontSize variable before updating the calendar. - \snippet widgets/richtext/calendar/mainwindow.cpp 16 + \snippet richtext/calendar/mainwindow.cpp 16 The \c setMonth slot is called when the QComboBox used to select the month is updated. The value supplied is the currently selected row in the combobox. We add 1 to this value to obtain a valid month number, and create a new QDate based on the existing one. The calendar is then updated to use this new date. - \snippet widgets/richtext/calendar/mainwindow.cpp 17 + \snippet richtext/calendar/mainwindow.cpp 17 The \c setYear() slot is called when the QDateTimeEdit used to select the year is updated. The value supplied is a QDate object; this makes diff --git a/examples/widgets/doc/chart.qdoc b/examples/widgets/doc/chart.qdoc index fe30327a57..44263d1027 100644 --- a/examples/widgets/doc/chart.qdoc +++ b/examples/widgets/doc/chart.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/chart + \example itemviews/chart \title Chart Example The Chart example shows how to create a custom view for the model/view framework. @@ -51,7 +51,7 @@ indexAt(). However, the view needs to maintain strict control over its look and feel, so we also provide implementations for a number of other functions: - \snippet widgets/itemviews/chart/pieview.h 0 + \snippet itemviews/chart/pieview.h 0 diff --git a/examples/widgets/doc/chip.qdoc b/examples/widgets/doc/chip.qdoc index b7bd0f0795..966c16900a 100644 --- a/examples/widgets/doc/chip.qdoc +++ b/examples/widgets/doc/chip.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/chip + \example graphicsview/chip \title 40000 Chips This demo shows how to visualize a huge scene with 40000 chip items diff --git a/examples/widgets/doc/classwizard.qdoc b/examples/widgets/doc/classwizard.qdoc index 4488617952..0c357b7286 100644 --- a/examples/widgets/doc/classwizard.qdoc +++ b/examples/widgets/doc/classwizard.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/classwizard + \example dialogs/classwizard \title Class Wizard Example The License Wizard example shows how to implement linear @@ -38,7 +38,7 @@ page 2 and so on until the last page. Some wizards are more complex in that they allow different traversal paths based on the information provided by the user. The - \l{widgets/dialogs/licensewizard}{License Wizard} example shows how to + \l{dialogs/licensewizard}{License Wizard} example shows how to create such wizards. The Class Wizard example consists of the following classes: @@ -82,14 +82,14 @@ Here's the \c ClassWizard definition: - \snippet widgets/dialogs/classwizard/classwizard.h 0 + \snippet dialogs/classwizard/classwizard.h 0 The class reimplements QDialog's \l{QDialog::}{accept()} slot. This slot is called when the user clicks \uicontrol{Finish}. Here's the constructor: - \snippet widgets/dialogs/classwizard/classwizard.cpp 1 + \snippet dialogs/classwizard/classwizard.cpp 1 We instantiate the five pages and insert them into the wizard using QWizard::addPage(). The order in which they are inserted @@ -102,11 +102,11 @@ dialog's background in \l{QWizard::}{MacStyle}. (See \l{Elements of a Wizard Page} for more information.) - \snippet widgets/dialogs/classwizard/classwizard.cpp 3 - \snippet widgets/dialogs/classwizard/classwizard.cpp 4 + \snippet dialogs/classwizard/classwizard.cpp 3 + \snippet dialogs/classwizard/classwizard.cpp 4 \dots - \snippet widgets/dialogs/classwizard/classwizard.cpp 5 - \snippet widgets/dialogs/classwizard/classwizard.cpp 6 + \snippet dialogs/classwizard/classwizard.cpp 5 + \snippet dialogs/classwizard/classwizard.cpp 6 If the user clicks \uicontrol Finish, we extract the information from the various pages using QWizard::field() and generate the files. @@ -121,9 +121,9 @@ classwizard.cpp, together with \c ClassWizard. We will start with the easiest page: - \snippet widgets/dialogs/classwizard/classwizard.h 1 + \snippet dialogs/classwizard/classwizard.h 1 \codeline - \snippet widgets/dialogs/classwizard/classwizard.cpp 7 + \snippet dialogs/classwizard/classwizard.cpp 7 A page inherits from QWizardPage. We set a \l{QWizardPage::}{title} and a @@ -139,13 +139,13 @@ The second page is defined and implemented as follows: - \snippet widgets/dialogs/classwizard/classwizard.h 2 + \snippet dialogs/classwizard/classwizard.h 2 \codeline - \snippet widgets/dialogs/classwizard/classwizard.cpp 9 + \snippet dialogs/classwizard/classwizard.cpp 9 \dots - \snippet widgets/dialogs/classwizard/classwizard.cpp 12 + \snippet dialogs/classwizard/classwizard.cpp 12 \dots - \snippet widgets/dialogs/classwizard/classwizard.cpp 13 + \snippet dialogs/classwizard/classwizard.cpp 13 First, we set the page's \l{QWizardPage::}{title}, \l{QWizardPage::}{subTitle}, and \l{QWizard::LogoPixmap}{logo @@ -165,13 +165,13 @@ The third page is defined and implemented as follows: - \snippet widgets/dialogs/classwizard/classwizard.h 3 + \snippet dialogs/classwizard/classwizard.h 3 \codeline - \snippet widgets/dialogs/classwizard/classwizard.cpp 14 + \snippet dialogs/classwizard/classwizard.cpp 14 \dots - \snippet widgets/dialogs/classwizard/classwizard.cpp 15 + \snippet dialogs/classwizard/classwizard.cpp 15 \codeline - \snippet widgets/dialogs/classwizard/classwizard.cpp 16 + \snippet dialogs/classwizard/classwizard.cpp 16 The code in the constructor is very similar to what we did for \c ClassInfoPage, so we skipped most of it. diff --git a/examples/widgets/doc/coloreditorfactory.qdoc b/examples/widgets/doc/coloreditorfactory.qdoc index 6cd97eec41..a2c02f8c1d 100644 --- a/examples/widgets/doc/coloreditorfactory.qdoc +++ b/examples/widgets/doc/coloreditorfactory.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/coloreditorfactory + \example itemviews/coloreditorfactory \title Color Editor Factory Example This example shows how to create an editor that can be used by @@ -66,7 +66,7 @@ We take a closer look at the constructor: - \snippet widgets/itemviews/coloreditorfactory/window.cpp 0 + \snippet itemviews/coloreditorfactory/window.cpp 0 The QStandardItemEditorCreator is a convenience class that inherits QItemEditorCreatorBase. Its constructor takes a template @@ -88,7 +88,7 @@ The ColorListEditor inherits QComboBox and lets the user select a QColor from its popup list. - \snippet widgets/itemviews/coloreditorfactory/colorlisteditor.h 0 + \snippet itemviews/coloreditorfactory/colorlisteditor.h 0 QItemDelegate manages the interaction between the editor and the model, i.e., it retrieves data to edit from the model and @@ -105,19 +105,19 @@ populateList(), which we will look at later. We move on to the \c color() function: - \snippet widgets/itemviews/coloreditorfactory/colorlisteditor.cpp 0 + \snippet itemviews/coloreditorfactory/colorlisteditor.cpp 0 We return the data that is selected in the combobox. The data is stored in the Qt::DecorationRole as the color is then also displayed in the popup list (as shown in the image above). - \snippet widgets/itemviews/coloreditorfactory/colorlisteditor.cpp 1 + \snippet itemviews/coloreditorfactory/colorlisteditor.cpp 1 The \c findData() function searches the items in the combobox and returns the index of the item that has \c color in the Qt::Decoration role. - \snippet widgets/itemviews/coloreditorfactory/colorlisteditor.cpp 2 + \snippet itemviews/coloreditorfactory/colorlisteditor.cpp 2 Qt knows some predefined colors by name. We simply loop through these to fill our editor with items. diff --git a/examples/widgets/doc/combowidgetmapper.qdoc b/examples/widgets/doc/combowidgetmapper.qdoc index f278a775ac..949014930d 100644 --- a/examples/widgets/doc/combowidgetmapper.qdoc +++ b/examples/widgets/doc/combowidgetmapper.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/combowidgetmapper + \example itemviews/combowidgetmapper \title Combo Widget Mapper Example The Combo Widget Mapper example shows how to use a custom delegate to @@ -51,7 +51,7 @@ The class provides a constructor, a slot to keep the buttons up to date, and a private function to set up the model: - \snippet widgets/itemviews/combowidgetmapper/window.h Window definition + \snippet itemviews/combowidgetmapper/window.h Window definition In addition to the QDataWidgetMapper object and the controls used to make up the user interface, we use a QStandardItemModel to hold our data and @@ -63,7 +63,7 @@ The constructor of the \c Window class can be explained in three parts. In the first part, we set up the widgets used for the user interface: - \snippet widgets/itemviews/combowidgetmapper/window.cpp Set up widgets + \snippet itemviews/combowidgetmapper/window.cpp Set up widgets Note that we set up the mapping the combo box in the same way as for other widgets, but that we apply its own model to it so that it will display @@ -73,7 +73,7 @@ Next, we set up the widget mapper, relating each input widget to a column in the model specified by the call to \l{QDataWidgetMapper::}{setModel()}: - \snippet widgets/itemviews/combowidgetmapper/window.cpp Set up the mapper + \snippet itemviews/combowidgetmapper/window.cpp Set up the mapper For the combo box, we pass an extra argument to tell the widget mapper which property to relate to values from the model. As a result, the user @@ -92,14 +92,14 @@ The rest of the constructor is very similar to that of the \l{Simple Widget Mapper Example}: - \snippet widgets/itemviews/combowidgetmapper/window.cpp Set up connections and layouts + \snippet itemviews/combowidgetmapper/window.cpp Set up connections and layouts The model is initialized in the window's \c{setupModel()} function. Here, we create a standard model with 5 rows and 3 columns. In each row, we insert a name, address, and a value that indicates the type of address. The address types are stored in a string list model. - \snippet widgets/itemviews/combowidgetmapper/window.cpp Set up the model + \snippet itemviews/combowidgetmapper/window.cpp Set up the model As we insert each row into the model, like a record in a database, we store values that correspond to items in \c typeModel for each person's @@ -113,7 +113,7 @@ We show the implementation of the \c{updateButtons()} slot for completeness: - \snippet widgets/itemviews/combowidgetmapper/window.cpp Slot for updating the buttons + \snippet itemviews/combowidgetmapper/window.cpp Slot for updating the buttons \omit \section1 Delegate Class Definition and Implementation @@ -121,7 +121,7 @@ The delegate we use to mediate interaction between the widget mapper and the input widgets is a small QItemDelegate subclass: - \snippet widgets/itemviews/combowidgetmapper/delegate.h Delegate class definition + \snippet itemviews/combowidgetmapper/delegate.h Delegate class definition This provides implementations of the two standard functions used to pass data between editor widgets and the model (see the \l{Delegate Classes} @@ -134,7 +134,7 @@ referred to by the model index supplied and processes it according to the presence of a \c currentIndex property in the editor widget: - \snippet widgets/itemviews/combowidgetmapper/delegate.cpp setEditorData implementation + \snippet itemviews/combowidgetmapper/delegate.cpp setEditorData implementation If, like QComboBox, the editor widget has this property, it is set using the value from the model. Since we are passing around QVariant values, @@ -149,7 +149,7 @@ process, taking the value stored in the widget's \c currentIndex property and storing it back in the model: - \snippet widgets/itemviews/combowidgetmapper/delegate.cpp setModelData implementation + \snippet itemviews/combowidgetmapper/delegate.cpp setModelData implementation \endomit \section1 Summary and Further Reading diff --git a/examples/widgets/doc/composition.qdoc b/examples/widgets/doc/composition.qdoc index 2db9e19d22..6aca01d255 100644 --- a/examples/widgets/doc/composition.qdoc +++ b/examples/widgets/doc/composition.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/composition + \example painting/composition \title Composition Modes This demo shows some of the more advanced composition modes supported by Qt. diff --git a/examples/widgets/doc/concentriccircles.qdoc b/examples/widgets/doc/concentriccircles.qdoc index aa93b7ece9..67bc125dbe 100644 --- a/examples/widgets/doc/concentriccircles.qdoc +++ b/examples/widgets/doc/concentriccircles.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/concentriccircles + \example painting/concentriccircles \title Concentric Circles Example The Concentric Circles example shows the improved rendering @@ -74,7 +74,7 @@ The CircleWidget class inherits QWidget, and is a custom widget which renders several animated concentric circles. - \snippet widgets/painting/concentriccircles/circlewidget.h 0 + \snippet painting/concentriccircles/circlewidget.h 0 We declare the \c floatBased and \c antialiased variables to hold whether an instance of the class should be rendered with integer @@ -97,7 +97,7 @@ In the constructor we make the widget's rendering integer based and aliased by default: - \snippet widgets/painting/concentriccircles/circlewidget.cpp 0 + \snippet painting/concentriccircles/circlewidget.cpp 0 We initialize the widget's \c frameNo variable, and set the widget's background color using the QWidget::setBackgroundColor() @@ -111,9 +111,9 @@ useful. The widget can also make use of extra space, so it should get as much space as possible. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 1 + \snippet painting/concentriccircles/circlewidget.cpp 1 \codeline - \snippet widgets/painting/concentriccircles/circlewidget.cpp 2 + \snippet painting/concentriccircles/circlewidget.cpp 2 The public \c setFloatBased() and \c setAntialiased() functions update the widget's rendering preferences, i.e. whether the widget @@ -124,9 +124,9 @@ QWidget::update() function, forcing a repaint of the widget with the new rendering preferences. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 3 + \snippet painting/concentriccircles/circlewidget.cpp 3 \codeline - \snippet widgets/painting/concentriccircles/circlewidget.cpp 4 + \snippet painting/concentriccircles/circlewidget.cpp 4 The default implementations of the QWidget::minimumSizeHint() and QWidget::sizeHint() functions return invalid sizes if there is no @@ -136,14 +136,14 @@ We reimplement the functions to give the widget minimum and preferred sizes which are reasonable within our application. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 5 + \snippet painting/concentriccircles/circlewidget.cpp 5 The nextAnimationFrame() slot simply increments the \c frameNo variable's value, and calls the QWidget::update() function which schedules a paint event for processing when Qt returns to the main event loop. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 6 + \snippet painting/concentriccircles/circlewidget.cpp 6 A paint event is a request to repaint all or part of the widget. The \c paintEvent() function is an event handler that can @@ -158,7 +158,7 @@ widget's cocentric circles. The translation ensures that the center of the circles will be equivalent to the widget's center. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 7 + \snippet painting/concentriccircles/circlewidget.cpp 7 When painting a circle, we use the number of "animation frames" to determine the alpha channel of the circle's color. The alpha @@ -166,7 +166,7 @@ fully transparent color, while 255 represents a fully opaque color. - \snippet widgets/painting/concentriccircles/circlewidget.cpp 8 + \snippet painting/concentriccircles/circlewidget.cpp 8 If the calculated alpha channel is fully transparent, we don't draw anything since that would be equivalent to drawing a white @@ -190,7 +190,7 @@ window rendering four \c {CircleWidget}s using different combinations of precision and aliasing. - \snippet widgets/painting/concentriccircles/window.h 0 + \snippet painting/concentriccircles/window.h 0 We declare the various components of the main window, i.e., the text labels and a double array that will hold reference to the four \c @@ -199,12 +199,12 @@ \section1 Window Class Implementation - \snippet widgets/painting/concentriccircles/window.cpp 0 + \snippet painting/concentriccircles/window.cpp 0 In the constructor, we first create the various labels and put them in a QGridLayout. - \snippet widgets/painting/concentriccircles/window.cpp 1 + \snippet painting/concentriccircles/window.cpp 1 Then we create a QTimer. The QTimer class is a high-level programming interface for timers, and provides repetitive and @@ -215,7 +215,7 @@ them to the layout), we connect the QTimer::timeout() signal to each of the widgets' \c nextAnimationFrame() slots. - \snippet widgets/painting/concentriccircles/window.cpp 2 + \snippet painting/concentriccircles/window.cpp 2 Before we set the layout and window title for our main window, we make the timer start with a timeout interval of 100 milliseconds, @@ -224,7 +224,7 @@ four \c {CircleWidget}s, every 100 millisecond which is the reason the circles appear as animated. - \snippet widgets/painting/concentriccircles/window.cpp 3 + \snippet painting/concentriccircles/window.cpp 3 The private \c createLabel() function is implemented to simlify the constructor. diff --git a/examples/widgets/doc/configdialog.qdoc b/examples/widgets/doc/configdialog.qdoc index d05b35b8c4..9acea72a3b 100644 --- a/examples/widgets/doc/configdialog.qdoc +++ b/examples/widgets/doc/configdialog.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/configdialog + \example dialogs/configdialog \title Config Dialog Example The Config Dialog examples shows how a configuration dialog can be created by diff --git a/examples/widgets/doc/customsortfiltermodel.qdoc b/examples/widgets/doc/customsortfiltermodel.qdoc index e153fc9428..4dce820f9c 100644 --- a/examples/widgets/doc/customsortfiltermodel.qdoc +++ b/examples/widgets/doc/customsortfiltermodel.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/customsortfiltermodel + \example itemviews/customsortfiltermodel \title Custom Sort/Filter Model Example The Custom Sort/Filter Model example illustrates how to subclass @@ -80,7 +80,7 @@ that our filter can recognize a valid range of dates, and to control the sorting behavior. - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h 0 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.h 0 We want to be able to filter our data by specifying a given period of time. For that reason, we implement the custom \c @@ -100,7 +100,7 @@ The \c MySortFilterProxyModel constructor is trivial, passing the parent parameter on to the base class constructor: - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 0 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 0 The most interesting parts of the \c MySortFilterProxyModel implementation are the reimplementations of @@ -110,7 +110,7 @@ functions. Let's first take a look at our customized \c lessThan() function. - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 4 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 4 We want to sort the senders by their email addresses. The \l {QSortFilterProxyModel::}{lessThan()} function is used as the < @@ -119,7 +119,7 @@ to be able to sort the senders by their email addresses we must first identify the address within the given string: - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 6 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 6 We use QRegExp to define a pattern for the addresses we are looking for. The QRegExp::indexIn() function attempts to find a match in @@ -132,7 +132,7 @@ subexpressions have indexes starting from 1 (excluding non-capturing parentheses). - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 3 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 3 The \l {QSortFilterProxyModel::filterAcceptsRow()}{filterAcceptsRow()} @@ -141,7 +141,7 @@ is accepted if either the subject or the sender contains the given regular expression, and the date is valid. - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 7 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 7 We use our custom \c dateInRange() function to determine if a date is valid. @@ -150,9 +150,9 @@ time, we also implement functions for getting and setting the minimum and maximum dates: - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 1 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 1 \codeline - \snippet widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 2 + \snippet itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 2 The get functions, \c filterMinimumDate() and \c filterMaximumDate(), are trivial and implemented as inline @@ -166,7 +166,7 @@ The \c CustomFilter class inherits QWidget, and provides this example's main application window: - \snippet widgets/itemviews/customsortfiltermodel/window.h 0 + \snippet itemviews/customsortfiltermodel/window.h 0 We implement two private slots, \c textFilterChanged() and \c dateFilterChanged(), to respond to the user changing the filter @@ -182,7 +182,7 @@ source model already exists and start by creating an instance of our custom proxy model: - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 0 + \snippet itemviews/customsortfiltermodel/window.cpp 0 We set the \l {QSortFilterProxyModel::dynamicSortFilter}{dynamicSortFilter} @@ -194,13 +194,13 @@ The main application window shows views of both the source model and the proxy model. The source view is quite simple: - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 1 + \snippet itemviews/customsortfiltermodel/window.cpp 1 The QTreeView class provides a default model/view implementation of a tree view; our view implements a tree representation of items in the application's source model. - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 2 + \snippet itemviews/customsortfiltermodel/window.cpp 2 The QTreeView class provides a default model/view implementation of a tree view; our view implements a tree representation of items @@ -211,14 +211,14 @@ controlling the various aspects of transforming the source model's data structure: - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 3 - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 4 + \snippet itemviews/customsortfiltermodel/window.cpp 3 + \snippet itemviews/customsortfiltermodel/window.cpp 4 Note that whenever the user changes one of the filtering options, we must explicitly reapply the filter. This is done by connecting the various editors to functions that update the proxy model. - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 5 + \snippet itemviews/customsortfiltermodel/window.cpp 5 The sorting will be handled by the view. All we have to do is to enable sorting for our proxy view by setting the @@ -226,7 +226,7 @@ default). Then we add all the filtering widgets and the proxy view to a layout that we install on a corresponding group box. - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 6 + \snippet itemviews/customsortfiltermodel/window.cpp 6 Finally, after putting our two group boxes into another layout that we install on our main application widget, we customize the @@ -236,7 +236,7 @@ function, calling the \c Window::setSourceModel() function to make the application use it: - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 7 + \snippet itemviews/customsortfiltermodel/window.cpp 7 The QSortFilterProxyModel::setSourceModel() function makes the proxy model process the data in the given model, in this case out @@ -245,7 +245,7 @@ model for the view to present. Note that the latter function will also create and set a new selection model. - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 8 + \snippet itemviews/customsortfiltermodel/window.cpp 8 The \c textFilterChanged() function is called whenever the user changes the filter pattern or the case sensitivity. @@ -261,7 +261,7 @@ {QSortFilterProxyModel::}{setFilterRegExp()} function also updates the model. - \snippet widgets/itemviews/customsortfiltermodel/window.cpp 9 + \snippet itemviews/customsortfiltermodel/window.cpp 9 The \c dateFilterChanged() function is called whenever the user modifies the range of valid dates. We retrieve the new dates from @@ -276,7 +276,7 @@ model by creating the model in the \c main () function. First we create the application, then we create the source model: - \snippet widgets/itemviews/customsortfiltermodel/main.cpp 0 + \snippet itemviews/customsortfiltermodel/main.cpp 0 The \c createMailModel() function is a convenience function provided to simplify the constructor. All it does is to create and diff --git a/examples/widgets/doc/deform.qdoc b/examples/widgets/doc/deform.qdoc index 2f224a4da3..8195f90ffa 100644 --- a/examples/widgets/doc/deform.qdoc +++ b/examples/widgets/doc/deform.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/deform + \example painting/deform \title Vector Deformation This example shows how to use advanced vector techniques to draw text diff --git a/examples/widgets/doc/diagramscene.qdoc b/examples/widgets/doc/diagramscene.qdoc index 81901afc05..b61a936d52 100644 --- a/examples/widgets/doc/diagramscene.qdoc +++ b/examples/widgets/doc/diagramscene.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/diagramscene + \example graphicsview/diagramscene \title Diagram Scene Example This example shows use of Qt's graphics framework. @@ -84,7 +84,7 @@ \section1 MainWindow Class Definition - \snippet widgets/graphicsview/diagramscene/mainwindow.h 0 + \snippet graphicsview/diagramscene/mainwindow.h 0 The \c MainWindow class creates and lays out the widgets in a QMainWindow. The class forwards input from the widgets to the @@ -101,7 +101,7 @@ We start with a look at the constructor: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 0 + \snippet graphicsview/diagramscene/mainwindow.cpp 0 In the constructor we call methods to create the widgets and layouts of the example before we create the diagram scene. @@ -120,7 +120,7 @@ high level of detail as it does not deal with graphics framework specific functionality. Here is its implementation: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 21 + \snippet graphicsview/diagramscene/mainwindow.cpp 21 This part of the function sets up the tabbed widget item that contains the flowchart shapes. An exclusive QButtonGroup always @@ -134,14 +134,14 @@ The buttons of the background tabbed widget item is set up in the same way, so we skip to the creation of the tool box: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 22 + \snippet graphicsview/diagramscene/mainwindow.cpp 22 We set the preferred size of the toolbox as its maximum. This way, more space is given to the graphics view. Here is the \c createActions() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 23 + \snippet graphicsview/diagramscene/mainwindow.cpp 23 We show an example of the creation of an action. The functionality the actions trigger is discussed in the slots we @@ -151,7 +151,7 @@ The is the \c createMenus() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 24 + \snippet graphicsview/diagramscene/mainwindow.cpp 24 We create the three menus' of the example. @@ -163,9 +163,9 @@ fillColorToolButton is created. This button lets the user select a color for the diagram items. - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 25 + \snippet graphicsview/diagramscene/mainwindow.cpp 25 \dots - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 26 + \snippet graphicsview/diagramscene/mainwindow.cpp 26 We set the menu of the tool button with \l{QToolButton::}{setMenu()}. We need the \c fillAction QAction @@ -178,11 +178,11 @@ createColorToolButtonIcon() we create the icon for the button. \dots - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 27 + \snippet graphicsview/diagramscene/mainwindow.cpp 27 Here is the \c createBackgroundCellWidget() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 28 + \snippet graphicsview/diagramscene/mainwindow.cpp 28 This function creates \l{QWidget}s containing a tool button and a label. The widgets created with this function are used for @@ -190,7 +190,7 @@ Here is the \c createCellWidget() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 29 + \snippet graphicsview/diagramscene/mainwindow.cpp 29 This function returns a QWidget containing a QToolButton with an image of one of the \c DiagramItems, i.e., flowchart shapes. @@ -203,7 +203,7 @@ Here is the \c createColorMenu() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 30 + \snippet graphicsview/diagramscene/mainwindow.cpp 30 This function creates a color menu that is used as the drop-down menu for the tool buttons in the \c colorToolBar. We @@ -212,7 +212,7 @@ Here is the \c createColorToolButtonIcon() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 31 + \snippet graphicsview/diagramscene/mainwindow.cpp 31 This function is used to create the QIcon of the \c fillColorToolButton, \c fontColorToolButton, and \c @@ -222,7 +222,7 @@ Here is the \c createColorIcon() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 32 + \snippet graphicsview/diagramscene/mainwindow.cpp 32 This function creates an icon with a filled rectangle in the color of \a color. It is used for creating icons for the color @@ -231,7 +231,7 @@ Here is the \c backgroundButtonGroupClicked() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 1 + \snippet graphicsview/diagramscene/mainwindow.cpp 1 In this function we set the QBrush that is used to draw the background of the diagramscene. The background can be a grid of @@ -245,7 +245,7 @@ Here is the implementation of \c buttonGroupClicked(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 2 + \snippet graphicsview/diagramscene/mainwindow.cpp 2 This slot is called when a button in \c buttonGroup is checked. When a button is checked the user can click on the graphics view @@ -263,7 +263,7 @@ Here is the implementation of \c deleteItem(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 3 + \snippet graphicsview/diagramscene/mainwindow.cpp 3 This slot deletes the selected item, if any, from the scene. It deletes the arrows first in order to avoid to delete them twice. If @@ -273,7 +273,7 @@ This is the implementation of pointerGroupClicked(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 4 + \snippet graphicsview/diagramscene/mainwindow.cpp 4 The \c pointerTypeGroup decides whether the scene is in ItemMove or InsertLine mode. This button group is exclusive, i.e., only @@ -284,7 +284,7 @@ Here is the \c bringToFront() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 5 + \snippet graphicsview/diagramscene/mainwindow.cpp 5 Several items may collide, i.e., overlap, with each other in the scene. This slot is called when the user requests that an @@ -299,7 +299,7 @@ Here is the \c sendToBack() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 6 + \snippet graphicsview/diagramscene/mainwindow.cpp 6 This slot works in the same way as \c bringToFront() described above, but sets a z-value that is lower than items the item that @@ -307,7 +307,7 @@ This is the implementation of \c itemInserted(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 7 + \snippet graphicsview/diagramscene/mainwindow.cpp 7 This slot is called from the \c DiagramScene when an item has been added to the scene. We set the mode of the scene back to the mode @@ -317,14 +317,14 @@ Here is the implementation of \c textInserted(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 8 + \snippet graphicsview/diagramscene/mainwindow.cpp 8 We simply set the mode of the scene back to the mode it had before the text was inserted. Here is the \c currentFontChanged() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 9 + \snippet graphicsview/diagramscene/mainwindow.cpp 9 When the user requests a font change, by using one of the widgets in the \c fontToolBar, we create a new QFont object and @@ -333,7 +333,7 @@ Here is the \c fontSizeChanged() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 10 + \snippet graphicsview/diagramscene/mainwindow.cpp 10 When the user requests a font change, by using one of the widgets in the \c fontToolBar, we create a new QFont object and @@ -342,7 +342,7 @@ Here is the implementation of \c sceneScaleChanged(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 11 + \snippet graphicsview/diagramscene/mainwindow.cpp 11 The user can increase or decrease the scale, with the \c sceneScaleCombo, the scene is drawn in. @@ -351,7 +351,7 @@ Here is the \c textColorChanged() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 12 + \snippet graphicsview/diagramscene/mainwindow.cpp 12 This slot is called when an item in the drop-down menu of the \c fontColorToolButton is pressed. We need to change the icon on @@ -362,7 +362,7 @@ Here is the \c itemColorChanged() implementation: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 13 + \snippet graphicsview/diagramscene/mainwindow.cpp 13 This slot handles requests for changing the color of \c DiagramItems in the same manner as \c textColorChanged() does for @@ -370,7 +370,7 @@ Here is the implementation of \c lineColorChanged(): - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 14 + \snippet graphicsview/diagramscene/mainwindow.cpp 14 This slot handles requests for changing the color of \c Arrows in the same manner that \c textColorChanged() does it for \c @@ -378,7 +378,7 @@ Here is the \c textButtonTriggered() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 15 + \snippet graphicsview/diagramscene/mainwindow.cpp 15 \c textAction points to the QAction of the currently selected menu item in the \c fontColorToolButton's color drop-down menu. We have set @@ -388,7 +388,7 @@ Here is the \c fillButtonTriggered() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 16 + \snippet graphicsview/diagramscene/mainwindow.cpp 16 \c fillAction points to the selected menu item in the drop-down menu of \c fillColorToolButton(). We can therefore use the data of @@ -396,7 +396,7 @@ Here is the \c lineButtonTriggered() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 17 + \snippet graphicsview/diagramscene/mainwindow.cpp 17 \c lineAction point to the selected item in the drop-down menu of \c lineColorToolButton. We use its data when we set the arrow @@ -404,7 +404,7 @@ Here is the \c handleFontChange() function: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 18 + \snippet graphicsview/diagramscene/mainwindow.cpp 18 \c handleFontChange() is called when any of the widgets that show font properties changes. We create a new QFont object and set its @@ -414,7 +414,7 @@ Here is the \c itemSelected() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 19 + \snippet graphicsview/diagramscene/mainwindow.cpp 19 This slot is called when an item in the \c DiagramScene is selected. In the case of this example it is only text items that @@ -426,7 +426,7 @@ This is the \c about() slot: - \snippet widgets/graphicsview/diagramscene/mainwindow.cpp 20 + \snippet graphicsview/diagramscene/mainwindow.cpp 20 This slot displays an about box for the example when the user selects the about menu item from the help menu. @@ -439,7 +439,7 @@ class. - \snippet widgets/graphicsview/diagramscene/diagramscene.h 0 + \snippet graphicsview/diagramscene/diagramscene.h 0 In the \c DiagramScene a mouse click can give three different actions: the item under the mouse can be moved, an item may be @@ -465,7 +465,7 @@ We start with the constructor: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 0 + \snippet graphicsview/diagramscene/diagramscene.cpp 0 The scene uses \c myItemMenu to set the context menu when it creates \c DiagramItems. We set the default mode to \c @@ -474,7 +474,7 @@ Here is the \c setLineColor() function: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 1 + \snippet graphicsview/diagramscene/diagramscene.cpp 1 The \c isItemChange function returns true if an \c Arrow item is selected in the scene in which case we want to change its color. @@ -483,14 +483,14 @@ Here is the \c setTextColor() function: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 2 + \snippet graphicsview/diagramscene/diagramscene.cpp 2 This function sets the color of \c DiagramTextItems equal to the way \c setLineColor() sets the color of \c Arrows. Here is the \c setItemColor() function: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 3 + \snippet graphicsview/diagramscene/diagramscene.cpp 3 This function sets the color the scene will use when creating \c DiagramItems. It also changes the color of a selected \c @@ -498,14 +498,14 @@ This is the implementation of \c setFont(): - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 4 + \snippet graphicsview/diagramscene/diagramscene.cpp 4 Set the font to use for new and selected, if a text item is selected, \c DiagramTextItems. This is the implementation of \c editorLostFocus() slot: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 5 + \snippet graphicsview/diagramscene/diagramscene.cpp 5 \c DiagramTextItems emit a signal when they loose focus, which is connected to this slot. We remove the item if it has no text. @@ -516,13 +516,13 @@ different depending on which mode the \c DiagramScene is in. We examine its implementation for each mode: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 6 + \snippet graphicsview/diagramscene/diagramscene.cpp 6 We simply create a new \c DiagramItem and add it to the scene at the position the mouse was pressed. Note that the origin of its local coordinate system will be under the mouse pointer position. - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 7 + \snippet graphicsview/diagramscene/diagramscene.cpp 7 The user adds \c Arrows to the scene by stretching a line between the items the arrow should connect. The start of the line is fixed @@ -533,7 +533,7 @@ We will see how this is implemented later; here we simply add the line. - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 8 + \snippet graphicsview/diagramscene/diagramscene.cpp 8 The \c DiagramTextItem is editable when the Qt::TextEditorInteraction flag is set, else it is movable by the @@ -541,7 +541,7 @@ items in the scene, so we set the value to a number higher than other items in the scene. - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 9 + \snippet graphicsview/diagramscene/diagramscene.cpp 9 We are in MoveItem mode if we get to the default switch; we can then call the QGraphicsScene implementation, which @@ -553,7 +553,7 @@ This is the \c mouseMoveEvent() function: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 10 + \snippet graphicsview/diagramscene/diagramscene.cpp 10 We must draw the line if we are in InsertMode and the mouse button is pressed down (the line is not 0). As discussed in \c @@ -566,14 +566,14 @@ In the \c mouseReleaseEvent() function we need to check if an arrow should be added to the scene: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 11 + \snippet graphicsview/diagramscene/diagramscene.cpp 11 First we need to get the items (if any) under the line's start and end points. The line itself is the first item at these points, so we remove it from the lists. As a precaution, we check if the lists are empty, but this should never happen. - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 12 + \snippet graphicsview/diagramscene/diagramscene.cpp 12 Now we check if there are two different \c DiagramItems under the lines start and end points. If there are we can create an \c @@ -582,11 +582,11 @@ and end points to the items. We set the z-value of the arrow to -1000.0 because we always want it to be drawn under the items. - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 13 + \snippet graphicsview/diagramscene/diagramscene.cpp 13 Here is the \c isItemChange() function: - \snippet widgets/graphicsview/diagramscene/diagramscene.cpp 14 + \snippet graphicsview/diagramscene/diagramscene.cpp 14 The scene has single selection, i.e., only one item can be selected at any given time. The foreach will then loop one time @@ -597,7 +597,7 @@ \section1 DiagramItem Class Definition - \snippet widgets/graphicsview/diagramscene/diagramitem.h 0 + \snippet graphicsview/diagramscene/diagramitem.h 0 The \c DiagramItem represents a flowchart shape in the \c DiagramScene. It inherits QGraphicsPolygonItem and has a polygon @@ -622,7 +622,7 @@ We start with a look at the constructor: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 0 + \snippet graphicsview/diagramscene/diagramitem.cpp 0 In the constructor we create the items polygon according to \a diagramType. \l{QGraphicsItem}s are not movable or selectable @@ -630,7 +630,7 @@ Here is the \c removeArrow() function: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 1 + \snippet graphicsview/diagramscene/diagramitem.cpp 1 \c removeArrow() is used to remove \c Arrow items when they or \c DiagramItems they are connected to are removed from the @@ -638,7 +638,7 @@ Here is the \c removeArrows() function: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 2 + \snippet graphicsview/diagramscene/diagramitem.cpp 2 This function is called when the item is removed from the scene and removes all arrows that are connected to this item. The arrow @@ -647,13 +647,13 @@ Here is the \c addArrow() function: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 3 + \snippet graphicsview/diagramscene/diagramitem.cpp 3 This function simply adds the \a arrow to the items \c arrows list. Here is the \c image() function: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 4 + \snippet graphicsview/diagramscene/diagramitem.cpp 4 This function draws the polygon of the item onto a QPixmap. In this example we use this to create icons for the tool buttons in @@ -661,7 +661,7 @@ Here is the \c contextMenuEvent() function: - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 5 + \snippet graphicsview/diagramscene/diagramitem.cpp 5 We show the context menu. As right mouse clicks, which shows the menu, don't select items by default we set the item selected with @@ -671,7 +671,7 @@ This is the implementation of \c itemChange(): - \snippet widgets/graphicsview/diagramscene/diagramitem.cpp 6 + \snippet graphicsview/diagramscene/diagramitem.cpp 6 If the item has moved, we need to update the positions of the arrows connected to it. The implementation of QGraphicsItem does @@ -686,7 +686,7 @@ DiagramTextItem the editing starts with a double click leaving single click available to interact with and move it. - \snippet widgets/graphicsview/diagramscene/diagramtextitem.h 0 + \snippet graphicsview/diagramscene/diagramtextitem.h 0 We use \c itemChange() and \c focusOutEvent() to notify the \c DiagramScene when the text item loses focus and gets selected. @@ -698,14 +698,14 @@ We start with the constructor: - \snippet widgets/graphicsview/diagramscene/diagramtextitem.cpp 0 + \snippet graphicsview/diagramscene/diagramtextitem.cpp 0 We simply set the item movable and selectable, as these flags are off by default. Here is the \c itemChange() function: - \snippet widgets/graphicsview/diagramscene/diagramtextitem.cpp 1 + \snippet graphicsview/diagramscene/diagramtextitem.cpp 1 When the item is selected we emit the selectedChanged signal. The \c MainWindow uses this signal to update the widgets that display @@ -713,7 +713,7 @@ Here is the \c focusOutEvent() function: - \snippet widgets/graphicsview/diagramscene/diagramtextitem.cpp 2 + \snippet graphicsview/diagramscene/diagramtextitem.cpp 2 \c DiagramScene uses the signal emitted when the text item looses focus to remove the item if it is empty, i.e., it contains no @@ -721,7 +721,7 @@ This is the implementation of \c mouseDoubleClickEvent(): - \snippet widgets/graphicsview/diagramscene/diagramtextitem.cpp 5 + \snippet graphicsview/diagramscene/diagramtextitem.cpp 5 When we receive a double click event, we make the item editable by calling QGraphicsTextItem::setTextInteractionFlags(). We then forward the @@ -736,7 +736,7 @@ selections. The class inherits QGraphicsLine item, and draws the arrowhead and moves with the items it connects. - \snippet widgets/graphicsview/diagramscene/arrow.h 0 + \snippet graphicsview/diagramscene/arrow.h 0 The item's color can be set with \c setColor(). @@ -757,14 +757,14 @@ The constructor of the \c Arrow class looks like this: - \snippet widgets/graphicsview/diagramscene/arrow.cpp 0 + \snippet graphicsview/diagramscene/arrow.cpp 0 We set the start and end diagram items of the arrow. The arrow head will be drawn where the line intersects the end item. Here is the \c boundingRect() function: - \snippet widgets/graphicsview/diagramscene/arrow.cpp 1 + \snippet graphicsview/diagramscene/arrow.cpp 1 We need to reimplement this function because the arrow is larger than the bounding rectangle of the QGraphicsLineItem. The @@ -773,7 +773,7 @@ Here is the \c shape() function: - \snippet widgets/graphicsview/diagramscene/arrow.cpp 2 + \snippet graphicsview/diagramscene/arrow.cpp 2 The shape function returns a QPainterPath that is the exact shape of the item. The QGraphicsLineItem::shape() returns a path @@ -783,14 +783,14 @@ Here is the \c updatePosition() slot: - \snippet widgets/graphicsview/diagramscene/arrow.cpp 3 + \snippet graphicsview/diagramscene/arrow.cpp 3 This slot updates the arrow by setting the start and end points of its line to the center of the items it connects. Here is the \c paint() function: - \snippet widgets/graphicsview/diagramscene/arrow.cpp 4 + \snippet graphicsview/diagramscene/arrow.cpp 4 If the start and end items collide we do not draw the arrow; the algorithm we use to find the point the arrow should be drawn at @@ -798,7 +798,7 @@ We first set the pen and brush we will use for drawing the arrow. - \snippet widgets/graphicsview/diagramscene/arrow.cpp 5 + \snippet graphicsview/diagramscene/arrow.cpp 5 We then need to find the position at which to draw the arrowhead. The head should be drawn where the line and the end @@ -811,7 +811,7 @@ We must therefore add the position of the end item to make the coordinates relative to the scene. - \snippet widgets/graphicsview/diagramscene/arrow.cpp 6 + \snippet graphicsview/diagramscene/arrow.cpp 6 We calculate the angle between the x-axis and the line of the arrow. We need to turn the arrow head to this angle so that it @@ -824,7 +824,7 @@ clear the \c arrowHead polygon from the previous calculated arrow head and set these new points. - \snippet widgets/graphicsview/diagramscene/arrow.cpp 7 + \snippet graphicsview/diagramscene/arrow.cpp 7 If the line is selected, we draw two dotted lines that are parallel with the line of the arrow. We do not use the default diff --git a/examples/widgets/doc/dirview.qdoc b/examples/widgets/doc/dirview.qdoc index ddd9b8a0ad..a4b799678a 100644 --- a/examples/widgets/doc/dirview.qdoc +++ b/examples/widgets/doc/dirview.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/dirview + \example itemviews/dirview \title Dir View Example The Dir View example shows a tree view onto the local filing system. It uses the diff --git a/examples/widgets/doc/dockwidgets.qdoc b/examples/widgets/doc/dockwidgets.qdoc index b4874caad0..12f18a538f 100644 --- a/examples/widgets/doc/dockwidgets.qdoc +++ b/examples/widgets/doc/dockwidgets.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/dockwidgets + \example mainwindows/dockwidgets \title Dock Widgets Example The Dock Widgets example shows how to add dock windows to an @@ -46,13 +46,13 @@ Here's the class definition: - \snippet widgets/mainwindows/dockwidgets/mainwindow.h 0 + \snippet mainwindows/dockwidgets/mainwindow.h 0 We will now review each function in turn. \section1 MainWindow Class Implementation - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 0 + \snippet mainwindows/dockwidgets/mainwindow.cpp 0 We start by including \c , a header file that contains the definition of all classes in the \l QtCore and \l QtGui @@ -60,7 +60,7 @@ every class individually and is especially convenient if we add new widgets. We also include \c mainwindow.h. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 1 + \snippet mainwindows/dockwidgets/mainwindow.cpp 1 In the constructor, we start by creating a QTextEdit widget. Then we call QMainWindow::setCentralWidget(). This function passes ownership of @@ -77,7 +77,7 @@ createToolBars(), and \c createStatusBar() functions since they follow the same pattern as all the other Qt examples. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 9 + \snippet mainwindows/dockwidgets/mainwindow.cpp 9 We create the customers dock window first, and in addition to a window title, we also pass it a \c this pointer so that it becomes a @@ -109,7 +109,7 @@ We briefly discuss the rest of the implementation, but have now covered everything relating to dock windows. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 2 + \snippet mainwindows/dockwidgets/mainwindow.cpp 2 In this function we clear the QTextEdit so that it is empty. Next we create a QTextCursor on the QTextEdit. We move the cursor to the @@ -120,7 +120,7 @@ insert the skeleton of the letter including two markers \c NAME and \c ADDRESS. We will also use the \c{Yours sincerely,} text as a marker. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 6 + \snippet mainwindows/dockwidgets/mainwindow.cpp 6 If the user clicks a customer we split the customer details into pieces. We then look for the \c NAME marker using the \c find() @@ -133,7 +133,7 @@ operation by the QTextEdit, so a single undo will revert all the insertions. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 7 + \snippet mainwindows/dockwidgets/mainwindow.cpp 7 This function works in a similar way to \c insertCustomer(). First we look for the marker, in this case, \c {Yours sincerely,}, and then @@ -141,19 +141,19 @@ we use a \c beginEditBlock() ... \c endEditBlock() pair so that the insertion can be undone as a single operation. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 3 + \snippet mainwindows/dockwidgets/mainwindow.cpp 3 Qt's QTextDocument class makes printing documents easy. We simply take the QTextEdit's QTextDocument, set up the printer and print the document. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 4 + \snippet mainwindows/dockwidgets/mainwindow.cpp 4 QTextEdit can output its contents in HTML format, so we prompt the user for the name of an HTML file and if they provide one we simply write the QTextEdit's contents in HTML format to the file. - \snippet widgets/mainwindows/dockwidgets/mainwindow.cpp 5 + \snippet mainwindows/dockwidgets/mainwindow.cpp 5 If the focus is in the QTextEdit, pressing \uicontrol Ctrl+Z undoes as expected. But for the user's convenience we provide an diff --git a/examples/widgets/doc/dragdroprobot.qdoc b/examples/widgets/doc/dragdroprobot.qdoc index 30ca8e6b0d..60bd4eb4d8 100644 --- a/examples/widgets/doc/dragdroprobot.qdoc +++ b/examples/widgets/doc/dragdroprobot.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/dragdroprobot + \example graphicsview/dragdroprobot \title Drag and Drop Robot Example The Drag and Drop Robot example shows how to implement Drag and Drop in a @@ -63,7 +63,7 @@ Let's start with the \c RobotPart class declaration. - \snippet widgets/graphicsview/dragdroprobot/robot.h 0 + \snippet graphicsview/dragdroprobot/robot.h 0 This base class inherits QGraphicsObject. QGraphicsObject provides signals and slots through inheriting QObject, and it also declares QGraphicsItem's @@ -80,7 +80,7 @@ variable, which we will use later to indicate visually that the limb can accept colors that are is dragged onto it. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 0 + \snippet graphicsview/dragdroprobot/robot.cpp 0 \c RobotPart's constructor initializes the dragOver member and sets the color to Qt::lightGray. In the constructor body we enable support for @@ -89,7 +89,7 @@ The rest of this class's implementation is to support Drag and Drop. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 1 + \snippet graphicsview/dragdroprobot/robot.cpp 1 The \l{QGraphicsItem::dragEnterEvent()}{dragEnterEvent()} handler is called when a Drag and Drop element is dragged into the robot part's area. @@ -102,7 +102,7 @@ visual feedback to the user; otherwise the event is ignored, which in turn allows the event to propagate to parent elements. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 2 + \snippet graphicsview/dragdroprobot/robot.cpp 2 The \l{QGraphicsItem::dragLeaveEvent()}{dragLeaveEvent()} handler is called when a Drag and Drop element is dragged away from the robot part's area. @@ -110,7 +110,7 @@ \l{QGraphicsItem::update()}{update()} to help provide visual feedback that the drag has left this item. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 3 + \snippet graphicsview/dragdroprobot/robot.cpp 3 The \l{QGraphicsItem::dropEvent()}{dropEvent()} handler is called when a Drag and Drop element is dropped onto an item (i.e., when the mouse button @@ -124,7 +124,7 @@ as this class has one minor difference, and leave the other classes as an exercise for the reader. - \snippet widgets/graphicsview/dragdroprobot/robot.h 1 + \snippet graphicsview/dragdroprobot/robot.h 1 The \c RobotHead class inherits \c RobotPart and provides the necessary implementations of \l{QGraphicsItem::boundingRect()}{boundingRect()} and @@ -135,12 +135,12 @@ The class contains a private pixmap member that we can use to implement support for accepting image drops. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 4 + \snippet graphicsview/dragdroprobot/robot.cpp 4 \c RobotHead has a rather plain constructor that simply forwards to \c RobotPart's constructor. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 5 + \snippet graphicsview/dragdroprobot/robot.cpp 5 The \l{QGraphicsItem::boundingRect()}{boundingRect()} reimplementation returns the extents for the head. Because we want the center of rotation to @@ -149,7 +149,7 @@ rotating the head, the "neck" will stay still while the top of the head tilts from side to side. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 6 + \snippet graphicsview/dragdroprobot/robot.cpp 6 In \l{QGraphicsItem::paint()}{paint()} we draw the actual head. The implementation is split into two sections; if an image has been dropped @@ -160,7 +160,7 @@ can often be faster to draw the head as an image rather than using a sequence of vector operations. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 7 + \snippet graphicsview/dragdroprobot/robot.cpp 7 The robot head can accept image drops. In order to support this, its reimplementation of \l{QGraphicsItem::dragEnterEvent()}{dragEnterEvent()} @@ -168,7 +168,7 @@ event is accepted. Otherwise we fall back to the base \c RobotPart implementation. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 8 + \snippet graphicsview/dragdroprobot/robot.cpp 8 To follow up on image support, we must also implement \l{QGraphicsItem::dropEvent()}{dropEvent()}. We check if the drag object @@ -180,21 +180,21 @@ \c RobotTorso and \c RobotLimb are similar to \c RobotHead, so let's skip directly to the \c Robot class. - \snippet widgets/graphicsview/dragdroprobot/robot.h 4 + \snippet graphicsview/dragdroprobot/robot.h 4 The \c Robot class also inherits \c RobotPart, and like the other parts it also implements \l{QGraphicsItem::boundingRect()}{boundingRect()} and \l{QGraphicsItem::paint()}{paint()}. It provides a rather special implementation, though: - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 9 + \snippet graphicsview/dragdroprobot/robot.cpp 9 Because the \c Robot class is only used as a base node for the rest of the robot, it has no visual representation. Its \l{QGraphicsItem::boundingRect()}{boundingRect()} implementation can therefore return a null QRectF, and its paint() function does nothing. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 10 + \snippet graphicsview/dragdroprobot/robot.cpp 10 The constructor starts by setting the flag \l{QGraphicsItem::ItemHasNoContents}{ItemHasNoContents}, which is a minor @@ -208,13 +208,13 @@ the head a child of the torso; if you rotate the torso, the head will follow. The same pattern is applied to the rest of the limbs. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 11 + \snippet graphicsview/dragdroprobot/robot.cpp 11 Each robot part is carefully positioned. For example, the upper left arm is moved precisely to the top-left area of the torso, and the upper right arm is moved to the top-right area. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 12 + \snippet graphicsview/dragdroprobot/robot.cpp 12 The next section creates all animation objects. This snippet shows the two animations that operate on the head's scale and rotation. The two @@ -226,7 +226,7 @@ The rest of the animations are defined in a similar way. - \snippet widgets/graphicsview/dragdroprobot/robot.cpp 13 + \snippet graphicsview/dragdroprobot/robot.cpp 13 Finally we set an easing curve and duration on each animation, ensure the toplevel animation group loops forever, and start the toplevel animation. @@ -236,7 +236,7 @@ The \c ColorItem class represents a circular item that can be pressed to drag colors onto robot parts. - \snippet widgets/graphicsview/dragdroprobot/coloritem.h 0 + \snippet graphicsview/dragdroprobot/coloritem.h 0 This class is very simple. It does not use animations, and has no need for properties nor signals and slots, so to save resources, it's most natural @@ -252,7 +252,7 @@ Let's take a look at its implementation. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 0 + \snippet graphicsview/dragdroprobot/coloritem.cpp 0 \c ColorItem's constructor assigns an opaque random color to its color member by making use of qrand(). For improved usability, it assigns a @@ -266,7 +266,7 @@ mouse event handlers greatly, as we can always assume that only the left mouse button is pressed and released. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 1 + \snippet graphicsview/dragdroprobot/coloritem.cpp 1 The item's bounding rect is a fixed 30x30 units centered around the item's origin (0, 0), and adjusted by 0.5 units in all directions to allow a @@ -274,19 +274,19 @@ also compensate with a few units down and to the right to make room for a simple dropshadow. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 2 + \snippet graphicsview/dragdroprobot/coloritem.cpp 2 The \l{QGraphicsItem::paint()}{paint()} implementation draws an ellipse with a 1-unit black outline, a plain color fill, and a dark gray dropshadow. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 3 + \snippet graphicsview/dragdroprobot/coloritem.cpp 3 The \l{QGraphicsItem::mousePressEvent()}{mousePressEvent()} handler is called when you press the mouse button inside the item's area. Our implementation simply sets the cursor to Qt::ClosedHandCursor. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 4 + \snippet graphicsview/dragdroprobot/coloritem.cpp 4 The \l{QGraphicsItem::mouseReleaseEvent()}{mouseReleaseEvent()} handler is called when you release the mouse button after having pressed it inside an @@ -296,7 +296,7 @@ the cursor changes to an open hand. Pressing the item will show a closed hand cursor. Releasing will restore to an open hand cursor again. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 5 + \snippet graphicsview/dragdroprobot/coloritem.cpp 5 The \l{QGraphicsItem::mouseMoveEvent()}{mouseMoveEvent()} handler is called when you move the mouse around after pressing the mouse button inside the @@ -313,20 +313,20 @@ the right time. We also create a QMimeData instance that can contain our color or image data, and assign this to the drag object. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 6 + \snippet graphicsview/dragdroprobot/coloritem.cpp 6 This snippet has a somewhat random outcome: once in a while, a special image is assigned to the drag object's mime data. The pixmap is also assiged as the drag object's pixmap. This will ensure that you can see the image that is being dragged as a pixmap under the mouse cursor. - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 7 + \snippet graphicsview/dragdroprobot/coloritem.cpp 7 Otherwise, and this is the most common outcome, a simple color is assigned to the drag object's mime data. We render this \c ColorItem into a new pixmap to give the user visual feedback that the color is being "dragged". - \snippet widgets/graphicsview/dragdroprobot/coloritem.cpp 8 + \snippet graphicsview/dragdroprobot/coloritem.cpp 8 Finally we execute the drag. QDrag::exec() will reenter the event loop, and only exit if the drag has either been dropped, or canceled. In any case we @@ -337,13 +337,13 @@ Now that the \c Robot and \c ColorItem classes are complete, we can put all the pieces together inside the main() function. - \snippet widgets/graphicsview/dragdroprobot/main.cpp 0 + \snippet graphicsview/dragdroprobot/main.cpp 0 We start off by constructing QApplication, and initializing the random number generator. This ensures that the color items have different colors every time the application starts. - \snippet widgets/graphicsview/dragdroprobot/main.cpp 1 + \snippet graphicsview/dragdroprobot/main.cpp 1 We construct a fixed size scene, and create 10 \c ColorItem instances arranged in a circle. Each item is added to the scene. @@ -351,7 +351,7 @@ In the center of this circle we create one \c Robot instance. The robot is scaled and moved up a few units. It is then added to the scene. - \snippet widgets/graphicsview/dragdroprobot/main.cpp 2 + \snippet graphicsview/dragdroprobot/main.cpp 2 Finally we create a QGraphicsView window, and assign the scene to it. diff --git a/examples/widgets/doc/dynamiclayouts.qdoc b/examples/widgets/doc/dynamiclayouts.qdoc index 1c5f737aba..318f719503 100644 --- a/examples/widgets/doc/dynamiclayouts.qdoc +++ b/examples/widgets/doc/dynamiclayouts.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/layouts/dynamiclayouts + \example layouts/dynamiclayouts \title Dynamic Layouts Example The Dynamic Layouts example shows how to move widgets around in diff --git a/examples/widgets/doc/easing.qdoc b/examples/widgets/doc/easing.qdoc index 6bcda2ddb9..7fb7f59531 100644 --- a/examples/widgets/doc/easing.qdoc +++ b/examples/widgets/doc/easing.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/easing + \example animation/easing \title Easing Curves Example The Easing Curves example shows how to use easing curves to diff --git a/examples/widgets/doc/editabletreemodel.qdoc b/examples/widgets/doc/editabletreemodel.qdoc index d471eef352..24745b77b8 100644 --- a/examples/widgets/doc/editabletreemodel.qdoc +++ b/examples/widgets/doc/editabletreemodel.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/editabletreemodel + \example itemviews/editabletreemodel \title Editable Tree Model Example This example shows how to implement a simple item-based tree model that can @@ -67,7 +67,7 @@ \section1 Design - As with the \l{widgets/itemviews/simpletreemodel}{Simple Tree Model} example, + As with the \l{itemviews/simpletreemodel}{Simple Tree Model} example, the model simply acts as a wrapper around a collection of instances of a \c TreeItem class. Each \c TreeItem is designed to hold data for a row of items in a tree view, so it contains a list of @@ -209,7 +209,7 @@ \li \inlineimage itemviews-editabletreemodel-indexes.png \li \b{Relating items using model indexes} - As with the \l{widgets/itemviews/simpletreemodel}{Simple Tree Model} example, + As with the \l{itemviews/simpletreemodel}{Simple Tree Model} example, the \c TreeModel needs to be able to take a model index, find the corresponding \c TreeItem, and return model indexes that correspond to its parents and children. @@ -234,7 +234,7 @@ pieces of data, and which can provide information about their parent and child items: - \snippet widgets/itemviews/editabletreemodel/treeitem.h 0 + \snippet itemviews/editabletreemodel/treeitem.h 0 We have designed the API to be similar to that provided by QAbstractItemModel by giving each item functions to return the number @@ -251,7 +251,7 @@ Each \c TreeItem is constructed with a list of data and an optional parent item: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 0 + \snippet itemviews/editabletreemodel/treeitem.cpp 0 Initially, each item has no children. These are added to the item's internal \c childItems member using the \c insertChildren() function @@ -260,29 +260,29 @@ The destructor ensures that each child added to the item is deleted when the item itself is deleted: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 1 + \snippet itemviews/editabletreemodel/treeitem.cpp 1 \target TreeItem::parent Since each item stores a pointer to its parent, the \c parent() function is trivial: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 9 + \snippet itemviews/editabletreemodel/treeitem.cpp 9 \target TreeItem::child Three functions provide information about the children of an item. \c child() returns a specific child from the internal list of children: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 2 + \snippet itemviews/editabletreemodel/treeitem.cpp 2 The \c childCount() function returns the total number of children: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 3 + \snippet itemviews/editabletreemodel/treeitem.cpp 3 The \c childNumber() function is used to determine the index of the child in its parent's list of children. It accesses the parent's \c childItems member directly to obtain this information: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 4 + \snippet itemviews/editabletreemodel/treeitem.cpp 4 The root item has no parent item; for this item, we return zero to be consistent with the other items. @@ -290,20 +290,20 @@ The \c columnCount() function simply returns the number of elements in the internal \c itemData list of QVariant objects: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 5 + \snippet itemviews/editabletreemodel/treeitem.cpp 5 \target TreeItem::data Data is retrieved using the \c data() function, which accesses the appropriate element in the \c itemData list: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 6 + \snippet itemviews/editabletreemodel/treeitem.cpp 6 \target TreeItem::setData Data is set using the \c setData() function, which only stores values in the \c itemData list for valid list indexes, corresponding to column values in the model: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 11 + \snippet itemviews/editabletreemodel/treeitem.cpp 11 To make implementation of the model easier, we return true to indicate whether the data was set successfully, or false if an invalid column @@ -313,20 +313,20 @@ in the model leads to the insertion of new child items in the corresponding item, handled by the \c insertChildren() function: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 7 + \snippet itemviews/editabletreemodel/treeitem.cpp 7 This ensures that new items are created with the required number of columns and inserted at a valid position in the internal \c childItems list. Items are removed with the \c removeChildren() function: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 10 + \snippet itemviews/editabletreemodel/treeitem.cpp 10 As discussed above, the functions for inserting and removing columns are used differently to those for inserting and removing child items because they are expected to be called on every item in the tree. We do this by recursively calling this function on each child of the item: - \snippet widgets/itemviews/editabletreemodel/treeitem.cpp 8 + \snippet itemviews/editabletreemodel/treeitem.cpp 8 \section1 TreeModel Class Definition @@ -334,16 +334,16 @@ class, exposing the necessary interface for a model that can be edited and resized. - \snippet widgets/itemviews/editabletreemodel/treemodel.h 0 + \snippet itemviews/editabletreemodel/treemodel.h 0 The constructor and destructor are specific to this model. - \snippet widgets/itemviews/editabletreemodel/treemodel.h 1 + \snippet itemviews/editabletreemodel/treemodel.h 1 Read-only tree models only need to provide the above functions. The following public functions provide support for editing and resizing: - \snippet widgets/itemviews/editabletreemodel/treemodel.h 2 + \snippet itemviews/editabletreemodel/treemodel.h 2 To simplify this example, the data exposed by the model is organized into a data structure by the model's \l{TreeModel::setupModelData}{setupModelData()} @@ -355,7 +355,7 @@ The constructor creates a root item and initializes it with the header data supplied: - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 0 + \snippet itemviews/editabletreemodel/treemodel.cpp 0 We call the internal \l{TreeModel::setupModelData}{setupModelData()} function to convert the textual data supplied to a data structure we can @@ -365,7 +365,7 @@ The destructor only has to delete the root item; all child items will be recursively deleted by the \c TreeItem destructor. - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 1 + \snippet itemviews/editabletreemodel/treemodel.cpp 1 \target TreeModel::getItem Since the model's interface to the other model/view components is based @@ -375,7 +375,7 @@ consistency, we have defined a \c getItem() function to perform this repetitive task: - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 4 + \snippet itemviews/editabletreemodel/treemodel.cpp 4 This function assumes that each model index it is passed corresponds to a valid item in memory. If the index is invalid, or its internal pointer @@ -385,13 +385,13 @@ \c getItem() function to obtain the relevant item, then returns the number of children it contains: - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 8 + \snippet itemviews/editabletreemodel/treemodel.cpp 8 By contrast, the \c columnCount() implementation does not need to look for a particular item because all items are defined to have the same number of columns associated with them. - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 2 + \snippet itemviews/editabletreemodel/treemodel.cpp 2 As a result, the number of columns can be obtained directly from the root item. @@ -401,7 +401,7 @@ the Qt::ItemIsEditable and Qt::ItemIsSelectable flags as well as Qt::ItemIsEnabled: - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 3 + \snippet itemviews/editabletreemodel/treemodel.cpp 3 \target TreeModel::index The model needs to be able to generate model indexes to allow other @@ -409,7 +409,7 @@ is performed by the \c index() function, which is used to obtain model indexes corresponding to children of a given parent item: - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 5 + \snippet itemviews/editabletreemodel/treemodel.cpp 5 In this model, we only return model indexes for child items if the parent index is invalid (corresponding to the root item) or if it has a zero @@ -419,7 +419,7 @@ a \c TreeItem instance that corresponds to the model index supplied, and request its child item that corresponds to the specified row. - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 6 + \snippet itemviews/editabletreemodel/treemodel.cpp 6 Since each item contains information for an entire row of data, we create a model index to uniquely identify it by calling @@ -436,7 +436,7 @@ then creating a model index to represent the parent. (See \l{Relating-items-using-model-indexes}{the above diagram}). - \snippet widgets/itemviews/editabletreemodel/treemodel.cpp 7 + \snippet itemviews/editabletreemodel/treemodel.cpp 7 Items without parents, including the root item, are handled by returning a null model index. Otherwise, a model index is created and returned as diff --git a/examples/widgets/doc/elasticnodes.qdoc b/examples/widgets/doc/elasticnodes.qdoc index df993a95c3..17f14124f8 100644 --- a/examples/widgets/doc/elasticnodes.qdoc +++ b/examples/widgets/doc/elasticnodes.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/elasticnodes + \example graphicsview/elasticnodes \title Elastic Nodes Example The Elastic Nodes example shows how to implement edges between nodes in a @@ -61,7 +61,7 @@ Let's start by looking at the \c Node class declaration. - \snippet widgets/graphicsview/elasticnodes/node.h 0 + \snippet graphicsview/elasticnodes/node.h 0 The \c Node class inherits QGraphicsItem, and reimplements the two mandatory functions \l{QGraphicsItem::boundingRect()}{boundingRect()} and @@ -87,7 +87,7 @@ We will start reviewing the \c Node implementation by looking at its constructor: - \snippet widgets/graphicsview/elasticnodes/node.cpp 0 + \snippet graphicsview/elasticnodes/node.cpp 0 In the constructor, we set the \l{QGraphicsItem::ItemIsMovable}{ItemIsMovable} flag to allow the item to @@ -102,7 +102,7 @@ \c Node's constructor takes a \c GraphWidget pointer and stores this as a member variable. We will revisit this pointer later on. - \snippet widgets/graphicsview/elasticnodes/node.cpp 1 + \snippet graphicsview/elasticnodes/node.cpp 1 The addEdge() function adds the input edge to a list of attached edges. The edge is then adjusted so that the end points for the edge match the @@ -110,7 +110,7 @@ The edges() function simply returns the list of attached edges. - \snippet widgets/graphicsview/elasticnodes/node.cpp 2 + \snippet graphicsview/elasticnodes/node.cpp 2 There are two ways to move a node. The \c calculateForces() function implements the elastic effect that pulls and pushes on nodes in the grid. @@ -121,7 +121,7 @@ Because we need to find all neighboring (but not necessarily connected) nodes, we also make sure the item is part of a scene in the first place. - \snippet widgets/graphicsview/elasticnodes/node.cpp 3 + \snippet graphicsview/elasticnodes/node.cpp 3 The "elastic" effect comes from an algorithm that applies pushing and pulling forces. The effect is impressive, and surprisingly simple to @@ -142,41 +142,41 @@ rapid degradation when distance increases. The sum of all forces is stored in \c xvel (X-velocity) and \c yvel (Y-velocity). - \snippet widgets/graphicsview/elasticnodes/node.cpp 4 + \snippet graphicsview/elasticnodes/node.cpp 4 The edges between the nodes represent forces that pull the nodes together. By visiting each edge that is connected to this node, we can use a similar approach as above to find the direction and strength of all pulling forces. These forces are subtracted from \c xvel and \c yvel. - \snippet widgets/graphicsview/elasticnodes/node.cpp 5 + \snippet graphicsview/elasticnodes/node.cpp 5 In theory, the sum of pushing and pulling forces should stabilize to precisely 0. In practice, however, they never do. To circumvent errors in numerical precision, we simply force the sum of forces to be 0 when they are less than 0.1. - \snippet widgets/graphicsview/elasticnodes/node.cpp 6 + \snippet graphicsview/elasticnodes/node.cpp 6 The final step of \c calculateForces() determines the node's new position. We add the force to the node's current position. We also make sure the new position stays inside of our defined boundaries. We don't actually move the item in this function; that's done in a separate step, from \c advance(). - \snippet widgets/graphicsview/elasticnodes/node.cpp 7 + \snippet graphicsview/elasticnodes/node.cpp 7 The \c advance() function updates the item's current position. It is called from \c GraphWidget::timerEvent(). If the node's position changed, the function returns true; otherwise false is returned. - \snippet widgets/graphicsview/elasticnodes/node.cpp 8 + \snippet graphicsview/elasticnodes/node.cpp 8 The \c Node's bounding rectangle is a 20x20 sized rectangle centered around its origin (0, 0), adjusted by 2 units in all directions to compensate for the node's outline stroke, and by 3 units down and to the right to make room for a simple drop shadow. - \snippet widgets/graphicsview/elasticnodes/node.cpp 9 + \snippet graphicsview/elasticnodes/node.cpp 9 The shape is a simple ellipse. This ensures that you must click inside the node's elliptic shape in order to drag it around. You can test this effect @@ -185,7 +185,7 @@ item's hit area would be identical to its bounding rectangle (i.e., rectangular). - \snippet widgets/graphicsview/elasticnodes/node.cpp 10 + \snippet graphicsview/elasticnodes/node.cpp 10 This function implements the node's painting. We start by drawing a simple dark gray elliptic drop shadow at (-7, -7), that is, (3, 3) units down and @@ -201,7 +201,7 @@ uses \l{QGraphicsItem::DeviceCoordinateCache}{DeviceCoordinateCache}, a simple yet effective measure that prevents unnecessary redrawing. - \snippet widgets/graphicsview/elasticnodes/node.cpp 11 + \snippet graphicsview/elasticnodes/node.cpp 11 We reimplement \l{QGraphicsItem::itemChange()}{itemChange()} to adjust the position of all connected edges, and to notify the scene that an item has @@ -213,7 +213,7 @@ notification using a signal; in such case, \c Node would need to inherit from QGraphicsObject. - \snippet widgets/graphicsview/elasticnodes/node.cpp 12 + \snippet graphicsview/elasticnodes/node.cpp 12 Because we have set the \l{QGraphicsItem::ItemIsMovable}{ItemIsMovable} flag, we don't need to implement the logic that moves the node according to @@ -232,7 +232,7 @@ Let's take a look at the class declaration: - \snippet widgets/graphicsview/elasticnodes/edge.h 0 + \snippet graphicsview/elasticnodes/edge.h 0 \c Edge inherits from QGraphicsItem, as it's a simple class that has no use for signals, slots, and properties (compare to QGraphicsObject). @@ -246,7 +246,7 @@ We will now review its implementation. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 0 + \snippet graphicsview/elasticnodes/edge.cpp 0 The \c Edge constructor initializes its \c arrowSize data member to 10 units; this determines the size of the arrow which is drawn in @@ -259,12 +259,12 @@ pointers are updated, this edge is registered with each node, and we call \c adjust() to update this edge's start end end position. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 1 + \snippet graphicsview/elasticnodes/edge.cpp 1 The source and destination get-functions simply return the respective pointers. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 2 + \snippet graphicsview/elasticnodes/edge.cpp 2 In \c adjust(), we define two points: \c sourcePoint, and \c destPoint, pointing at the source and destination nodes' origins respectively. Each @@ -298,7 +298,7 @@ bookkeeping clean. It's safest to call this function once, immediately before any such variable is modified. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 3 + \snippet graphicsview/elasticnodes/edge.cpp 3 The edge's bounding rectangle is defined as the smallest rectangle that includes both the start and the end point of the edge. Because we draw an @@ -307,7 +307,7 @@ draw the outline of the arrow, and we can assume that half of the outline can be drawn outside of the arrow's area, and half will be drawn inside. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 4 + \snippet graphicsview/elasticnodes/edge.cpp 4 We start the reimplementation of \l{QGraphicsItem::paint()}{paint()} by checking a few preconditions. Firstly, if either the source or destination @@ -316,13 +316,13 @@ At the same time, we check if the length of the edge is approximately 0, and if it is, then we also return. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 5 + \snippet graphicsview/elasticnodes/edge.cpp 5 We draw the line using a pen that has round joins and caps. If you run the example, zoom in and study the edge in detail, you will see that there are no sharp/square edges. - \snippet widgets/graphicsview/elasticnodes/edge.cpp 6 + \snippet graphicsview/elasticnodes/edge.cpp 6 We proceed to drawing one arrow at each end of the edge. Each arrow is drawn as a polygon with a black fill. The coordinates for the arrow are @@ -333,7 +333,7 @@ \c GraphWidget is a subclass of QGraphicsView, which provides the main window with scrollbars. - \snippet widgets/graphicsview/elasticnodes/graphwidget.h 0 + \snippet graphicsview/elasticnodes/graphwidget.h 0 The class provides a basic constructor that initializes the scene, an \c itemMoved() function to notify changes in the scene's node graph, a few @@ -341,7 +341,7 @@ \l{QGraphicsView::drawBackground()}{drawBackground()}, and a helper function for scaling the view by using the mouse wheel or keyboard. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 0 + \snippet graphicsview/elasticnodes/graphwidget.cpp 0 \c GraphicsWidget's constructor creates the scene, and because most items move around most of the time, it sets QGraphicsScene::NoIndex. The scene @@ -366,19 +366,19 @@ Finally we give the window a minimum size that matches the scene's default size, and set a suitable window title. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 1 + \snippet graphicsview/elasticnodes/graphwidget.cpp 1 The last part of the constructor creates the grid of nodes and edges, and gives each node an initial position. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 2 + \snippet graphicsview/elasticnodes/graphwidget.cpp 2 \c GraphWidget is notified of node movement through this \c itemMoved() function. Its job is simply to restart the main timer in case it's not running already. The timer is designed to stop when the graph stabilizes, and start once it's unstable again. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 3 + \snippet graphicsview/elasticnodes/graphwidget.cpp 3 This is \c GraphWidget's key event handler. The arrow keys move the center node around, the '+' and '-' keys zoom in and out by calling \c @@ -386,7 +386,7 @@ nodes. All other key events (e.g., page up and page down) are handled by QGraphicsView's default implementation. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 4 + \snippet graphicsview/elasticnodes/graphwidget.cpp 4 The timer event handler's job is to run the whole force calculation machinery as a smooth animation. Each time the timer is triggered, the @@ -396,14 +396,14 @@ By checking the return value of \c advance(), we can decide if the grid stabilized (i.e., no nodes moved). If so, we can stop the timer. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 5 + \snippet graphicsview/elasticnodes/graphwidget.cpp 5 In the wheel event handler, we convert the mouse wheel delta to a scale factor, and pass this factor to \c scaleView(). This approach takes into account the speed that the wheel is rolled. The faster you roll the mouse wheel, the faster the view will zoom. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 6 + \snippet graphicsview/elasticnodes/graphwidget.cpp 6 The view's background is rendered in a reimplementation of QGraphicsView::drawBackground(). We draw a large rectangle filled with a @@ -413,7 +413,7 @@ This background rendering is quite expensive; this is why the view enables QGraphicsView::CacheBackground. - \snippet widgets/graphicsview/elasticnodes/graphwidget.cpp 7 + \snippet graphicsview/elasticnodes/graphwidget.cpp 7 The \c scaleView() helper function checks that the scale factor stays within certain limits (i.e., you cannot zoom too far in nor too far out), diff --git a/examples/widgets/doc/embeddeddialogs.qdoc b/examples/widgets/doc/embeddeddialogs.qdoc index fbde62443f..24b3abdb37 100644 --- a/examples/widgets/doc/embeddeddialogs.qdoc +++ b/examples/widgets/doc/embeddeddialogs.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/embeddeddialogs + \example graphicsview/embeddeddialogs \title Embedded Dialogs This example shows how to embed standard dialogs into diff --git a/examples/widgets/doc/eventtransitions.qdoc b/examples/widgets/doc/eventtransitions.qdoc index 3ae3065592..ef3f657c3d 100644 --- a/examples/widgets/doc/eventtransitions.qdoc +++ b/examples/widgets/doc/eventtransitions.qdoc @@ -26,33 +26,33 @@ ****************************************************************************/ /*! - \example widgets/statemachine/eventtransitions + \example statemachine/eventtransitions \title Event Transitions Example The Event Transitions example shows how to use event transitions, a feature of \l{The State Machine Framework}. - \snippet widgets/statemachine/eventtransitions/main.cpp 0 + \snippet statemachine/eventtransitions/main.cpp 0 The \c Window class's constructors begins by creating a button. - \snippet widgets/statemachine/eventtransitions/main.cpp 1 + \snippet statemachine/eventtransitions/main.cpp 1 Two states, \c s1 and \c s2, are created; upon entry they will assign "Outside" and "Inside" to the button's text, respectively. - \snippet widgets/statemachine/eventtransitions/main.cpp 2 + \snippet statemachine/eventtransitions/main.cpp 2 When the button receives an event of type QEvent::Enter and the state machine is in state \c s1, the machine will transition to state \c s2. - \snippet widgets/statemachine/eventtransitions/main.cpp 3 + \snippet statemachine/eventtransitions/main.cpp 3 When the button receives an event of type QEvent::Leave and the state machine is in state \c s2, the machine will transition back to state \c s1. - \snippet widgets/statemachine/eventtransitions/main.cpp 4 + \snippet statemachine/eventtransitions/main.cpp 4 Next, the state \c s3 is created. \c s3 will be entered when the button receives an event of type QEvent::MouseButtonPress and the state machine @@ -60,12 +60,12 @@ QEvent::MouseButtonRelease and the state machine is in state \c s3, the machine will transition back to state \c s2. - \snippet widgets/statemachine/eventtransitions/main.cpp 5 + \snippet statemachine/eventtransitions/main.cpp 5 Finally, the states are added to the machine as top-level states, the initial state is set to be \c s1 ("Outside"), and the machine is started. - \snippet widgets/statemachine/eventtransitions/main.cpp 6 + \snippet statemachine/eventtransitions/main.cpp 6 The main() function constructs a Window object and shows it. diff --git a/examples/widgets/doc/extension.qdoc b/examples/widgets/doc/extension.qdoc index 1568b44629..040d5d38d9 100644 --- a/examples/widgets/doc/extension.qdoc +++ b/examples/widgets/doc/extension.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/extension + \example dialogs/extension \title Extension Example The Extension example shows how to add an extension to a QDialog @@ -55,7 +55,7 @@ window mostly used for short-term tasks and brief communications with the user. - \snippet widgets/dialogs/extension/finddialog.h 0 + \snippet dialogs/extension/finddialog.h 0 The \c FindDialog widget is the main application widget, and displays the application's search options and controlling @@ -77,7 +77,7 @@ of the \l {QCheckBox}{QCheckBox}es and all the \l {QPushButton}{QPushButton}s. - \snippet widgets/dialogs/extension/finddialog.cpp 0 + \snippet dialogs/extension/finddialog.cpp 0 We give the options and buttons a shortcut key using the & character. In the \uicontrol {Find what} option's case, we also need to @@ -91,13 +91,13 @@ pressed if the user presses the Enter (or Return) key. Note that a QDialog can only have one default button. - \snippet widgets/dialogs/extension/finddialog.cpp 2 + \snippet dialogs/extension/finddialog.cpp 2 Then we create the extension widget, and the \l {QCheckBox}{QCheckBox}es associated with the advanced search options. - \snippet widgets/dialogs/extension/finddialog.cpp 3 + \snippet dialogs/extension/finddialog.cpp 3 Now that the extension widget is created, we can connect the \uicontrol More button's \l{QAbstractButton::toggled()}{toggled()} signal to @@ -117,7 +117,7 @@ We also put the check boxes associated with the advanced search options into a layout we install on the extension widget. - \snippet widgets/dialogs/extension/finddialog.cpp 4 + \snippet dialogs/extension/finddialog.cpp 4 Before we create the main layout, we create several child layouts for the widgets: First we align the QLabel and its buddy, the @@ -127,7 +127,7 @@ for the buttons. In the end we lay out the two latter layouts and the extension widget using a QGridLayout. - \snippet widgets/dialogs/extension/finddialog.cpp 5 + \snippet dialogs/extension/finddialog.cpp 5 Finally, we hide the extension widget using the QWidget::hide() function, making the application only show the simple search diff --git a/examples/widgets/doc/factorial.qdoc b/examples/widgets/doc/factorial.qdoc index 250fdcc2b7..82ab5da536 100644 --- a/examples/widgets/doc/factorial.qdoc +++ b/examples/widgets/doc/factorial.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/statemachine/factorial + \example statemachine/factorial \title Factorial States Example The Factorial States example shows how to use \l{The State Machine @@ -42,42 +42,42 @@ In other words, the state machine calculates the factorial of 6 and prints the result. - \snippet widgets/statemachine/factorial/main.cpp 0 + \snippet statemachine/factorial/main.cpp 0 The Factorial class is used to hold the data of the computation, \c x and \c fac. It also provides a signal that's emitted whenever the value of \c x changes. - \snippet widgets/statemachine/factorial/main.cpp 1 + \snippet statemachine/factorial/main.cpp 1 The FactorialLoopTransition class implements the guard (\c x > 1) and calculations (\c fac = \c x * \c fac; \c x = \c x - 1) of the factorial loop. - \snippet widgets/statemachine/factorial/main.cpp 2 + \snippet statemachine/factorial/main.cpp 2 The FactorialDoneTransition class implements the guard (\c x <= 1) that terminates the factorial computation. It also prints the final result to standard output. - \snippet widgets/statemachine/factorial/main.cpp 3 + \snippet statemachine/factorial/main.cpp 3 The application's main() function first creates the application object, a Factorial object and a state machine. - \snippet widgets/statemachine/factorial/main.cpp 4 + \snippet statemachine/factorial/main.cpp 4 The \c compute state is created, and the initial values of \c x and \c fac are defined. A FactorialLoopTransition object is created and added to the state. - \snippet widgets/statemachine/factorial/main.cpp 5 + \snippet statemachine/factorial/main.cpp 5 A final state, \c done, is created, and a FactorialDoneTransition object is created with \c done as its target state. The transition is then added to the \c compute state. - \snippet widgets/statemachine/factorial/main.cpp 6 + \snippet statemachine/factorial/main.cpp 6 The machine's initial state is set to be the \c compute state. We connect the QStateMachine::finished() signal to the QCoreApplication::quit() slot, diff --git a/examples/widgets/doc/fetchmore.qdoc b/examples/widgets/doc/fetchmore.qdoc index 50810090ee..7ea0b30edf 100644 --- a/examples/widgets/doc/fetchmore.qdoc +++ b/examples/widgets/doc/fetchmore.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/fetchmore + \example itemviews/fetchmore \title Fetch More Example The Fetch More example shows how two add items to an item view @@ -56,7 +56,7 @@ contents of a directory. It will add items to itself only when requested to do so by the view. - \snippet widgets/itemviews/fetchmore/filelistmodel.h 0 + \snippet itemviews/fetchmore/filelistmodel.h 0 The secret lies in the reimplementation of \l{QAbstractItemModel::}{fetchMore()} and @@ -75,13 +75,13 @@ We start by checking out the \c setDirPath(). - \snippet widgets/itemviews/fetchmore/filelistmodel.cpp 0 + \snippet itemviews/fetchmore/filelistmodel.cpp 0 We use a QDir to get the contents of the directory. We need to inform QAbstractItemModel that we want to remove all items - if any - from the model. - \snippet widgets/itemviews/fetchmore/filelistmodel.cpp 1 + \snippet itemviews/fetchmore/filelistmodel.cpp 1 The \c canFetchMore() function is called by the view when it needs more items. We return true if there still are entries that we have @@ -89,7 +89,7 @@ And now, the \c fetchMore() function itself: - \snippet widgets/itemviews/fetchmore/filelistmodel.cpp 2 + \snippet itemviews/fetchmore/filelistmodel.cpp 2 We first calculate the number of items to fetch. \l{QAbstractItemModel::}{beginInsertRows()} and @@ -99,7 +99,7 @@ To complete the tour, we also look at \c rowCount() and \c data(). - \snippet widgets/itemviews/fetchmore/filelistmodel.cpp 4 + \snippet itemviews/fetchmore/filelistmodel.cpp 4 Notice that the row count is only the items we have added so far, i.e., not the number of entries in the directory. diff --git a/examples/widgets/doc/findfiles.qdoc b/examples/widgets/doc/findfiles.qdoc index c848ac9d59..594d57472c 100644 --- a/examples/widgets/doc/findfiles.qdoc +++ b/examples/widgets/doc/findfiles.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/findfiles + \example dialogs/findfiles \title Find Files Example The Find Files example shows how to use QProgressDialog to provide @@ -54,7 +54,7 @@ widget. It shows the search options, and displays the search results. - \snippet widgets/dialogs/findfiles/window.h 0 + \snippet dialogs/findfiles/window.h 0 We need two private slots: The \c browse() slot is called whenever the user wants to browse for a directory to search in, and the \c @@ -71,7 +71,7 @@ In the constructor we first create the application's widgets. - \snippet widgets/dialogs/findfiles/window.cpp 0 + \snippet dialogs/findfiles/window.cpp 0 We create the application's buttons using the private \c createButton() function. Then we create the comboboxes associated @@ -80,14 +80,14 @@ before we use the private \c createFilesTable() function to create the table displaying the search results. - \snippet widgets/dialogs/findfiles/window.cpp 1 + \snippet dialogs/findfiles/window.cpp 1 Then we add all the widgets to a main layout using QGridLayout. We have, however, put the \c Find and \c Quit buttons and a stretchable space in a separate QHBoxLayout first, to make the buttons appear in the \c Window widget's bottom right corner. - \snippet widgets/dialogs/findfiles/window.cpp 2 + \snippet dialogs/findfiles/window.cpp 2 The \c browse() slot presents a file dialog to the user, using the QFileDialog class. QFileDialog enables a user to traverse the file @@ -106,7 +106,7 @@ the specified userData. The item is appended to the list of existing items. - \snippet widgets/dialogs/findfiles/window.cpp 3 + \snippet dialogs/findfiles/window.cpp 3 The \c find() slot is called whenever the user requests a new search by pressing the \uicontrol Find button. @@ -116,7 +116,7 @@ specified file name, text and directory path from the respective comboboxes. - \snippet widgets/dialogs/findfiles/window.cpp 4 + \snippet dialogs/findfiles/window.cpp 4 We use the directory's path to create a QDir; the QDir class provides access to directory structures and their contents. We @@ -134,7 +134,7 @@ \image findfiles_progress_dialog.png Screenshot of the Progress Dialog - \snippet widgets/dialogs/findfiles/window.cpp 5 + \snippet dialogs/findfiles/window.cpp 5 In the private \c findFiles() function we search through a list of files, looking for the ones that contain a specified text. This @@ -149,7 +149,7 @@ application has not frozen. It can also give the user an opportunity to abort the operation. - \snippet widgets/dialogs/findfiles/window.cpp 6 + \snippet dialogs/findfiles/window.cpp 6 We run through the files, one at a time, and for each file we update the QProgressDialog value. This property holds the current @@ -170,7 +170,7 @@ until there are no more events to process. The default flags are QEventLoop::AllEvents. - \snippet widgets/dialogs/findfiles/window.cpp 7 + \snippet dialogs/findfiles/window.cpp 7 After updating the QProgressDialog, we create a QFile using the QDir::absoluteFilePath() function which returns the absolute path @@ -189,7 +189,7 @@ Finally, we return the list of the files found. - \snippet widgets/dialogs/findfiles/window.cpp 8 + \snippet dialogs/findfiles/window.cpp 8 Both the \c findFiles() and \c showFiles() functions are called from the \c find() slot. In the \c showFiles() function we run through @@ -199,14 +199,14 @@ We also update the total number of files found. - \snippet widgets/dialogs/findfiles/window.cpp 9 + \snippet dialogs/findfiles/window.cpp 9 The private \c createButton() function is called from the constructor. We create a QPushButton with the provided text, connect it to the provided slot, and return a pointer to the button. - \snippet widgets/dialogs/findfiles/window.cpp 10 + \snippet dialogs/findfiles/window.cpp 10 The private \c createComboBox() function is also called from the contructor. We create a QComboBox with the given text, and make it @@ -221,7 +221,7 @@ widget's size policies, before we return a pointer to the combobox. - \snippet widgets/dialogs/findfiles/window.cpp 11 + \snippet dialogs/findfiles/window.cpp 11 The private \c createFilesTable() function is called from the constructor. In this function we create the QTableWidget that @@ -240,7 +240,7 @@ QWidget::hide() function, and remove the default grid drawn for the table using the QTableView::setShowGrid() function. - \snippet widgets/dialogs/findfiles/window.cpp 12 + \snippet dialogs/findfiles/window.cpp 12 The \c openFileOfItem() slot is invoked when the user double clicks on a cell in the table. The QDesktopServices::openUrl() diff --git a/examples/widgets/doc/flowlayout.qdoc b/examples/widgets/doc/flowlayout.qdoc index 910eb63c15..b08b2283aa 100644 --- a/examples/widgets/doc/flowlayout.qdoc +++ b/examples/widgets/doc/flowlayout.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/layouts/flowlayout + \example layouts/flowlayout \title Flow Layout Example The Flow Layout example demonstrates a custom layout that arranges child @@ -46,7 +46,7 @@ The \c FlowLayout class inherits QLayout. It is a custom layout class that arranges its child widgets horizontally and vertically. - \snippet widgets/layouts/flowlayout/flowlayout.h 0 + \snippet layouts/flowlayout/flowlayout.h 0 We reimplement functions inherited from QLayout. These functions add items to the layout and handle their orientation and geometry. @@ -59,31 +59,31 @@ We start off by looking at the constructor: - \snippet widgets/layouts/flowlayout/flowlayout.cpp 1 + \snippet layouts/flowlayout/flowlayout.cpp 1 In the constructor we call \c setContentsMargins() to set the left, top, right and bottom margin. By default, QLayout uses values provided by the current style (see QStyle::PixelMetric). - \snippet widgets/layouts/flowlayout/flowlayout.cpp 2 + \snippet layouts/flowlayout/flowlayout.cpp 2 In this example we reimplement \c addItem(), which is a pure virtual function. When using \c addItem() the ownership of the layout items is transferred to the layout, and it is therefore the layout's responsibility to delete them. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 3 + \snippet layouts/flowlayout/flowlayout.cpp 3 \c addItem() is implemented to add items to the layout. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 4 + \snippet layouts/flowlayout/flowlayout.cpp 4 We implement \c horizontalSpacing() and \c verticalSpacing() to get hold of the spacing between the widgets inside the layout. If the value is less than or equal to 0, this value will be used. If not, \c smartSpacing() will be called to calculate the spacing. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 5 + \snippet layouts/flowlayout/flowlayout.cpp 5 We then implement \c count() to return the number of items in the layout. To navigate the list of items we use \c itemAt() and @@ -91,12 +91,12 @@ removed, the remaining items will be renumbered. All three functions are pure virtual functions from QLayout. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 6 + \snippet layouts/flowlayout/flowlayout.cpp 6 \c expandingDirections() returns the \l{Qt::Orientation}s in which the layout can make use of more space than its \c sizeHint(). - \snippet widgets/layouts/flowlayout/flowlayout.cpp 7 + \snippet layouts/flowlayout/flowlayout.cpp 7 To adjust to widgets of which height is dependent on width, we implement \c heightForWidth(). The function \c hasHeightForWidth() is used to test for this @@ -104,7 +104,7 @@ in turn uses the width as an argument for the layout rect, i.e., the bounds in which the items are laid out. This rect does not include the layout margin(). - \snippet widgets/layouts/flowlayout/flowlayout.cpp 8 + \snippet layouts/flowlayout/flowlayout.cpp 8 \c setGeometry() is normally used to do the actual layout, i.e., calculate the geometry of the layout's items. In this example, it calls \c doLayout() @@ -113,19 +113,19 @@ \c sizeHint() returns the preferred size of the layout and \c minimumSize() returns the minimum size of the layout. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 9 + \snippet layouts/flowlayout/flowlayout.cpp 9 \c doLayout() handles the layout if \c horizontalSpacing() or \c verticalSpacing() don't return the default value. It uses \c getContentsMargins() to calculate the area available to the layout items. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 10 + \snippet layouts/flowlayout/flowlayout.cpp 10 It then sets the proper amount of spacing for each widget in the layout, based on the current style. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 11 + \snippet layouts/flowlayout/flowlayout.cpp 11 The position of each item in the layout is then calculated by adding the items width and the line height to the initial x and y @@ -133,7 +133,7 @@ will fit on the current line or if it must be moved down to the next. We also find the height of the current line based on the widgets height. - \snippet widgets/layouts/flowlayout/flowlayout.cpp 12 + \snippet layouts/flowlayout/flowlayout.cpp 12 \c smartSpacing() is designed to get the default spacing for either the top-level layouts or the sublayouts. The default spacing for diff --git a/examples/widgets/doc/fontsampler.qdoc b/examples/widgets/doc/fontsampler.qdoc index 374258a4bc..8d7f0e0460 100644 --- a/examples/widgets/doc/fontsampler.qdoc +++ b/examples/widgets/doc/fontsampler.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/fontsampler + \example painting/fontsampler \title Font Sampler Example The Font Sampler example shows how to preview and print multi-page documents. diff --git a/examples/widgets/doc/frozencolumn.qdoc b/examples/widgets/doc/frozencolumn.qdoc index e97b0ad373..c65ce1d524 100644 --- a/examples/widgets/doc/frozencolumn.qdoc +++ b/examples/widgets/doc/frozencolumn.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/frozencolumn + \example itemviews/frozencolumn \title Frozen Column Example This example demonstrates how to freeze a column within a QTableView. @@ -56,7 +56,7 @@ column's geometry. In addition, we reimplement two functions: \l{QAbstractItemView::}{resizeEvent()} and \l{QTableView::}{moveCursor()}. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.h Widget definition + \snippet itemviews/frozencolumn/freezetablewidget.h Widget definition \note QAbstractItemView is \l{QTableView}'s ancestor. @@ -72,7 +72,7 @@ vertical scrollbars together so that the frozen column scrolls vertically with the rest of our table. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp constructor + \snippet itemviews/frozencolumn/freezetablewidget.cpp constructor In the \c init() function, we ensure that the overlay table view @@ -82,7 +82,7 @@ only visible column is its first column; we hide the others using \l{QTableView::}{setColumnHidden()} - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp init part1 + \snippet itemviews/frozencolumn/freezetablewidget.cpp init part1 In terms of the frozen column's z-order, we stack it on top of the @@ -94,7 +94,7 @@ with the main tableview. Note that we called \c updateFrozenTableGeometry() to make the column occupy the correct spot. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp init part2 + \snippet itemviews/frozencolumn/freezetablewidget.cpp init part2 When you resize the frozen column, the same column on the main table view must resize accordingly, to provide seamless integration. This is @@ -102,7 +102,7 @@ value from the \l{QHeaderView::}{sectionResized()} signal, emitted by both the horizontal and vertical header. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp sections + \snippet itemviews/frozencolumn/freezetablewidget.cpp sections Since the width of the frozen column is modified, we adjust the geometry of the widget accordingly by invoking \c updateFrozenTableGeometry(). This @@ -112,14 +112,14 @@ \c updateFrozenTableGeometry() after invoking the base class implementation. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp resize + \snippet itemviews/frozencolumn/freezetablewidget.cpp resize When navigating around the table with the keyboard, we need to ensure that the current selection does not disappear behind the frozen column. To synchronize this, we reimplement QTableView::moveCursor() and adjust the scrollbar positions if needed, after calling the base class implementation. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp navigate + \snippet itemviews/frozencolumn/freezetablewidget.cpp navigate The frozen column's geometry calculation is based on the geometry of the table underneath, so it always appears in the right place. Using the @@ -127,7 +127,7 @@ no matter which style is used. We rely on the geometry of the viewport and headers to set the boundaries for the frozen column. - \snippet widgets/itemviews/frozencolumn/freezetablewidget.cpp geometry + \snippet itemviews/frozencolumn/freezetablewidget.cpp geometry */ diff --git a/examples/widgets/doc/gradients.qdoc b/examples/widgets/doc/gradients.qdoc index 325d09c85a..75f78b56ea 100644 --- a/examples/widgets/doc/gradients.qdoc +++ b/examples/widgets/doc/gradients.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/gradients + \example painting/gradients \title Gradients In this example we show the various types of gradients that can diff --git a/examples/widgets/doc/imagecomposition.qdoc b/examples/widgets/doc/imagecomposition.qdoc index e1b7ac2d15..3f06f377b4 100644 --- a/examples/widgets/doc/imagecomposition.qdoc +++ b/examples/widgets/doc/imagecomposition.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/imagecomposition + \example painting/imagecomposition \title Image Composition Example The Image Composition example lets the user combine images @@ -41,7 +41,7 @@ \e butterfly.png and \e checker.png that are embedded within \e imagecomposition.qrc. The file contains the following code: - \quotefile widgets/painting/imagecomposition/imagecomposition.qrc + \quotefile painting/imagecomposition/imagecomposition.qrc For more information on resource files, see \l{The Qt Resource System}. @@ -51,21 +51,21 @@ private slots, \c chooseSource(), \c chooseDestination(), and \c recalculateResult(). - \snippet widgets/painting/imagecomposition/imagecomposer.h 0 + \snippet painting/imagecomposition/imagecomposer.h 0 In addition, \c ImageComposer consists of five private functions, \c addOp(), \c chooseImage(), \c loadImage(), \c currentMode(), and \c imagePos(), as well as private instances of QToolButton, QComboBox, QLabel, and QImage. - \snippet widgets/painting/imagecomposition/imagecomposer.h 1 + \snippet painting/imagecomposition/imagecomposer.h 1 \section1 ImageComposer Class Implementation We declare a QSize object, \c resultSize, as a static constant with width and height equal to 200. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 0 + \snippet painting/imagecomposition/imagecomposer.cpp 0 Within the constructor, we instantiate a QToolButton object, \c sourceButton and set its \l{QAbstractButton::setIconSize()}{iconSize} @@ -74,7 +74,7 @@ QPainter::CompositionMode, \a mode, and a QString, \a name, representing the name of the composition mode. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 1 + \snippet painting/imagecomposition/imagecomposer.cpp 1 The \c destinationButton is instantiated and its \l{QAbstractButton::setIconSize()}{iconSize} property is set to @@ -82,7 +82,7 @@ are created and \c{resultLabel}'s \l{QWidget::setMinimumWidth()} {minimumWidth} is set. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 2 + \snippet painting/imagecomposition/imagecomposer.cpp 2 We connect the following signals to their corresponding slots: \list @@ -94,40 +94,40 @@ is connected to \c chooseDestination(). \endlist - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 3 + \snippet painting/imagecomposition/imagecomposer.cpp 3 A QGridLayout, \c mainLayout, is used to place all the widgets. Note that \c{mainLayout}'s \l{QLayout::setSizeConstraint()}{sizeConstraint} property is set to QLayout::SetFixedSize, which means that \c{ImageComposer}'s size cannot be resized at all. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 4 + \snippet painting/imagecomposition/imagecomposer.cpp 4 We create a QImage, \c resultImage, and we invoke \c loadImage() twice to load both the image files in our \e imagecomposition.qrc file. Then, we set the \l{QWidget::setWindowTitle()}{windowTitle} property to "Image Composition". - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 5 + \snippet painting/imagecomposition/imagecomposer.cpp 5 The \c chooseSource() and \c chooseDestination() functions are convenience functions that invoke \c chooseImage() with specific parameters. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 6 + \snippet painting/imagecomposition/imagecomposer.cpp 6 \codeline - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 7 + \snippet painting/imagecomposition/imagecomposer.cpp 7 The \c chooseImage() function loads an image of the user's choice, depending on the \a title, \a image, and \a button. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 10 + \snippet painting/imagecomposition/imagecomposer.cpp 10 The \c recalculateResult() function is used to calculate amd display the result of combining the two images together with the user's choice of composition mode. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 8 + \snippet painting/imagecomposition/imagecomposer.cpp 8 The \c addOp() function adds an item to the \c operatorComboBox using \l{QComboBox}'s \l{QComboBox::addItem()}{addItem} function. This function @@ -135,31 +135,31 @@ rectangle is filled with Qt::Transparent and both the \c sourceImage and \c destinationImage are painted, before displaying it on \c resultLabel. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 9 + \snippet painting/imagecomposition/imagecomposer.cpp 9 The \c loadImage() function paints a transparent background using \l{QPainter::fillRect()}{fillRect()} and draws \c image in a centralized position using \l{QPainter::drawImage()}{drawImage()}. This \c image is then set as the \c{button}'s icon. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 11 + \snippet painting/imagecomposition/imagecomposer.cpp 11 The \c currentMode() function returns the composition mode currently selected in \c operatorComboBox. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 12 + \snippet painting/imagecomposition/imagecomposer.cpp 12 We use the \c imagePos() function to ensure that images loaded onto the QToolButton objects, \c sourceButton and \c destinationButton, are centralized. - \snippet widgets/painting/imagecomposition/imagecomposer.cpp 13 + \snippet painting/imagecomposition/imagecomposer.cpp 13 \section1 The \c main() Function The \c main() function instantiates QApplication and \c ImageComposer and invokes its \l{QWidget::show()}{show()} function. - \snippet widgets/painting/imagecomposition/main.cpp 0 + \snippet painting/imagecomposition/main.cpp 0 */ diff --git a/examples/widgets/doc/interview.qdoc b/examples/widgets/doc/interview.qdoc index 032c9963f5..35721ccfae 100644 --- a/examples/widgets/doc/interview.qdoc +++ b/examples/widgets/doc/interview.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/interview + \example itemviews/interview \title Interview The Interview example explores the flexibility and scalability of the diff --git a/examples/widgets/doc/itemviewspuzzle.qdoc b/examples/widgets/doc/itemviewspuzzle.qdoc index d61ccf3064..ca8288cf1c 100644 --- a/examples/widgets/doc/itemviewspuzzle.qdoc +++ b/examples/widgets/doc/itemviewspuzzle.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/puzzle + \example itemviews/puzzle \title Item Views Puzzle Example The Puzzle example shows how to enable drag and drop with a custom model diff --git a/examples/widgets/doc/licensewizard.qdoc b/examples/widgets/doc/licensewizard.qdoc index 95e985475f..125e0fec8f 100644 --- a/examples/widgets/doc/licensewizard.qdoc +++ b/examples/widgets/doc/licensewizard.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/licensewizard + \example dialogs/licensewizard \title License Wizard Example The License Wizard example shows how to implement complex wizards in @@ -65,7 +65,7 @@ registering their copy of a fictitious software product. Here's the class definition: - \snippet widgets/dialogs/licensewizard/licensewizard.h 1 + \snippet dialogs/licensewizard/licensewizard.h 1 The class's public API is limited to a constructor and an enum. The enum defines the IDs associated with the various pages: @@ -83,30 +83,30 @@ that they must be unique and different from -1. IDs allow us to refer to pages. - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 2 + \snippet dialogs/licensewizard/licensewizard.cpp 2 In the constructor, we create the five pages, insert them into the wizard using QWizard::setPage(), and set \c Page_Intro to be the first page. - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 3 - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 4 + \snippet dialogs/licensewizard/licensewizard.cpp 3 + \snippet dialogs/licensewizard/licensewizard.cpp 4 We set the style to \l{QWizard::}{ModernStyle} on all platforms except Mac OS X, - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 5 - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 6 + \snippet dialogs/licensewizard/licensewizard.cpp 5 + \snippet dialogs/licensewizard/licensewizard.cpp 6 We configure the QWizard to show a \uicontrol Help button, which is connected to our \c showHelp() slot. We also set the \l{QWizard::}{LogoPixmap} for all pages that have a header (i.e., \c EvaluatePage, \c RegisterPage, and \c DetailsPage). - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 9 - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 11 + \snippet dialogs/licensewizard/licensewizard.cpp 9 + \snippet dialogs/licensewizard/licensewizard.cpp 11 \dots - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 13 + \snippet dialogs/licensewizard/licensewizard.cpp 13 In \c showHelp(), we display help texts that are appropriate for the current page. If the user clicks \uicontrol Help twice for the same @@ -120,9 +120,9 @@ Here's the definition and implementation of \c{IntroPage}: - \snippet widgets/dialogs/licensewizard/licensewizard.h 4 + \snippet dialogs/licensewizard/licensewizard.h 4 \codeline - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 16 + \snippet dialogs/licensewizard/licensewizard.cpp 16 A page inherits from QWizardPage. We set a \l{QWizardPage::}{title} and a @@ -132,8 +132,8 @@ to display a watermark pixmap on the first and last pages, and to have a header on the other pages.) - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 17 - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 19 + \snippet dialogs/licensewizard/licensewizard.cpp 17 + \snippet dialogs/licensewizard/licensewizard.cpp 19 The \c nextId() function returns the ID for \c EvaluatePage if the \uicontrol{Evaluate the product for 30 days} option is checked; @@ -143,13 +143,13 @@ The \c EvaluatePage is slightly more involved: - \snippet widgets/dialogs/licensewizard/licensewizard.h 5 + \snippet dialogs/licensewizard/licensewizard.h 5 \codeline - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 20 + \snippet dialogs/licensewizard/licensewizard.cpp 20 \dots - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 21 + \snippet dialogs/licensewizard/licensewizard.cpp 21 \dots - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 22 + \snippet dialogs/licensewizard/licensewizard.cpp 22 First, we set the page's \l{QWizardPage::}{title} and \l{QWizardPage::}{subTitle}. @@ -164,7 +164,7 @@ Resetting the page amounts to clearing the two text fields. - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 23 + \snippet dialogs/licensewizard/licensewizard.cpp 23 The next page is always the \c ConclusionPage. @@ -173,14 +173,14 @@ The \c RegisterPage and \c DetailsPage are very similar to \c EvaluatePage. Let's go directly to the \c ConclusionPage: - \snippet widgets/dialogs/licensewizard/licensewizard.h 6 + \snippet dialogs/licensewizard/licensewizard.h 6 This time, we reimplement QWizardPage::initializePage() and QWidget::setVisible(), in addition to \l{QWizardPage::}{nextId()}. We also declare a private slot: \c printButtonClicked(). - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 18 + \snippet dialogs/licensewizard/licensewizard.cpp 18 The default implementation of QWizardPage::nextId() returns the page with the next ID, or -1 if the current page has the @@ -189,7 +189,7 @@ but to avoid relying on such subtle behavior, we reimplement \l{QWizardPage::}{nextId()} to return -1. - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 27 + \snippet dialogs/licensewizard/licensewizard.cpp 27 We use QWizard::hasVisitedPage() to determine the type of license agreement the user has chosen. If the user filled the \c @@ -199,7 +199,7 @@ upgrade key and skipped the \c DetailsPage, the license text is an Update License Agreement. - \snippet widgets/dialogs/licensewizard/licensewizard.cpp 28 + \snippet dialogs/licensewizard/licensewizard.cpp 28 We want to display a \uicontrol Print button in the wizard when the \c ConclusionPage is up. One way to accomplish this is to reimplement diff --git a/examples/widgets/doc/mainwindow.qdoc b/examples/widgets/doc/mainwindow.qdoc index 4e9e8a0061..b4f6aebed1 100644 --- a/examples/widgets/doc/mainwindow.qdoc +++ b/examples/widgets/doc/mainwindow.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/mainwindow + \example mainwindows/mainwindow \title Main Window The Main Window example shows Qt's extensive support for tool bars, diff --git a/examples/widgets/doc/mdi.qdoc b/examples/widgets/doc/mdi.qdoc index 909fc9b387..e8b1b5c9ef 100644 --- a/examples/widgets/doc/mdi.qdoc +++ b/examples/widgets/doc/mdi.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/mdi + \example mainwindows/mdi \title MDI Example The MDI example shows how to implement a Multiple Document Interface using Qt's diff --git a/examples/widgets/doc/menus.qdoc b/examples/widgets/doc/menus.qdoc index 3a9bb8e6a0..3531e439c1 100644 --- a/examples/widgets/doc/menus.qdoc +++ b/examples/widgets/doc/menus.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/menus + \example mainwindows/menus \title Menus Example The Menus example demonstrates how menus can be used in a main @@ -57,7 +57,7 @@ tool bars, dock widgets and a status bar around a large central widget. - \snippet widgets/mainwindows/menus/mainwindow.h 0 + \snippet mainwindows/menus/mainwindow.h 0 In this example, we will see how to implement pull-down menus as well as a context menu. In order to implement a custom context @@ -65,7 +65,7 @@ {QWidget::}{contextMenuEvent()} function to receive the context menu events for our main window. - \snippet widgets/mainwindows/menus/mainwindow.h 1 + \snippet mainwindows/menus/mainwindow.h 1 We must also implement a collection of private slots to respond to the user activating any of our menu entries. Note that these @@ -73,14 +73,14 @@ i.e., most of them are only displaying the action's path in the main window's central widget. - \snippet widgets/mainwindows/menus/mainwindow.h 2 + \snippet mainwindows/menus/mainwindow.h 2 We have chosen to simplify the constructor by implementing two private convenience functions to create the various actions, to add them to menus and to insert the menus into our main window's menu bar. - \snippet widgets/mainwindows/menus/mainwindow.h 3 + \snippet mainwindows/menus/mainwindow.h 3 Finally, we declare the various menus and actions as well as a simple information label in the application wide scope. @@ -104,9 +104,9 @@ window takes ownership of the widget pointer and deletes it at the appropriate time. - \snippet widgets/mainwindows/menus/mainwindow.cpp 0 + \snippet mainwindows/menus/mainwindow.cpp 0 \codeline - \snippet widgets/mainwindows/menus/mainwindow.cpp 1 + \snippet mainwindows/menus/mainwindow.cpp 1 Then we create the information label as well as a top and bottom filler that we add to a layout which we install on the central @@ -115,7 +115,7 @@ layout with a main window as a parent, is considered an error. You should always set your own layout on the central widget instead. - \snippet widgets/mainwindows/menus/mainwindow.cpp 2 + \snippet mainwindows/menus/mainwindow.cpp 2 To create the actions and menus we call our two convenience functions: \c createActions() and \c createMenus(). We will get @@ -132,7 +132,7 @@ Now, let's take a closer look at the \c createActions() convenience function that creates the various actions: - \snippet widgets/mainwindows/menus/mainwindow.cpp 4 + \snippet mainwindows/menus/mainwindow.cpp 4 \dots A QAction object may contain an icon, a text, a shortcut, a status @@ -151,7 +151,7 @@ The rest of the actions are created in a similar manner. Please see the source code for details. - \snippet widgets/mainwindows/menus/mainwindow.cpp 7 + \snippet mainwindows/menus/mainwindow.cpp 7 Once we have created the \uicontrol {Left Align}, \uicontrol {Right Align}, @@ -169,7 +169,7 @@ function to add the actions to the menus and to insert the menus into the menu bar: - \snippet widgets/mainwindows/menus/mainwindow.cpp 8 + \snippet mainwindows/menus/mainwindow.cpp 8 QMenuBar's \l {QMenuBar::addMenu()}{addMenu()} function appends a new QMenu with the given title, to the menu bar (note that the @@ -189,7 +189,7 @@ returns true, and adds the new action to the menu's list of actions. - \snippet widgets/mainwindows/menus/mainwindow.cpp 12 + \snippet mainwindows/menus/mainwindow.cpp 12 Note the \uicontrol Format menu. First of all, it is added as a submenu to the \uicontrol Edit Menu using QMenu's \l @@ -200,7 +200,7 @@ to the menu separately while the action group does its magic behind the scene. - \snippet widgets/mainwindows/menus/mainwindow.cpp 3 + \snippet mainwindows/menus/mainwindow.cpp 3 To provide a custom context menu, we must reimplement QWidget's \l {QWidget::}{contextMenuEvent()} function to receive the widget's diff --git a/examples/widgets/doc/moveblocks.qdoc b/examples/widgets/doc/moveblocks.qdoc index 074e9d0dca..8c12280989 100644 --- a/examples/widgets/doc/moveblocks.qdoc +++ b/examples/widgets/doc/moveblocks.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/moveblocks + \example animation/moveblocks \title Move Blocks Example The Move Blocks example shows how to animate items in a @@ -62,7 +62,7 @@ After QApplication has been initialized, we set up the QGraphicsScene with its \c{QGraphicsRectWidget}s. - \snippet widgets/animation/moveblocks/main.cpp 1 + \snippet animation/moveblocks/main.cpp 1 After adding the scene to a QGraphicsView, it is time to build the state graph. Let's first look at a statechart of what we are @@ -75,7 +75,7 @@ graph will be examined line-by-line, and will show how the graph works. First off, we construct the \c group state: - \snippet widgets/animation/moveblocks/main.cpp 2 + \snippet animation/moveblocks/main.cpp 2 The timer is used to add a delay between each time the blocks are moved. The timer is started when \c group is entered. As we will @@ -84,9 +84,9 @@ machine, so an animation will be scheduled when the example is started. - \snippet widgets/animation/moveblocks/main.cpp 3 + \snippet animation/moveblocks/main.cpp 3 \dots - \snippet widgets/animation/moveblocks/main.cpp 4 + \snippet animation/moveblocks/main.cpp 4 \c createGeometryState() returns a QState that will set the geometry of our items upon entry. It also assigns \c group as the @@ -98,20 +98,20 @@ properties and the values in the target state. We add animated transitions to the state graph later. - \snippet widgets/animation/moveblocks/main.cpp 5 + \snippet animation/moveblocks/main.cpp 5 We move the items in parallel. Each item is added to \c animationGroup, which is the animation that is inserted into the transitions. - \snippet widgets/animation/moveblocks/main.cpp 6 + \snippet animation/moveblocks/main.cpp 6 The sequential animation group, \c subGroup, helps us insert a delay between the animation of each item. - \snippet widgets/animation/moveblocks/main.cpp 7 + \snippet animation/moveblocks/main.cpp 7 \dots - \snippet widgets/animation/moveblocks/main.cpp 8 + \snippet animation/moveblocks/main.cpp 8 A StateSwitchTransition is added to the state switcher in \c StateSwitcher::addState(). We also add the animation in this @@ -122,7 +122,7 @@ As mentioned previously, we add a transition to the state switcher that triggers when the timer times out. - \snippet widgets/animation/moveblocks/main.cpp 9 + \snippet animation/moveblocks/main.cpp 9 Finally, we can create the state machine, add our initial state, and start execution of the state graph. @@ -132,7 +132,7 @@ In \c createGeometryState(), we set up the geometry for each graphics item. - \snippet widgets/animation/moveblocks/main.cpp 13 + \snippet animation/moveblocks/main.cpp 13 As mentioned before, QAbstractTransition will set up an animation added with \l{QAbstractTransition::}{addAnimation()} using @@ -147,20 +147,20 @@ All functions in \c StateSwitcher are inlined. We'll step through its definition. - \snippet widgets/animation/moveblocks/main.cpp 10 + \snippet animation/moveblocks/main.cpp 10 \c StateSwitcher is a state designed for a particular purpose and will always be a top-level state. We use \c m_stateCount to keep track of how many states we are managing, and \c m_lastIndex to remember which state was the last state to which we transitioned. - \snippet widgets/animation/moveblocks/main.cpp 11 + \snippet animation/moveblocks/main.cpp 11 We select the next state we are going to transition to, and post a \c StateSwitchEvent, which we know will trigger the \c StateSwitchTransition to the selected state. - \snippet widgets/animation/moveblocks/main.cpp 12 + \snippet animation/moveblocks/main.cpp 12 This is where the magic happens. We assign a number to each state added. This number is given to both a StateSwitchTransition and to @@ -174,7 +174,7 @@ let's take a look at its \l{QAbstractTransition::}{eventTest()} function, which is the only function that we define.. - \snippet widgets/animation/moveblocks/main.cpp 14 + \snippet animation/moveblocks/main.cpp 14 \c eventTest is called by QStateMachine when it checks whether a transition should be triggered--a return value of true means that @@ -188,7 +188,7 @@ \c StateSwitcher. We have already seen how it is used to trigger \c{StateSwitchTransition}s in \c StateSwitcher. - \snippet widgets/animation/moveblocks/main.cpp 15 + \snippet animation/moveblocks/main.cpp 15 We only have inlined functions in this class, so a look at its definition will do. @@ -200,7 +200,7 @@ which is the only function we define. Here is the QGraphicsRectWidget class definition: - \snippet widgets/animation/moveblocks/main.cpp 16 + \snippet animation/moveblocks/main.cpp 16 \section1 Moving On diff --git a/examples/widgets/doc/orderform.qdoc b/examples/widgets/doc/orderform.qdoc index 062cc52547..ed40c65093 100644 --- a/examples/widgets/doc/orderform.qdoc +++ b/examples/widgets/doc/orderform.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/richtext/orderform + \example richtext/orderform \title Order Form Example The Order Form example shows how to generate rich text documents by @@ -43,7 +43,7 @@ \c verify() to allow contents of the \c DetailsDialog to be verified later. This is further explained in \c DetailsDialog Implementation. - \snippet widgets/richtext/orderform/detailsdialog.h 0 + \snippet richtext/orderform/detailsdialog.h 0 The constructor of \c DetailsDialog accepts parameters \a title and \a parent. The class defines four \e{getter} functions: \c orderItems(), @@ -72,11 +72,11 @@ \c rejected() signals are connected to the \c verify() and \c reject() slots in \c DetailsDialog. - \snippet widgets/richtext/orderform/detailsdialog.cpp 0 + \snippet richtext/orderform/detailsdialog.cpp 0 A QGridLayout is used to place all the objects on the \c DetailsDialog. - \snippet widgets/richtext/orderform/detailsdialog.cpp 1 + \snippet richtext/orderform/detailsdialog.cpp 1 The \c setupItemsTable() function instantiates the QTableWidget object, \c itemsTable, and sets the number of rows based on the QStringList @@ -88,29 +88,29 @@ \c itemsTable have this value for quantity; but this can be modified by editing the contents of the cells at run time. - \snippet widgets/richtext/orderform/detailsdialog.cpp 2 + \snippet richtext/orderform/detailsdialog.cpp 2 The \c orderItems() function extracts data from the \c itemsTable and returns it in the form of a QList> where each QPair corresponds to an item and the quantity ordered. - \snippet widgets/richtext/orderform/detailsdialog.cpp 3 + \snippet richtext/orderform/detailsdialog.cpp 3 The \c senderName() function is used to return the value of the QLineEdit used to store the name field for the order form. - \snippet widgets/richtext/orderform/detailsdialog.cpp 4 + \snippet richtext/orderform/detailsdialog.cpp 4 The \c senderAddress() function is used to return the value of the QTextEdit containing the address for the order form. - \snippet widgets/richtext/orderform/detailsdialog.cpp 5 + \snippet richtext/orderform/detailsdialog.cpp 5 The \c sendOffers() function is used to return a \c true or \c false value that is used to determine if the customer in the order form wishes to receive more information on the company's offers and promotions. - \snippet widgets/richtext/orderform/detailsdialog.cpp 6 + \snippet richtext/orderform/detailsdialog.cpp 6 The \c verify() function is an additionally implemented slot used to verify the details entered by the user into the \c DetailsDialog. If @@ -118,7 +118,7 @@ providing the user the option to discard the \c DetailsDialog. Otherwise, the details are accepted and the \c accept() function is invoked. - \snippet widgets/richtext/orderform/detailsdialog.cpp 7 + \snippet richtext/orderform/detailsdialog.cpp 7 \section1 MainWindow Definition @@ -126,7 +126,7 @@ slots - \c openDialog() and \c printFile(). It also contains a private instance of QTabWidget, \c letters. - \snippet widgets/richtext/orderform/mainwindow.h 0 + \snippet richtext/orderform/mainwindow.h 0 \section1 MainWindow Implementation @@ -136,20 +136,20 @@ and the default close() slot. The QTabWidget, \c letters, is instantiated and set as the window's central widget. - \snippet widgets/richtext/orderform/mainwindow.cpp 0 + \snippet richtext/orderform/mainwindow.cpp 0 The \c createLetter() function creates a new QTabWidget with a QTextEdit, \c editor, as the parent. This function accepts four parameters that correspond to we obtained through \c DetailsDialog, in order to "fill" the \c editor. - \snippet widgets/richtext/orderform/mainwindow.cpp 1 + \snippet richtext/orderform/mainwindow.cpp 1 We then obtain the cursor for the \c editor using QTextEdit::textCursor(). The \c cursor is then moved to the start of the document using QTextCursor::Start. - \snippet widgets/richtext/orderform/mainwindow.cpp 2 + \snippet richtext/orderform/mainwindow.cpp 2 Recall the structure of a \l{Rich Text Document Structure} {Rich Text Document}, where sequences of frames and @@ -180,7 +180,7 @@ This is accomplished with the following code: - \snippet widgets/richtext/orderform/mainwindow.cpp 3 + \snippet richtext/orderform/mainwindow.cpp 3 Note that \c topFrame is the \c {editor}'s top-level frame and is not shown in the document structure. @@ -189,7 +189,7 @@ \c topFrame and fill in the customer's name (provided by the constructor) and address - using a \c foreach loop to traverse the QString, \c address. - \snippet widgets/richtext/orderform/mainwindow.cpp 4 + \snippet richtext/orderform/mainwindow.cpp 4 The \c cursor is now back in \c topFrame and the document structure for the above portion of code is: @@ -209,12 +209,12 @@ {setWidth()} to increase the width of \c bodyFrameFormat and we insert a new frame with that width. - \snippet widgets/richtext/orderform/mainwindow.cpp 5 + \snippet richtext/orderform/mainwindow.cpp 5 The following code inserts standard text into the order form. - \snippet widgets/richtext/orderform/mainwindow.cpp 6 - \snippet widgets/richtext/orderform/mainwindow.cpp 7 + \snippet richtext/orderform/mainwindow.cpp 6 + \snippet richtext/orderform/mainwindow.cpp 7 This part of the document structure now contains the date, a frame with \c bodyFrameFormat, as well as the standard text. @@ -241,17 +241,17 @@ A QTextTableFormat object, \c orderTableFormat, is used to hold the type of item and the quantity ordered. - \snippet widgets/richtext/orderform/mainwindow.cpp 8 + \snippet richtext/orderform/mainwindow.cpp 8 We use \l{QTextTable::cellAt()}{cellAt()} to set the headers for the \c orderTable. - \snippet widgets/richtext/orderform/mainwindow.cpp 9 + \snippet richtext/orderform/mainwindow.cpp 9 Then, we iterate through the QList of QPair objects to populate \c orderTable. - \snippet widgets/richtext/orderform/mainwindow.cpp 10 + \snippet richtext/orderform/mainwindow.cpp 10 The resulting document structure for this section is: @@ -284,13 +284,13 @@ \l{QTextFrame::lastPosition()}{lastPosition()} and more standard text is inserted. - \snippet widgets/richtext/orderform/mainwindow.cpp 11 - \snippet widgets/richtext/orderform/mainwindow.cpp 12 + \snippet richtext/orderform/mainwindow.cpp 11 + \snippet richtext/orderform/mainwindow.cpp 12 Another QTextTable is inserted, to display the customer's preference regarding offers. - \snippet widgets/richtext/orderform/mainwindow.cpp 13 + \snippet richtext/orderform/mainwindow.cpp 13 The document structure for this portion is: @@ -315,7 +315,7 @@ name. More blocks are inserted for spacing purposes. The \c printAction is enabled to indicate that an order form can now be printed. - \snippet widgets/richtext/orderform/mainwindow.cpp 14 + \snippet richtext/orderform/mainwindow.cpp 14 The bottom portion of the document structure is: @@ -337,18 +337,18 @@ The \c createSample() function is used for illustration purposes, to create a sample order form. - \snippet widgets/richtext/orderform/mainwindow.cpp 15 + \snippet richtext/orderform/mainwindow.cpp 15 The \c openDialog() function opens a \c DetailsDialog object. If the details in \c dialog are accepted, the \c createLetter() function is invoked using the parameters extracted from \c dialog. - \snippet widgets/richtext/orderform/mainwindow.cpp 16 + \snippet richtext/orderform/mainwindow.cpp 16 In order to print out the order form, a \c printFile() function is included, as shown below: - \snippet widgets/richtext/orderform/mainwindow.cpp 17 + \snippet richtext/orderform/mainwindow.cpp 17 This function also allows the user to print a selected area with QTextCursor::hasSelection(), instead of printing the entire document. @@ -359,6 +359,6 @@ 640x480 pixels before invoking the \c show() function and \c createSample() function. - \snippet widgets/richtext/orderform/main.cpp 0 + \snippet richtext/orderform/main.cpp 0 */ diff --git a/examples/widgets/doc/padnavigator.qdoc b/examples/widgets/doc/padnavigator.qdoc index dc924ecd65..8b1da516b5 100644 --- a/examples/widgets/doc/padnavigator.qdoc +++ b/examples/widgets/doc/padnavigator.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/graphicsview/padnavigator + \example graphicsview/padnavigator \title Pad Navigator Example The Pad Navigator Example shows how you can use Graphics View together with @@ -60,7 +60,7 @@ Let's start by reviewing the \c RoundRectItem class declaration. - \snippet widgets/graphicsview/padnavigator/roundrectitem.h 0 + \snippet graphicsview/padnavigator/roundrectitem.h 0 \c RoundRectItem inherits QGraphicsObject, which makes it easy to control its properties using QPropertyAnimation. Its constructor takes a rectangle @@ -76,7 +76,7 @@ Otherwise the contents are filled using a gradient based on the color passed to \c RoundRectItem's constructor. - \snippet widgets/graphicsview/padnavigator/roundrectitem.h 1 + \snippet graphicsview/padnavigator/roundrectitem.h 1 The private data members are: @@ -91,7 +91,7 @@ We will now review the \c RoundRectItem implementation. Let's start by looking at its constructor: - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 0 + \snippet graphicsview/padnavigator/roundrectitem.cpp 0 The constructor initializes its member variables and forwards the \c parent argument to QGraphicsObject's constructor. It then constructs the linear @@ -110,24 +110,24 @@ remains persistent as we move and transform the item. This mode is ideal for this example, and works particularly well with OpenGL and OpenGL ES. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 1 + \snippet graphicsview/padnavigator/roundrectitem.cpp 1 The \c pixmap property implementation simple returns the member pixmap, or sets it and then calls \l{QGraphicsItem::update()}{update()}. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 2 + \snippet graphicsview/padnavigator/roundrectitem.cpp 2 As the \l{QGraphicsItem::paint()}{paint()} implementation below draws a simple drop shadow down and to the right of the item, we return a slightly adjusted rectangle from \l{QGraphicsItem::boundingRect()}{boundingRect()}. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 3 + \snippet graphicsview/padnavigator/roundrectitem.cpp 3 The \l{QGraphicsItem::paint()}{paint()} implementation starts by rendering a semi transparent black round rectangle drop shadow, two units down and to the right of the main item. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 4 + \snippet graphicsview/padnavigator/roundrectitem.cpp 4 We then draw the "foreground" round rectangle itself. The fill depends on the \c fill property; if true, we will with a plain QPalette::Window color. @@ -135,14 +135,14 @@ unit wide pen for the stroke, assign the brush, and then draw the rectangle. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 5 + \snippet graphicsview/padnavigator/roundrectitem.cpp 5 If a pixmap has been assigned to the \e pixmap property, we draw this pixmap in the center of the rectangle item. The pixmaps are scaled to match the size of the icons; in arguably a better approach would have been to store the icons with the right size in the first places. - \snippet widgets/graphicsview/padnavigator/roundrectitem.cpp 6 + \snippet graphicsview/padnavigator/roundrectitem.cpp 6 Finally, for completeness we include the \c fill property implementation. It returns the \c fill member variable's value, and when assigned to, it @@ -157,7 +157,7 @@ \c FlippablePad is, in addition to its inherited \c RoundRectItem responsibilities, responsible for creating and managing a grid of icons. - \snippet widgets/graphicsview/padnavigator/flippablepad.h 0 + \snippet graphicsview/padnavigator/flippablepad.h 0 Its declaration is very simple: It inherits \c RoundRectItem and does not need any special polymorphic behavior. It's suitable to declare its own @@ -175,26 +175,26 @@ starts with two helper functions: \c boundsFromSize() and \c posForLocation(): - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 0 + \snippet graphicsview/padnavigator/flippablepad.cpp 0 \c boundsForSize() takes a QSize argument, and returns the bounding rectangle of the flippable pad item. The QSize determines how many rows and columns the icon grid should have. Each icon is given 150x150 units of space, and this determines the bounds. - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 1 + \snippet graphicsview/padnavigator/flippablepad.cpp 1 \c posForLocation() returns the position of an icon given its row and column position. Like \c boundsForSize(), the function assumes each icon is given 150x150 units of space, and that all icons are centered around the flippable pad item's origin (0, 0). - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 2 + \snippet graphicsview/padnavigator/flippablepad.cpp 2 The \c FlippablePad constructor passes suitable bounds (using \c boundsForSize()) and specific color to \c RoundRectItem's constructor. - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 3 + \snippet graphicsview/padnavigator/flippablepad.cpp 3 It then loads pixmaps from compiled-in resources to use for its icons. QDirIterator is very useful in this context, as it allows us to fetch all @@ -203,7 +203,7 @@ We also make sure not to load more pixmaps than we need. - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 4 + \snippet graphicsview/padnavigator/flippablepad.cpp 4 Now that we have the pixmaps, we can create icons, position then and assign pixmaps. We start by finding a suitable size and color for the icons, and @@ -222,7 +222,7 @@ natural to assign the pixmaps directly, or that the icons themselves provide suitable pixmaps. - \snippet widgets/graphicsview/padnavigator/flippablepad.cpp 5 + \snippet graphicsview/padnavigator/flippablepad.cpp 5 Finally, the \c iconAt() function returns a pointer to the icon at a specific row and column. It makes a somewhat bold assumption that the input @@ -238,7 +238,7 @@ started, and disappears after pressing any key. The animation is controlled by \c PadNavigator; this class is very simple by itself. - \snippet widgets/graphicsview/padnavigator/splashitem.h 0 + \snippet graphicsview/padnavigator/splashitem.h 0 The class declaration shows that \c SplashItem inherits QGraphicsObject to allow it to be controlled by QPropertyAnimation. It reimplements the @@ -249,7 +249,7 @@ Let's look at its implementation. - \snippet widgets/graphicsview/padnavigator/splashitem.cpp 0 + \snippet graphicsview/padnavigator/splashitem.cpp 0 The constructor forwards to QGraphicsObject as expected, assigns a text message to the \c text member variable, and enables @@ -263,11 +263,11 @@ We use caching to avoid having to relayout and rerender the text for each frame. An alterative approach would be to use the new QStaticText class. - \snippet widgets/graphicsview/padnavigator/splashitem.cpp 1 + \snippet graphicsview/padnavigator/splashitem.cpp 1 \c SplashItem's bounding rectangle is fixed at (400x175). - \snippet widgets/graphicsview/padnavigator/splashitem.cpp 2 + \snippet graphicsview/padnavigator/splashitem.cpp 2 The \l{QGraphicsItem::paint()}{paint()} implementation draws a clipped round rectangle with a thick 2-unit border and a semi-transparent white @@ -284,7 +284,7 @@ application. It creates and controls a somewhat complex state machine, and several animations. Its class declaration is very simple: - \snippet widgets/graphicsview/padnavigator/padnavigator.h 0 + \snippet graphicsview/padnavigator/padnavigator.h 0 It inherits QGraphicsView and reimplements only one function: \l{QGraphicsView::resizeEvent()}{resizeEvent()}, to ensure the scene is @@ -296,7 +296,7 @@ It also keeps a private member instance, \c form, which is the generated code for the pad's back side item's QGraphicsProxyWidget-embedded form. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 0 + \snippet graphicsview/padnavigator/padnavigator.cpp 0 \c PadNavigator's constructor is a bit long. In short, its job is to create all items, including the \c FlippablePad, the \c SplashItem and the @@ -305,13 +305,13 @@ It starts out simple, by forwarding to QGraphicsView's constructor. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 1 + \snippet graphicsview/padnavigator/padnavigator.cpp 1 The first item to be created is \c SplashItem. This is going to be a top-level item in the scene, next to \c FlippablePad, and stacked on top of it, so we assign it a \l{QGraphicsItem::zValue()}{Z-value} of 1. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 2 + \snippet graphicsview/padnavigator/padnavigator.cpp 2 Now we construct the \c FlippablePad item, passing its column-row count to its constructor. @@ -334,7 +334,7 @@ The combination of all three rotations is assigned via QGraphicsItem::setTransformations(). - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 3 + \snippet graphicsview/padnavigator/padnavigator.cpp 3 Now we construct the QGraphicsProxyWidget-embedded \c backItem. The proxy widget is created as a child of the pad. We create a new QWidget and @@ -353,7 +353,7 @@ We enable \l{QGraphicsItem::ItemCoordinateCache}{ItemCoordinateCache} to ensure the flip animation can run smoothly. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 4 + \snippet graphicsview/padnavigator/padnavigator.cpp 4 We now create the selection item. This is simply another instance of \c RoundRectItem that is slightly larger than the icons on the pad. We create @@ -364,7 +364,7 @@ What follows now is a series of animation initializations. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 5 + \snippet graphicsview/padnavigator/padnavigator.cpp 5 We begin with the animations that apply to the splash item. The first animation, \c smoothSplashMove, ensures that the "y" property of \c splash @@ -375,14 +375,14 @@ The values are assigned by \c PadNavigator's state machine, which is created later. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 6 + \snippet graphicsview/padnavigator/padnavigator.cpp 6 These are the animations that control the selection item's movement and the \c xRotation and \c yRotation QGraphicsRotation objects that tilt the pad. All animations have a duration of 125 milliseconds, and they all use the \l{QEasingCurve::InOutQuad}{InOutQuad} easing function. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 7 + \snippet graphicsview/padnavigator/padnavigator.cpp 7 We now create the animations that control the flip-effect when you press the enter key. The main goal is to rotate the pad by 180 degrees or back, @@ -407,7 +407,7 @@ duration, or 250 milliseconds, the pad will be scaled down to 0.7x of its original size, which gives a great visual effect while flipping. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 8 + \snippet graphicsview/padnavigator/padnavigator.cpp 8 This section uses a trick to ensure that certain properties are assigned precisely when the flip animation passes 50%, or 90 degrees, rotation. In @@ -424,7 +424,7 @@ This approach can also be used to call functions or set any other properties at a specific time while an animation is running. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 9 + \snippet graphicsview/padnavigator/padnavigator.cpp 9 We will now create the state machine. The whole \c PadNavigator state machinery is controlled by one single state machine that has a @@ -440,7 +440,7 @@ can interact with the QGraphicsProxyWidget-embedded form. \endlist - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 10 + \snippet graphicsview/padnavigator/padnavigator.cpp 10 Each state assigns specific properties to objects on entry. Most interesting perhaps is the assignment of the value 0.0 to the pad's \c @@ -454,7 +454,7 @@ before we start the state engine. We proceed with creating some transitions. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 11 + \snippet graphicsview/padnavigator/padnavigator.cpp 11 QEventTransition defines a very flexible transition type. You can use this class to trigger a transition based on an object receiving an event of a @@ -465,7 +465,7 @@ We register the \c splashItem's animations to this transition to ensure they are used to animate the item's movement and opacity. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 12 + \snippet graphicsview/padnavigator/padnavigator.cpp 12 We use QKeyEventTransition to capture specific key events. In this case, we detect that the user presses Qt::Key_Return or Qt::Key_Enter, and use this @@ -475,7 +475,7 @@ We continue by defining the states for each of the icons in the grid. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 13 + \snippet graphicsview/padnavigator/padnavigator.cpp 13 We will use state groups to control transitions between icons. Each icon represents a \e substate of \c frontState. We will then define transitions @@ -491,7 +491,7 @@ substate. We initialze the selection item's position to be exactly where the top-left icon is. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 14 + \snippet graphicsview/padnavigator/padnavigator.cpp 14 We can now create four transitions for each icon. Each transition ensures that we move to the state corresponding to which arrow key has been @@ -499,7 +499,7 @@ specific transitions to and from each of the sub states depending on these and other keys. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 15 + \snippet graphicsview/padnavigator/padnavigator.cpp 15 Also, for each of the icons, we assign suitable values to the \c xRotation and \c yRotation objects' "angle"-properties. If you recall, these @@ -509,7 +509,7 @@ assigned at the right time, we add property-controlling animations to the \c setVariableSequence animation defined earlier. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 16 + \snippet graphicsview/padnavigator/padnavigator.cpp 16 We are now finished with all states, transitions, and animations. We now create the scene that will contain all our items. The scene gets a defined @@ -521,12 +521,12 @@ Then the scene is assigned to the view, or in our case, \c PadNavigator itself. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 17 + \snippet graphicsview/padnavigator/padnavigator.cpp 17 Now that the scene has received its final size, we can position the splash item at the very top, find its fade-out position, and add it to the scene. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 18 + \snippet graphicsview/padnavigator/padnavigator.cpp 18 The view toggles a few necessary properties: @@ -547,7 +547,7 @@ Finally, we start the state engine. - \snippet widgets/graphicsview/padnavigator/padnavigator.cpp 19 + \snippet graphicsview/padnavigator/padnavigator.cpp 19 The \l{QGraphicsView::resizeEvent()}{resizeEvent()} implementation calls the base implementation, and then calls QGraphicsView::fitInView() to scale @@ -559,7 +559,7 @@ \section1 The main() Function - \snippet widgets/graphicsview/padnavigator/main.cpp 0 + \snippet graphicsview/padnavigator/main.cpp 0 The \c main function creates the QApplication instance, uses Q_INIT_RESOURCE to ensure our compiled-in resources aren't removed by the diff --git a/examples/widgets/doc/painterpaths.qdoc b/examples/widgets/doc/painterpaths.qdoc index cc3ccf312d..45b0697cee 100644 --- a/examples/widgets/doc/painterpaths.qdoc +++ b/examples/widgets/doc/painterpaths.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/painterpaths + \example painting/painterpaths \title Painter Paths Example The Painter Paths example shows how painter paths can be used to @@ -66,7 +66,7 @@ user to manipulate the painter paths' filling, pen, color and rotation angle. - \snippet widgets/painting/painterpaths/window.h 0 + \snippet painting/painterpaths/window.h 0 We declare three private slots to respond to user input regarding filling and color: \c fillRuleChanged(), \c fillGradientChanged() @@ -80,14 +80,14 @@ argument; so we need to retrieve the new value, or values, before we can update the \c RenderArea widgets. - \snippet widgets/painting/painterpaths/window.h 1 + \snippet painting/painterpaths/window.h 1 We also declare a couple of private convenience functions: \c populateWithColors() populates a given QComboBox with items corresponding to the color names Qt knows about, and \c currentItemData() returns the current item for a given QComboBox. - \snippet widgets/painting/painterpaths/window.h 2 + \snippet painting/painterpaths/window.h 2 Then we declare the various components of the main window widget. We also declare a convenience constant specifying the @@ -98,13 +98,13 @@ In the implementation of the \c Window class we first declare the constant \c Pi with six significant figures: - \snippet widgets/painting/painterpaths/window.cpp 0 + \snippet painting/painterpaths/window.cpp 0 In the constructor, we then define the various painter paths and create corresponding \c RenderArea widgets which will render the graphical shapes: - \snippet widgets/painting/painterpaths/window.cpp 1 + \snippet painting/painterpaths/window.cpp 1 We construct a rectangle with sharp corners using the QPainterPath::moveTo() and QPainterPath::lineTo() @@ -135,7 +135,7 @@ painter path's current position after the rect has been added is at the top-left corner of the rectangle. - \snippet widgets/painting/painterpaths/window.cpp 2 + \snippet painting/painterpaths/window.cpp 2 Then we construct a rectangle with rounded corners. As before, we use the QPainterPath::moveTo() and QPainterPath::lineTo() @@ -150,7 +150,7 @@ current point to the starting point of the arc if they are not already connected. - \snippet widgets/painting/painterpaths/window.cpp 3 + \snippet painting/painterpaths/window.cpp 3 We also use the QPainterPath::arcTo() function to construct the ellipse path. First we move the current point starting a new @@ -164,7 +164,7 @@ is composed of a clockwise curve, starting and finishing at zero degrees (the 3 o'clock position). - \snippet widgets/painting/painterpaths/window.cpp 4 + \snippet painting/painterpaths/window.cpp 4 When constructing the pie chart path we continue to use a combination of the mentioned functions: First we move the current @@ -173,7 +173,7 @@ the subpath, we implicitly construct the last line back to the center of the chart. - \snippet widgets/painting/painterpaths/window.cpp 5 + \snippet painting/painterpaths/window.cpp 5 Constructing a polygon is equivalent to constructing a rectangle. @@ -182,7 +182,7 @@ new subpath. Current position after the polygon has been added is the last point in polygon. - \snippet widgets/painting/painterpaths/window.cpp 6 + \snippet painting/painterpaths/window.cpp 6 Then we create a path consisting of a group of subpaths: First we move the current point, and create a circle using the @@ -201,7 +201,7 @@ QPainterPath::addPath() which adds a given path to the path that calls the function. - \snippet widgets/painting/painterpaths/window.cpp 7 + \snippet painting/painterpaths/window.cpp 7 When creating the text path, we first create the font. Then we set the font's style strategy which tells the font matching algorithm @@ -214,7 +214,7 @@ that the left end of the text's baseline lies at the specified point. - \snippet widgets/painting/painterpaths/window.cpp 8 + \snippet painting/painterpaths/window.cpp 8 To create the Bezier path, we use the QPainterPath::cubicTo() function which adds a Bezier curve between the current point and @@ -228,21 +228,21 @@ when filling the path as can be seen in the applications main window. - \snippet widgets/painting/painterpaths/window.cpp 9 + \snippet painting/painterpaths/window.cpp 9 The final path that we construct shows that you can use QPainterPath to construct rather complex shapes using only the previous mentioned QPainterPath::moveTo(), QPainterPath::lineTo() and QPainterPath::closeSubpath() functions. - \snippet widgets/painting/painterpaths/window.cpp 10 + \snippet painting/painterpaths/window.cpp 10 Now that we have created all the painter paths that we need, we create a corresponding \c RenderArea widget for each. In the end, we make sure that the number of render areas is correct using the Q_ASSERT() macro. - \snippet widgets/painting/painterpaths/window.cpp 11 + \snippet painting/painterpaths/window.cpp 11 Then we create the widgets associated with the painter paths' fill rule. @@ -264,12 +264,12 @@ The Qt::WindingFill rule can in most cases be considered as the intersection of closed shapes. - \snippet widgets/painting/painterpaths/window.cpp 12 + \snippet painting/painterpaths/window.cpp 12 We also create the other widgets associated with the filling, the pen and the rotation angle. - \snippet widgets/painting/painterpaths/window.cpp 16 + \snippet painting/painterpaths/window.cpp 16 We connect the comboboxes \l {QComboBox::activated()}{activated()} signals to the associated slots in the \c Window class, while we @@ -277,23 +277,23 @@ {QSpinBox::valueChanged()}{valueChanged()} signal directly to the \c RenderArea widget's respective slots. - \snippet widgets/painting/painterpaths/window.cpp 17 + \snippet painting/painterpaths/window.cpp 17 We add the \c RenderArea widgets to a separate layout which we then add to the main layout along with the rest of the widgets. - \snippet widgets/painting/painterpaths/window.cpp 18 + \snippet painting/painterpaths/window.cpp 18 Finally, we initialize the \c RenderArea widgets by calling the \c fillRuleChanged(), \c fillGradientChanged() and \c penColorChanged() slots, and we set the initial pen width and window title. - \snippet widgets/painting/painterpaths/window.cpp 19 + \snippet painting/painterpaths/window.cpp 19 \codeline - \snippet widgets/painting/painterpaths/window.cpp 20 + \snippet painting/painterpaths/window.cpp 20 \codeline - \snippet widgets/painting/painterpaths/window.cpp 21 + \snippet painting/painterpaths/window.cpp 21 The private slots are implemented to retrieve the new value, or values, from the associated comboboxes and update the RenderArea @@ -304,13 +304,13 @@ function. Then we call the associated slot for each of the \c RenderArea widgets to update the painter paths. - \snippet widgets/painting/painterpaths/window.cpp 22 + \snippet painting/painterpaths/window.cpp 22 The \c populateWithColors() function populates the given combobox with items corresponding to the color names Qt knows about provided by the static QColor::colorNames() function. - \snippet widgets/painting/painterpaths/window.cpp 23 + \snippet painting/painterpaths/window.cpp 23 The \c currentItemData() function simply return the current item of the given combobox. @@ -320,7 +320,7 @@ The \c RenderArea class inherits QWidget, and is a custom widget displaying a single painter path. - \snippet widgets/painting/painterpaths/renderarea.h 0 + \snippet painting/painterpaths/renderarea.h 0 We declare several public slots updating the \c RenderArea widget's associated painter path. In addition we reimplement the @@ -329,7 +329,7 @@ application, and we reimplement the QWidget::paintEvent() event handler to draw its painter path. - \snippet widgets/painting/painterpaths/renderarea.h 1 + \snippet painting/painterpaths/renderarea.h 1 Each instance of the \c RenderArea class has a QPainterPath, a couple of fill colors, a pen width, a pen color and a rotation @@ -340,7 +340,7 @@ The constructor takes a QPainterPath as argument (in addition to the optional QWidget parent): - \snippet widgets/painting/painterpaths/renderarea.cpp 0 + \snippet painting/painterpaths/renderarea.cpp 0 In the constructor we initialize the \c RenderArea widget with the QPainterPath parameter as well as initializing the pen width and @@ -348,23 +348,23 @@ {QWidget::backgroundRole()}{background role}; QPalette::Base is typically white. - \snippet widgets/painting/painterpaths/renderarea.cpp 1 + \snippet painting/painterpaths/renderarea.cpp 1 \codeline - \snippet widgets/painting/painterpaths/renderarea.cpp 2 + \snippet painting/painterpaths/renderarea.cpp 2 Then we reimplement the QWidget::minimumSizeHint() and QWidget::sizeHint() functions to give the \c RenderArea widget a reasonable size within our application. - \snippet widgets/painting/painterpaths/renderarea.cpp 3 + \snippet painting/painterpaths/renderarea.cpp 3 \codeline - \snippet widgets/painting/painterpaths/renderarea.cpp 4 + \snippet painting/painterpaths/renderarea.cpp 4 \codeline - \snippet widgets/painting/painterpaths/renderarea.cpp 5 + \snippet painting/painterpaths/renderarea.cpp 5 \codeline - \snippet widgets/painting/painterpaths/renderarea.cpp 6 + \snippet painting/painterpaths/renderarea.cpp 6 \codeline - \snippet widgets/painting/painterpaths/renderarea.cpp 7 + \snippet painting/painterpaths/renderarea.cpp 7 The various public slots updates the \c RenderArea widget's painter path by setting the associated property and make a call to @@ -375,7 +375,7 @@ instead it schedules a paint event for processing when Qt returns to the main event loop. - \snippet widgets/painting/painterpaths/renderarea.cpp 8 + \snippet painting/painterpaths/renderarea.cpp 8 A paint event is a request to repaint all or parts of the widget. The paintEvent() function is an event handler that can be @@ -390,7 +390,7 @@ should anti-alias the edges of primitives if possible, i.e. put additional pixels around the original ones to smooth the edges. - \snippet widgets/painting/painterpaths/renderarea.cpp 9 + \snippet painting/painterpaths/renderarea.cpp 9 Then we scale the QPainter's coordinate system to ensure that the painter path is rendered in the right size, i.e that it grows with @@ -407,7 +407,7 @@ performed the rotation, we must remember to translate the coordinate system back again. - \snippet widgets/painting/painterpaths/renderarea.cpp 10 + \snippet painting/painterpaths/renderarea.cpp 10 Then we set the QPainter's pen with the instance's rendering preferences. We create a QLinearGradient and set its colors diff --git a/examples/widgets/doc/pathstroke.qdoc b/examples/widgets/doc/pathstroke.qdoc index eea9704047..89a0182934 100644 --- a/examples/widgets/doc/pathstroke.qdoc +++ b/examples/widgets/doc/pathstroke.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/pathstroke + \example painting/pathstroke \title Path Stroking In this example we show some of the various types of pens that can be diff --git a/examples/widgets/doc/pingpong.qdoc b/examples/widgets/doc/pingpong.qdoc index 7594c87c68..c56085d8cf 100644 --- a/examples/widgets/doc/pingpong.qdoc +++ b/examples/widgets/doc/pingpong.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/statemachine/pingpong + \example statemachine/pingpong \title Ping Pong States Example The Ping Pong States example shows how to use parallel states together @@ -48,35 +48,35 @@ ponger state will respond by posting a \c pong event; this will cause the \c pinger state to post a new \c ping event; and so on. - \snippet widgets/statemachine/pingpong/main.cpp 0 + \snippet statemachine/pingpong/main.cpp 0 Two custom events are defined, \c PingEvent and \c PongEvent. - \snippet widgets/statemachine/pingpong/main.cpp 1 + \snippet statemachine/pingpong/main.cpp 1 The \c Pinger class defines a state that posts a \c PingEvent to the state machine when the state is entered. - \snippet widgets/statemachine/pingpong/main.cpp 2 + \snippet statemachine/pingpong/main.cpp 2 The \c PingTransition class defines a transition that is triggered by events of type \c PingEvent, and that posts a \c PongEvent (with a delay of 500 milliseconds) to the state machine when the transition is triggered. - \snippet widgets/statemachine/pingpong/main.cpp 3 + \snippet statemachine/pingpong/main.cpp 3 The \c PongTransition class defines a transition that is triggered by events of type \c PongEvent, and that posts a \c PingEvent (with a delay of 500 milliseconds) to the state machine when the transition is triggered. - \snippet widgets/statemachine/pingpong/main.cpp 4 + \snippet statemachine/pingpong/main.cpp 4 The main() function begins by creating a state machine and a parallel state group. - \snippet widgets/statemachine/pingpong/main.cpp 5 + \snippet statemachine/pingpong/main.cpp 5 Next, the \c pinger and \c ponger states are created, with the parallel state group as their parent state. Note that the transitions are \e @@ -85,7 +85,7 @@ be called, and the state machine's configuration will remain the same, which is precisely what we want in this case. - \snippet widgets/statemachine/pingpong/main.cpp 6 + \snippet statemachine/pingpong/main.cpp 6 Finally, the group is added to the state machine, the machine is started, and the application event loop is entered. diff --git a/examples/widgets/doc/pixelator.qdoc b/examples/widgets/doc/pixelator.qdoc index a44feb61fc..099c382c82 100644 --- a/examples/widgets/doc/pixelator.qdoc +++ b/examples/widgets/doc/pixelator.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/pixelator + \example itemviews/pixelator \title Pixelator Example The Pixelator example shows how delegates can be used to customize the way that @@ -60,7 +60,7 @@ The \c ImageModel class is defined as follows: - \snippet widgets/itemviews/pixelator/imagemodel.h 0 + \snippet itemviews/pixelator/imagemodel.h 0 Since we only require a simple, read-only table model, we only need to implement functions to indicate the dimensions of the image and supply data to other @@ -70,11 +70,11 @@ The constructor is trivial: - \snippet widgets/itemviews/pixelator/imagemodel.cpp 0 + \snippet itemviews/pixelator/imagemodel.cpp 0 The \c setImage() function sets the image that will be used by the model: - \snippet widgets/itemviews/pixelator/imagemodel.cpp 1 + \snippet itemviews/pixelator/imagemodel.cpp 1 The QAbstractItemModel::reset() call tells the view(s) that the model has changed. @@ -82,8 +82,8 @@ The \c rowCount() and \c columnCount() functions return the height and width of the image respectively: - \snippet widgets/itemviews/pixelator/imagemodel.cpp 2 - \snippet widgets/itemviews/pixelator/imagemodel.cpp 3 + \snippet itemviews/pixelator/imagemodel.cpp 2 + \snippet itemviews/pixelator/imagemodel.cpp 3 Since the image is a simple two-dimensional structure, the \c parent arguments to these functions are unused. They both simply return the relevant size from @@ -92,7 +92,7 @@ The \c data() function returns data for the item that corresponds to a given model index in a format that is suitable for a particular role: - \snippet widgets/itemviews/pixelator/imagemodel.cpp 4 + \snippet itemviews/pixelator/imagemodel.cpp 4 In this implementation, we only check that the model index is valid, and that the role requested is the \l{Qt::ItemDataRole}{DisplayRole}. If so, the function @@ -105,7 +105,7 @@ The \c headerData() function is also reimplemented: - \snippet widgets/itemviews/pixelator/imagemodel.cpp 5 + \snippet itemviews/pixelator/imagemodel.cpp 5 We return (1, 1) as the size hint for a header item. If we didn't, the headers would default to a larger size, preventing @@ -116,7 +116,7 @@ The \c PixelDelegate class is defined as follows: - \snippet widgets/itemviews/pixelator/pixeldelegate.h 0 + \snippet itemviews/pixelator/pixeldelegate.h 0 This class provides only basic features for a delegate so, unlike the \l{Spin Box Delegate Example}{Spin Box Delegate} example, we subclass @@ -134,7 +134,7 @@ also called to ensure that the delegate is set up with a parent object, if one is supplied: - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 0 + \snippet itemviews/pixelator/pixeldelegate.cpp 0 Each item is rendered by the delegate's \l{QAbstractItemDelegate::paint()}{paint()} function. The view calls this @@ -142,7 +142,7 @@ delegate should use to correctly draw the item, and an index to the item in the model: - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 1 + \snippet itemviews/pixelator/pixeldelegate.cpp 1 The first task the delegate has to perform is to draw the item's background correctly. Usually, selected items appear differently to non-selected items, @@ -151,8 +151,8 @@ The radius of each circle is calculated in the following lines of code: - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 3 - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 4 + \snippet itemviews/pixelator/pixeldelegate.cpp 3 + \snippet itemviews/pixelator/pixeldelegate.cpp 4 First, the largest possible radius of the circle is determined by taking the smallest dimension of the style option's \c rect attribute. @@ -161,22 +161,22 @@ scaling the brightness to fit within the item and subtracting it from the largest possible radius. - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 5 - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 6 - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 7 + \snippet itemviews/pixelator/pixeldelegate.cpp 5 + \snippet itemviews/pixelator/pixeldelegate.cpp 6 + \snippet itemviews/pixelator/pixeldelegate.cpp 7 We save the painter's state, turn on antialiasing (to obtain smoother curves), and turn off the pen. - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 8 - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 9 + \snippet itemviews/pixelator/pixeldelegate.cpp 8 + \snippet itemviews/pixelator/pixeldelegate.cpp 9 The foreground of the item (the circle representing a pixel) must be rendered using an appropriate brush. For unselected items, we will use a solid black brush; selected items are drawn using a predefined brush from the style option's palette. - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 10 + \snippet itemviews/pixelator/pixeldelegate.cpp 10 Finally, we paint the circle within the rectangle specified by the style option and we call \l{QPainter::}{restore()} on the painter. @@ -191,12 +191,12 @@ returns a size for the item based on the predefined pixel size, initially set up in the constructor: - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 11 + \snippet itemviews/pixelator/pixeldelegate.cpp 11 The delegate's size is updated whenever the pixel size is changed. We provide a custom slot to do this: - \snippet widgets/itemviews/pixelator/pixeldelegate.cpp 12 + \snippet itemviews/pixelator/pixeldelegate.cpp 12 \section1 Using The Custom Delegate @@ -210,9 +210,9 @@ In the constructor, we set up a table view, turn off its grid, and hide its headers: - \snippet widgets/itemviews/pixelator/mainwindow.cpp 0 + \snippet itemviews/pixelator/mainwindow.cpp 0 \dots - \snippet widgets/itemviews/pixelator/mainwindow.cpp 1 + \snippet itemviews/pixelator/mainwindow.cpp 1 This enables the items to be drawn without any gaps between them. Removing the headers also prevents the user from adjusting the sizes of individual @@ -226,7 +226,7 @@ The custom delegate is constructed with the main window as its parent, so that it will be deleted correctly later, and we set it on the table view. - \snippet widgets/itemviews/pixelator/mainwindow.cpp 2 + \snippet itemviews/pixelator/mainwindow.cpp 2 Each item in the table view will be rendered by the \c PixelDelegate instance. @@ -234,21 +234,21 @@ We construct a spin box to allow the user to change the size of each "pixel" drawn by the delegate: - \snippet widgets/itemviews/pixelator/mainwindow.cpp 3 + \snippet itemviews/pixelator/mainwindow.cpp 3 This spin box is connected to the custom slot we implemented in the \c PixelDelegate class. This ensures that the delegate always draws each pixel at the currently specified size: - \snippet widgets/itemviews/pixelator/mainwindow.cpp 4 + \snippet itemviews/pixelator/mainwindow.cpp 4 \dots - \snippet widgets/itemviews/pixelator/mainwindow.cpp 5 + \snippet itemviews/pixelator/mainwindow.cpp 5 We also connect the spin box to a slot in the \c MainWindow class. This forces the view to take into account the new size hints for each item; these are provided by the delegate in its \c sizeHint() function. - \snippet widgets/itemviews/pixelator/mainwindow.cpp 6 + \snippet itemviews/pixelator/mainwindow.cpp 6 We explicitly resize the columns and rows to match the \uicontrol{Pixel size} combobox. diff --git a/examples/widgets/doc/recentfiles.qdoc b/examples/widgets/doc/recentfiles.qdoc index 8806057d4b..e2e876b088 100644 --- a/examples/widgets/doc/recentfiles.qdoc +++ b/examples/widgets/doc/recentfiles.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/recentfiles + \example mainwindows/recentfiles \title Recent Files Example The Recent Files example shows how a standard File menu can be extended to show diff --git a/examples/widgets/doc/rogue.qdoc b/examples/widgets/doc/rogue.qdoc index ed1f64e851..4c65dd2d6e 100644 --- a/examples/widgets/doc/rogue.qdoc +++ b/examples/widgets/doc/rogue.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/statemachine/rogue + \example statemachine/rogue \title Rogue Example The Rogue example shows how to use the Qt state machine for event @@ -95,7 +95,7 @@ connects the states in the machine. It is the key events from this widget that are used by the machine. - \snippet widgets/statemachine/rogue/window.h 0 + \snippet statemachine/rogue/window.h 0 \c Direction specifies the direction in which the rogue is to move. We use this in \c movePlayer(), which moves the rogue and @@ -105,7 +105,7 @@ setting any Qt \l{Qt's Property System}{property} when entered. More on this later. - \snippet widgets/statemachine/rogue/window.h 1 + \snippet statemachine/rogue/window.h 1 The \c map is an array with the characters that are currently displayed. We set up the array in \c setupMap(), and update it @@ -124,15 +124,15 @@ Here is the constructor of \c Window: - \snippet widgets/statemachine/rogue/window.cpp 0 + \snippet statemachine/rogue/window.cpp 0 \dots - \snippet widgets/statemachine/rogue/window.cpp 1 + \snippet statemachine/rogue/window.cpp 1 The player starts off at position (5, 5). We then set up the map and statemachine. Let's proceed with the \c buildMachine() function: - \snippet widgets/statemachine/rogue/window.cpp 2 + \snippet statemachine/rogue/window.cpp 2 We enter \c inputState when the machine is started and from the \c quitState if the user wants to continue playing. We then set the @@ -147,7 +147,7 @@ inputState as the target state, we would first have left and then entered the \c inputState again. - \snippet widgets/statemachine/rogue/window.cpp 3 + \snippet statemachine/rogue/window.cpp 3 When we enter \c quitState, we update the status bar of the window. @@ -157,12 +157,12 @@ specify the key on which the transition should trigger and the target state of the transition. - \snippet widgets/statemachine/rogue/window.cpp 4 + \snippet statemachine/rogue/window.cpp 4 The transition from \c inputState allows triggering the quit state when the player types \c {q}. - \snippet widgets/statemachine/rogue/window.cpp 5 + \snippet statemachine/rogue/window.cpp 5 The machine is set up, so it's time to start it. @@ -172,13 +172,13 @@ rogue to be moved (by typing 2, 4, 6, or 8) when the machine is in the \c inputState. - \snippet widgets/statemachine/rogue/movementtransition.h 0 + \snippet statemachine/rogue/movementtransition.h 0 In the constructor, we tell QEventTransition to only send \l{QEvent::}{KeyPress} events to the \l{QAbstractTransition::}{eventTest()} function: - \snippet widgets/statemachine/rogue/movementtransition.h 1 + \snippet statemachine/rogue/movementtransition.h 1 The KeyPress events come wrapped in \l{QStateMachine::WrappedEvent}s. \c event must be confirmed to be a wrapped event because Qt uses other @@ -187,7 +187,7 @@ Let's move on to the \c onTransition() function: - \snippet widgets/statemachine/rogue/movementtransition.h 2 + \snippet statemachine/rogue/movementtransition.h 2 When \c onTransition() is invoked, we know that we have a \l{QEvent::}{KeyPress} event with 2, 4, 6, or 8, and can ask \c diff --git a/examples/widgets/doc/screenshot.qdoc b/examples/widgets/doc/screenshot.qdoc index 5b2743f748..2d41cf0d85 100644 --- a/examples/widgets/doc/screenshot.qdoc +++ b/examples/widgets/doc/screenshot.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/desktop/screenshot + \example desktop/screenshot \title Screenshot Example The Screenshot example shows how to take a screenshot of the @@ -51,7 +51,7 @@ \section1 Screenshot Class Definition - \snippet widgets/desktop/screenshot/screenshot.h 0 + \snippet desktop/screenshot/screenshot.h 0 The \c Screenshot class inherits QWidget and is the application's main widget. It displays the application options and a preview of @@ -84,7 +84,7 @@ \section1 Screenshot Class Implementation - \snippet widgets/desktop/screenshot/screenshot.cpp 0 + \snippet desktop/screenshot/screenshot.cpp 0 In the constructor we first create the QLabel displaying the screenshot preview. @@ -103,7 +103,7 @@ delay and the window title, before we resize the widget to a suitable size. - \snippet widgets/desktop/screenshot/screenshot.cpp 1 + \snippet desktop/screenshot/screenshot.cpp 1 The \c resizeEvent() function is reimplemented to receive the resize events dispatched to the widget. The purpose is to scale @@ -121,7 +121,7 @@ only is repainted (using the private \c updateScreenshotLabel() function) when it actually changes its size. - \snippet widgets/desktop/screenshot/screenshot.cpp 2 + \snippet desktop/screenshot/screenshot.cpp 2 The private \c newScreenshot() slot is called when the user requests a new screenshot; but the slot only prepares a new @@ -139,7 +139,7 @@ specified by the \uicontrol {Screenshot Delay} option. It is \c shootScreen() that actually performs the screenshot. - \snippet widgets/desktop/screenshot/screenshot.cpp 3 + \snippet desktop/screenshot/screenshot.cpp 3 The \c saveScreenshot() slot is called when the user push the \uicontrol Save button, and it presents a file dialog using the QFileDialog @@ -158,7 +158,7 @@ name is valid, we use the QPixmap::save() function to save the screenshot's original pixmap in that file. - \snippet widgets/desktop/screenshot/screenshot.cpp 4 + \snippet desktop/screenshot/screenshot.cpp 4 The \c shootScreen() slot is called to take the screenshot. If the user has chosen to delay the screenshot, we make the application @@ -170,7 +170,7 @@ events from the window system and other sources are processed and dispatched. - \snippet widgets/desktop/screenshot/screenshot.cpp 5 + \snippet desktop/screenshot/screenshot.cpp 5 Using the static function QApplication::primaryScreen(), we obtain the QScreen object for the application's main screen. @@ -187,7 +187,7 @@ Screenshot} button, and finally we make the \c Screenshot widget visible if it was hidden during the screenshot. - \snippet widgets/desktop/screenshot/screenshot.cpp 6 + \snippet desktop/screenshot/screenshot.cpp 6 The \uicontrol {Hide This Window} option is enabled or disabled depending on the delay of the screenshot. If there is no delay, @@ -197,7 +197,7 @@ The \c updateCheckBox() slot is called whenever the user changes the delay using the \uicontrol {Screenshot Delay} option. - \snippet widgets/desktop/screenshot/screenshot.cpp 7 + \snippet desktop/screenshot/screenshot.cpp 7 The private \c createOptionsGroupBox() function is called from the constructor. @@ -215,20 +215,20 @@ widgets are automatically reparented to the widget the layout is installed on. - \snippet widgets/desktop/screenshot/screenshot.cpp 8 + \snippet desktop/screenshot/screenshot.cpp 8 The private \c createButtonsLayout() function is called from the constructor. We create the application's buttons using the private \c createButton() function, and add them to a QHBoxLayout. - \snippet widgets/desktop/screenshot/screenshot.cpp 9 + \snippet desktop/screenshot/screenshot.cpp 9 The private \c createButton() function is called from the \c createButtonsLayout() function. It simply creates a QPushButton with the provided text, connects it to the provided receiver and slot, and returns a pointer to the button. - \snippet widgets/desktop/screenshot/screenshot.cpp 10 + \snippet desktop/screenshot/screenshot.cpp 10 The private \c updateScreenshotLabel() function is called whenever the screenshot changes, or when a resize event changes the size of diff --git a/examples/widgets/doc/sdi.qdoc b/examples/widgets/doc/sdi.qdoc index f9911efd30..b686888797 100644 --- a/examples/widgets/doc/sdi.qdoc +++ b/examples/widgets/doc/sdi.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/mainwindows/sdi + \example mainwindows/sdi \title SDI Example The SDI example shows how to create a Single Document Interface. It uses a number of diff --git a/examples/widgets/doc/simpledommodel.qdoc b/examples/widgets/doc/simpledommodel.qdoc index 54e141d5d3..2564c654fa 100644 --- a/examples/widgets/doc/simpledommodel.qdoc +++ b/examples/widgets/doc/simpledommodel.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/simpledommodel + \example itemviews/simpledommodel \title Simple DOM Model Example The Simple DOM Model example shows how an existing class can be adapted for use with @@ -69,7 +69,7 @@ Let us begin by examining the \c DomModel class: - \snippet widgets/itemviews/simpledommodel/dommodel.h 0 + \snippet itemviews/simpledommodel/dommodel.h 0 The class definition contains all the basic functions that are needed for a read-only model. Only the constructor and \c document() function are specific to @@ -82,7 +82,7 @@ The \c DomItem class is used to hold information about a specific QDomNode in the document: - \snippet widgets/itemviews/simpledommodel/domitem.h 0 + \snippet itemviews/simpledommodel/domitem.h 0 Each \c DomItem provides a wrapper for a QDomNode obtained from the underlying document which contains a reference to the node, it's location in the parent node's @@ -105,18 +105,18 @@ The constructor simply records details of the QDomNode that needs to be wrapped: - \snippet widgets/itemviews/simpledommodel/domitem.cpp 0 - \snippet widgets/itemviews/simpledommodel/domitem.cpp 1 + \snippet itemviews/simpledommodel/domitem.cpp 0 + \snippet itemviews/simpledommodel/domitem.cpp 1 As a result, functions to provide the parent wrapper, the row number occupied by the item in its parent's list of children, and the underlying QDomNode for each item are straightforward to write: - \snippet widgets/itemviews/simpledommodel/domitem.cpp 4 + \snippet itemviews/simpledommodel/domitem.cpp 4 \codeline - \snippet widgets/itemviews/simpledommodel/domitem.cpp 6 + \snippet itemviews/simpledommodel/domitem.cpp 6 \codeline - \snippet widgets/itemviews/simpledommodel/domitem.cpp 3 + \snippet itemviews/simpledommodel/domitem.cpp 3 It is necessary to maintain a collection of items which can be consistently identified by the model. For that reason, we maintain a hash of child wrapper items that, to @@ -125,7 +125,7 @@ of the item's QDomNode, relating the row number of each child to the newly-constructed wrapper: - \snippet widgets/itemviews/simpledommodel/domitem.cpp 5 + \snippet itemviews/simpledommodel/domitem.cpp 5 If a QDomNode was previously wrapped, the cached wrapper is returned; otherwise, a new wrapper is constructed and stored for valid children, and zero is returned for @@ -133,7 +133,7 @@ The class's destructor deletes all the child items of the wrapper: - \snippet widgets/itemviews/simpledommodel/domitem.cpp 2 + \snippet itemviews/simpledommodel/domitem.cpp 2 These, in turn, will delete their children and free any QDomNode objects in use. @@ -145,7 +145,7 @@ The constructor accepts an existing document and a parent object for the model: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 0 + \snippet itemviews/simpledommodel/dommodel.cpp 0 A shallow copy of the document is stored for future reference, and a root item is created to provide a wrapper around the document. We assign the root item a row @@ -154,7 +154,7 @@ Since the model only contains information about the root item, the destructor only needs to delete this one item: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 1 + \snippet itemviews/simpledommodel/dommodel.cpp 1 All of the child items in the tree will be deleted by the \c DomItem destructor as their parent items are deleted. @@ -167,7 +167,7 @@ The number of columns exposed by the model is returned by the \c columnCount() function: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 2 + \snippet itemviews/simpledommodel/dommodel.cpp 2 This value is fixed, and does not depend on the location or type of the underlying node in the document. We will use these three columns to display different kinds of @@ -176,12 +176,12 @@ Since we only implement a read-only model, the \c flags() function is straightforward to write: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 5 + \snippet itemviews/simpledommodel/dommodel.cpp 5 Since the model is intended for use in a tree view, the \c headerData() function only provides a horizontal header: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 6 + \snippet itemviews/simpledommodel/dommodel.cpp 6 The model presents the names of nodes in the first column, element attributes in the second, and any node values in the third. @@ -191,7 +191,7 @@ The index() function creates a model index for the item with the given row, column, and parent in the model: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 7 + \snippet itemviews/simpledommodel/dommodel.cpp 7 The function first has to relate the parent index to an item that contains a node from the underlying document. If the parent index is invalid, it refers to the root @@ -201,7 +201,7 @@ will have been created by this function, and we store pointers to item objects in any new indexes that we create with QAbstractItemModel::createIndex(): - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 8 + \snippet itemviews/simpledommodel/dommodel.cpp 8 A child item for the given row is provided by the parent item's \c child() function. If a suitable child item was found then we call @@ -217,7 +217,7 @@ function, and is the number of child nodes contained by the node that corresponds to the specified model index: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 10 + \snippet itemviews/simpledommodel/dommodel.cpp 10 To obtain the relevant node in the underlying document, we access the item via the internal pointer stored in the model index. If an invalid index is supplied, the @@ -228,7 +228,7 @@ provide an implementation for the \c parent() function. This returns a model index that corresponds to the parent of a child model index supplied as its argument: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 9 + \snippet itemviews/simpledommodel/dommodel.cpp 9 For valid indexes other than the index corresponding to the root item, we obtain a pointer to the relevant item using the method described in the \c index() function, @@ -243,13 +243,13 @@ the \l{Qt::DisplayRole}{display role}, returning an invalid variant for all other requests: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 3 + \snippet itemviews/simpledommodel/dommodel.cpp 3 As before, we obtain an item pointer for the index supplied, and use it to obtain the underlying document node. Depending on the column specified, the data we return is obtained in different ways: - \snippet widgets/itemviews/simpledommodel/dommodel.cpp 4 + \snippet itemviews/simpledommodel/dommodel.cpp 4 For the first column, we return the node's name. For the second column, we read any attributes that the node may have, and return a string that contains a space-separated diff --git a/examples/widgets/doc/simpletreemodel.qdoc b/examples/widgets/doc/simpletreemodel.qdoc index 792a893f98..c054352cb8 100644 --- a/examples/widgets/doc/simpletreemodel.qdoc +++ b/examples/widgets/doc/simpletreemodel.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/simpletreemodel + \example itemviews/simpletreemodel \title Simple Tree Model Example The Simple Tree Model example shows how to create a basic, read-only @@ -93,7 +93,7 @@ The \c TreeItem class is defined as follows: - \snippet widgets/itemviews/simpletreemodel/treeitem.h 0 + \snippet itemviews/simpletreemodel/treeitem.h 0 The class is a basic C++ class. It does not inherit from QObject or provide signals and slots. It is used to hold a list of QVariants, @@ -121,19 +121,19 @@ The constructor is only used to record the item's parent and the data associated with each column. - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 0 + \snippet itemviews/simpletreemodel/treeitem.cpp 0 A pointer to each of the child items belonging to this item will be stored in the \c childItems private member variable. When the class's destructor is called, it must delete each of these to ensure that their memory is reused: - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 1 + \snippet itemviews/simpletreemodel/treeitem.cpp 1 Since each of the child items are constructed when the model is initially populated with data, the function to add child items is straightforward: - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 2 + \snippet itemviews/simpletreemodel/treeitem.cpp 2 Each item is able to return any of its child items when given a suitable row number. For example, in the \l{#SimpleTreeModelStructure}{above diagram}, @@ -144,11 +144,11 @@ The \c child() function returns the child that corresponds to the specified row number in the item's list of child items: - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 3 + \snippet itemviews/simpletreemodel/treeitem.cpp 3 The number of child items held can be found with \c childCount(): - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 4 + \snippet itemviews/simpletreemodel/treeitem.cpp 4 The \c TreeModel uses this function to determine the number of rows that exist for a given parent item. @@ -156,7 +156,7 @@ The \c row() function reports the item's location within its parent's list of items: - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 8 + \snippet itemviews/simpletreemodel/treeitem.cpp 8 Note that, although the root item (with no parent item) is automatically assigned a row number of 0, this information is never used by the model. @@ -164,17 +164,17 @@ The number of columns of data in the item is trivially returned by the \c columnCount() function. - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 5 + \snippet itemviews/simpletreemodel/treeitem.cpp 5 Column data is returned by the \c data() function, taking advantage of QList's ability to provide sensible default values if the column number is out of range: - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 6 + \snippet itemviews/simpletreemodel/treeitem.cpp 6 The item's parent is found with \c parent(): - \snippet widgets/itemviews/simpletreemodel/treeitem.cpp 7 + \snippet itemviews/simpletreemodel/treeitem.cpp 7 Note that, since the root item in the model will not have a parent, this function will return zero in that case. We need to ensure that the model @@ -185,7 +185,7 @@ The \c TreeModel class is defined as follows: - \snippet widgets/itemviews/simpletreemodel/treemodel.h 0 + \snippet itemviews/simpletreemodel/treemodel.h 0 This class is similar to most other subclasses of QAbstractItemModel that provide read-only models. Only the form of the constructor and the @@ -198,7 +198,7 @@ result, the constructor takes an argument containing the data that the model will share with views and delegates: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 0 + \snippet itemviews/simpletreemodel/treemodel.cpp 0 It is up to the constructor to create a root item for the model. This item only contains vertical header data for convenience. We also use it @@ -213,7 +213,7 @@ The destructor ensures that the root item and all of its descendants are deleted when the model is destroyed: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 1 + \snippet itemviews/simpletreemodel/treemodel.cpp 1 Since we cannot add data to the model after it is constructed and set up, this simplifies the way that the internal tree of items is managed. @@ -234,7 +234,7 @@ so we can guarantee that any valid model indexes that we receive will contain a valid data pointer. - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 6 + \snippet itemviews/simpletreemodel/treemodel.cpp 6 Since the row and column arguments to this function refer to a child item of the corresponding parent item, we obtain the item using @@ -247,7 +247,7 @@ The way that the \c TreeItem objects are defined makes writing the \c parent() function easy: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 7 + \snippet itemviews/simpletreemodel/treemodel.cpp 7 We only need to ensure that we never return a model index corresponding to the root item. To be consistent with the way that the \c index() @@ -266,7 +266,7 @@ for the \c TreeItem that corresponds to a given model index, or the number of top-level items if an invalid index is specified: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 8 + \snippet itemviews/simpletreemodel/treemodel.cpp 8 Since each item manages its own column data, the \c columnCount() function has to call the item's own \c columnCount() function to @@ -275,13 +275,13 @@ specified, the number of columns returned is determined from the root item: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 2 + \snippet itemviews/simpletreemodel/treemodel.cpp 2 Data is obtained from the model via \c data(). Since the item manages its own columns, we need to use the column number to retrieve the data with the \c TreeItem::data() function: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 3 + \snippet itemviews/simpletreemodel/treemodel.cpp 3 Note that we only support the \l{Qt::ItemDataRole}{DisplayRole} in this implementation, and we also return invalid QVariant objects for @@ -290,12 +290,12 @@ We use the \c flags() function to ensure that views know that the model is read-only: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 4 + \snippet itemviews/simpletreemodel/treemodel.cpp 4 The \c headerData() function returns data that we conveniently stored in the root item: - \snippet widgets/itemviews/simpletreemodel/treemodel.cpp 5 + \snippet itemviews/simpletreemodel/treemodel.cpp 5 This information could have been supplied in a different way: either specified in the constructor, or hard coded into the \c headerData() diff --git a/examples/widgets/doc/simplewidgetmapper.qdoc b/examples/widgets/doc/simplewidgetmapper.qdoc index 33e2569974..2b7cd2d79a 100644 --- a/examples/widgets/doc/simplewidgetmapper.qdoc +++ b/examples/widgets/doc/simplewidgetmapper.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/simplewidgetmapper + \example itemviews/simplewidgetmapper \title Simple Widget Mapper Example The Simple Widget Mapper example shows how to use a widget mapper to display @@ -50,7 +50,7 @@ The class provides a constructor, a slot to keep the buttons up to date, and a private function to set up the model: - \snippet widgets/itemviews/simplewidgetmapper/window.h Window definition + \snippet itemviews/simplewidgetmapper/window.h Window definition In addition to the QDataWidgetMapper object and the controls used to make up the user interface, we use a QStandardItemModel to hold our data. @@ -62,7 +62,7 @@ The constructor of the \c Window class can be explained in three parts. In the first part, we set up the widgets used for the user interface: - \snippet widgets/itemviews/simplewidgetmapper/window.cpp Set up widgets + \snippet itemviews/simplewidgetmapper/window.cpp Set up widgets We also set up the buddy relationships between various labels and the corresponding input widgets. @@ -70,7 +70,7 @@ Next, we set up the widget mapper, relating each input widget to a column in the model specified by the call to \l{QDataWidgetMapper::}{setModel()}: - \snippet widgets/itemviews/simplewidgetmapper/window.cpp Set up the mapper + \snippet itemviews/simplewidgetmapper/window.cpp Set up the mapper We also connect the mapper to the \uicontrol{Next} and \uicontrol{Previous} buttons via its \l{QDataWidgetMapper::}{toNext()} and @@ -81,7 +81,7 @@ In the final part of the constructor, we set up the layout, placing each of the widgets in a grid (we could also use a QFormLayout for this): - \snippet widgets/itemviews/simplewidgetmapper/window.cpp Set up the layout + \snippet itemviews/simplewidgetmapper/window.cpp Set up the layout Lastly, we set the window title and initialize the mapper by setting it to refer to the first row in the model. @@ -90,7 +90,7 @@ we create a standard model with 5 rows and 3 columns, and we insert some sample names, addresses and ages into each row: - \snippet widgets/itemviews/simplewidgetmapper/window.cpp Set up the model + \snippet itemviews/simplewidgetmapper/window.cpp Set up the model As a result, each row can be treated like a record in a database, and the widget mapper will read the data from each row, using the column numbers @@ -104,7 +104,7 @@ user-friendly, we implement the \c{updateButtons()} slot to show when the user is viewing the first or last records: - \snippet widgets/itemviews/simplewidgetmapper/window.cpp Slot for updating the buttons + \snippet itemviews/simplewidgetmapper/window.cpp Slot for updating the buttons If the mapper is referring to the first row in the model, the \uicontrol{Previous} button is disabled. Similarly, the \uicontrol{Next} button is disabled if the diff --git a/examples/widgets/doc/sipdialog.qdoc b/examples/widgets/doc/sipdialog.qdoc index 7bd054e12d..b5f18cb4be 100644 --- a/examples/widgets/doc/sipdialog.qdoc +++ b/examples/widgets/doc/sipdialog.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/sipdialog + \example dialogs/sipdialog \title SIP Dialog Example \ingroup qtce @@ -50,7 +50,7 @@ slot, \c desktopResized(), and a public function, \c reactToSIP(). Also, it holds a private instance of QRect, \c desktopGeometry. - \snippet widgets/dialogs/sipdialog/dialog.h Dialog header + \snippet dialogs/sipdialog/dialog.h Dialog header \section1 Dialog Class Implementation @@ -59,7 +59,7 @@ \l{QDesktopWidget::availableGeometry()}{availableGeometry()}. The parameter used is \c 0 to indicate that we require the primary screen. - \snippet widgets/dialogs/sipdialog/dialog.cpp Dialog constructor part1 + \snippet dialogs/sipdialog/dialog.cpp Dialog constructor part1 We set the window's title to "SIP Dialog Example" and declare a QScrollArea object, \c scrollArea. Next we instantiate a QGroupBox, \c groupBox, with @@ -71,7 +71,7 @@ \l{QWidget::setMinimumWidth()}{minimumWidth} property to 220 pixels, respectively. - \snippet widgets/dialogs/sipdialog/dialog.cpp Dialog constructor part2 + \snippet dialogs/sipdialog/dialog.cpp Dialog constructor part2 Also, all three widgets' text are set accordingly. The \l{QGridLayout::setVerticalSpacing()}{verticalSpacing} property of @@ -79,14 +79,14 @@ is to adapt to the different form factors of Windows Mobile. Then, we add our widgets to the layout. - \snippet widgets/dialogs/sipdialog/dialog.cpp Dialog constructor part3 + \snippet dialogs/sipdialog/dialog.cpp Dialog constructor part3 The \c{scrollArea}'s widget is set to \c groupBox. We use a QHBoxLayout object, \c layout, to contain \c scrollArea. The \c{Dialog}'s layout is set to \c layout and the scroll area's horizontal scroll bar is turned off. - \snippet widgets/dialogs/sipdialog/dialog.cpp Dialog constructor part4 + \snippet dialogs/sipdialog/dialog.cpp Dialog constructor part4 The following signals are connected to their respective slots: \list @@ -97,19 +97,19 @@ {workAreaResized()} signal to \c{dialog}'s \c desktopResized() slot. \endlist - \snippet widgets/dialogs/sipdialog/dialog.cpp Dialog constructor part5 + \snippet dialogs/sipdialog/dialog.cpp Dialog constructor part5 The \c desktopResized() function accepts an integer, \a screen, corresponding to the screen's index. We only invoke \c reactToSIP() if \a screen is the primary screen (e.g. index = 0). - \snippet widgets/dialogs/sipdialog/dialog.cpp desktopResized() function + \snippet dialogs/sipdialog/dialog.cpp desktopResized() function The \c reactToSIP() function resizes \c dialog accordingly if the desktop's available geometry changed vertically, as this change signifies that the SIP may have been opened or closed. - \snippet widgets/dialogs/sipdialog/dialog.cpp reactToSIP() function + \snippet dialogs/sipdialog/dialog.cpp reactToSIP() function If the height has decreased, we unset the maximized window state. Otherwise, we set the maximized window state. Lastly, we update @@ -120,7 +120,7 @@ The \c main() function for the SIP Dialog example instantiates \c Dialog and invokes its \l{QDialog::exec()}{exec()} function. - \snippet widgets/dialogs/sipdialog/main.cpp main() function + \snippet dialogs/sipdialog/main.cpp main() function \note Although this example uses a dialog, the techniques used here apply to all top-level widgets respectively. diff --git a/examples/widgets/doc/spinboxdelegate.qdoc b/examples/widgets/doc/spinboxdelegate.qdoc index 9c2838f96f..95e764dd83 100644 --- a/examples/widgets/doc/spinboxdelegate.qdoc +++ b/examples/widgets/doc/spinboxdelegate.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/spinboxdelegate + \example itemviews/spinboxdelegate \title Spin Box Delegate Example The Spin Box Delegate example shows how to create an editor for a custom delegate in @@ -49,7 +49,7 @@ The definition of the delegate is as follows: - \snippet widgets/itemviews/spinboxdelegate/delegate.h 0 + \snippet itemviews/spinboxdelegate/delegate.h 0 The delegate class declares only those functions that are needed to create an editor widget, display it at the correct location in a view, @@ -66,7 +66,7 @@ call the base class's constructor with the parent QObject as its argument: - \snippet widgets/itemviews/spinboxdelegate/delegate.cpp 0 + \snippet itemviews/spinboxdelegate/delegate.cpp 0 Since the delegate is a subclass of QItemDelegate, the data it retrieves from the model is displayed in a default style, and we do not need to @@ -76,7 +76,7 @@ spin box that restricts values from the model to integers from 0 to 100 inclusive. - \snippet widgets/itemviews/spinboxdelegate/delegate.cpp 1 + \snippet itemviews/spinboxdelegate/delegate.cpp 1 We install an event filter on the spin box to ensure that it behaves in a way that is consistent with other delegates. The implementation for @@ -85,7 +85,7 @@ The \c setEditorData() function reads data from the model, converts it to an integer value, and writes it to the editor widget. - \snippet widgets/itemviews/spinboxdelegate/delegate.cpp 2 + \snippet itemviews/spinboxdelegate/delegate.cpp 2 Since the view treats delegates as ordinary QWidget instances, we have to use a static cast before we can set the value in the spin box. @@ -93,7 +93,7 @@ The \c setModelData() function reads the contents of the spin box, and writes it to the model. - \snippet widgets/itemviews/spinboxdelegate/delegate.cpp 3 + \snippet itemviews/spinboxdelegate/delegate.cpp 3 We call \l{QSpinBox::interpretText()}{interpretText()} to make sure that we obtain the most up-to-date value in the spin box. @@ -102,7 +102,7 @@ geometry using the information supplied in the style option. This is the minimum that the delegate must do in this case. - \snippet widgets/itemviews/spinboxdelegate/delegate.cpp 4 + \snippet itemviews/spinboxdelegate/delegate.cpp 4 More complex editor widgets may divide the rectangle available in \c{option.rect} between different child widgets if required. @@ -118,7 +118,7 @@ model to hold some data, set up a table view to use the data in the model, and construct a custom delegate to use for editing: - \snippet widgets/itemviews/spinboxdelegate/main.cpp 0 + \snippet itemviews/spinboxdelegate/main.cpp 0 The table view is informed about the delegate, and will use it to display each of the items. Since the delegate is a subclass of @@ -127,13 +127,13 @@ We insert some arbitrary data into the model for demonstration purposes: - \snippet widgets/itemviews/spinboxdelegate/main.cpp 1 - \snippet widgets/itemviews/spinboxdelegate/main.cpp 2 + \snippet itemviews/spinboxdelegate/main.cpp 1 + \snippet itemviews/spinboxdelegate/main.cpp 2 Finally, the table view is displayed with a window title, and we start the application's event loop: - \snippet widgets/itemviews/spinboxdelegate/main.cpp 3 + \snippet itemviews/spinboxdelegate/main.cpp 3 Each of the cells in the table can now be edited in the usual way, but the spin box ensures that the data returned to the model is always diff --git a/examples/widgets/doc/spreadsheet.qdoc b/examples/widgets/doc/spreadsheet.qdoc index ececf0af09..7364f022cb 100644 --- a/examples/widgets/doc/spreadsheet.qdoc +++ b/examples/widgets/doc/spreadsheet.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/spreadsheet + \example itemviews/spreadsheet \title Spreadsheet The Spreadsheet example shows how a table view can be used to create a diff --git a/examples/widgets/doc/standarddialogs.qdoc b/examples/widgets/doc/standarddialogs.qdoc index 05596ac84c..b56642b6ec 100644 --- a/examples/widgets/doc/standarddialogs.qdoc +++ b/examples/widgets/doc/standarddialogs.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/standarddialogs + \example dialogs/standarddialogs \title Standard Dialogs Example The Standard Dialogs example shows the standard dialogs that are provided by Qt. diff --git a/examples/widgets/doc/stardelegate.qdoc b/examples/widgets/doc/stardelegate.qdoc index 2887006778..aba8864c2b 100644 --- a/examples/widgets/doc/stardelegate.qdoc +++ b/examples/widgets/doc/stardelegate.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/itemviews/stardelegate + \example itemviews/stardelegate \title Star Delegate Example The Star Delegate example shows how to create a delegate that @@ -77,7 +77,7 @@ Here's the definition of the \c StarDelegate class: - \snippet widgets/itemviews/stardelegate/stardelegate.h 0 + \snippet itemviews/stardelegate/stardelegate.h 0 All public functions are reimplemented virtual functions from QItemDelegate to provide custom rendering and editing. @@ -88,7 +88,7 @@ reimplemented from QItemDelegate and is called whenever the view needs to repaint an item: - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 0 + \snippet itemviews/stardelegate/stardelegate.cpp 0 The function is invoked once for each item, represented by a QModelIndex object from the model. If the data stored in the item @@ -107,7 +107,7 @@ The \l{QAbstractItemDelegate::}{createEditor()} function is called when the user starts editing an item: - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 2 + \snippet itemviews/stardelegate/stardelegate.cpp 2 If the item is a \c StarRating, we create a \c StarEditor and connect its \c editingFinished() signal to our \c @@ -116,7 +116,7 @@ Here's the implementation of \c commitAndCloseEditor(): - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 5 + \snippet itemviews/stardelegate/stardelegate.cpp 5 When the user is done editing, we emit \l{QAbstractItemDelegate::}{commitData()} and @@ -128,7 +128,7 @@ called when an editor is created to initialize it with data from the model: - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 3 + \snippet itemviews/stardelegate/stardelegate.cpp 3 We simply call \c setStarRating() on the editor. @@ -136,11 +136,11 @@ called when editing is finished, to commit data from the editor to the model: - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 4 + \snippet itemviews/stardelegate/stardelegate.cpp 4 The \c sizeHint() function returns an item's preferred size: - \snippet widgets/itemviews/stardelegate/stardelegate.cpp 1 + \snippet itemviews/stardelegate/stardelegate.cpp 1 We simply forward the call to \c StarRating. @@ -149,7 +149,7 @@ The \c StarEditor class was used when implementing \c StarDelegate. Here's the class definition: - \snippet widgets/itemviews/stardelegate/stareditor.h 0 + \snippet itemviews/stardelegate/stareditor.h 0 The class lets the user edit a \c StarRating by moving the mouse over the editor. It emits the \c editingFinished() signal when @@ -164,7 +164,7 @@ Let's start with the constructor: - \snippet widgets/itemviews/stardelegate/stareditor.cpp 0 + \snippet itemviews/stardelegate/stareditor.cpp 0 We enable \l{QWidget::setMouseTracking()}{mouse tracking} on the widget so we can follow the cursor even when the user doesn't @@ -176,32 +176,32 @@ The \l{QWidget::}{paintEvent()} function is reimplemented from QWidget: - \snippet widgets/itemviews/stardelegate/stareditor.cpp 1 + \snippet itemviews/stardelegate/stareditor.cpp 1 We simply call \c StarRating::paint() to draw the stars, just like we did when implementing \c StarDelegate. - \snippet widgets/itemviews/stardelegate/stareditor.cpp 2 + \snippet itemviews/stardelegate/stareditor.cpp 2 In the mouse event handler, we call \c setStarCount() on the private data member \c myStarRating to reflect the current cursor position, and we call QWidget::update() to force a repaint. - \snippet widgets/itemviews/stardelegate/stareditor.cpp 3 + \snippet itemviews/stardelegate/stareditor.cpp 3 When the user releases a mouse button, we simply emit the \c editingFinished() signal. - \snippet widgets/itemviews/stardelegate/stareditor.cpp 4 + \snippet itemviews/stardelegate/stareditor.cpp 4 The \c starAtPosition() function uses basic linear algebra to find out which star is under the cursor. \section1 StarRating Class Definition - \snippet widgets/itemviews/stardelegate/starrating.h 0 + \snippet itemviews/stardelegate/starrating.h 0 \codeline - \snippet widgets/itemviews/stardelegate/starrating.h 1 + \snippet itemviews/stardelegate/starrating.h 1 The \c StarRating class represents a rating as a number of stars. In addition to holding the data, it is also capable of painting @@ -219,12 +219,12 @@ The constructor initializes \c myStarCount and \c myMaxStarCount, and sets up the polygons used to draw stars and diamonds: - \snippet widgets/itemviews/stardelegate/starrating.cpp 0 + \snippet itemviews/stardelegate/starrating.cpp 0 The \c paint() function paints the stars in this \c StarRating object on a paint device: - \snippet widgets/itemviews/stardelegate/starrating.cpp 2 + \snippet itemviews/stardelegate/starrating.cpp 2 We first set the pen and brush we will use for painting. The \c mode parameter can be either \c Editable or \c ReadOnly. If \c @@ -239,7 +239,7 @@ The \c sizeHint() function returns the preferred size for an area to paint the stars on: - \snippet widgets/itemviews/stardelegate/starrating.cpp 1 + \snippet itemviews/stardelegate/starrating.cpp 1 The preferred size is just enough to paint the maximum number of stars. The function is called by both \c StarDelegate::sizeHint() @@ -249,7 +249,7 @@ Here's the program's \c main() function: - \snippet widgets/itemviews/stardelegate/main.cpp 5 + \snippet itemviews/stardelegate/main.cpp 5 The \c main() function creates a QTableWidget and sets a \c StarDelegate on it. \l{QAbstractItemView::}{DoubleClicked} and @@ -261,13 +261,13 @@ The \c populateTableWidget() function fills the QTableWidget with data: - \snippet widgets/itemviews/stardelegate/main.cpp 0 - \snippet widgets/itemviews/stardelegate/main.cpp 1 + \snippet itemviews/stardelegate/main.cpp 0 + \snippet itemviews/stardelegate/main.cpp 1 \dots - \snippet widgets/itemviews/stardelegate/main.cpp 2 - \snippet widgets/itemviews/stardelegate/main.cpp 3 + \snippet itemviews/stardelegate/main.cpp 2 + \snippet itemviews/stardelegate/main.cpp 3 \codeline - \snippet widgets/itemviews/stardelegate/main.cpp 4 + \snippet itemviews/stardelegate/main.cpp 4 Notice the call to qVariantFromValue to convert a \c StarRating to a QVariant. diff --git a/examples/widgets/doc/states.qdoc b/examples/widgets/doc/states.qdoc index 887c9e03d7..52eda087f1 100644 --- a/examples/widgets/doc/states.qdoc +++ b/examples/widgets/doc/states.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/states + \example animation/states \title States Example The States example shows how to use the Qt state machine to play diff --git a/examples/widgets/doc/stickman.qdoc b/examples/widgets/doc/stickman.qdoc index d224b0ee2b..cffdb64822 100644 --- a/examples/widgets/doc/stickman.qdoc +++ b/examples/widgets/doc/stickman.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/stickman + \example animation/stickman \title Stickman Example The Stickman example shows how to animate transitions in a state machine to implement key frame @@ -51,12 +51,12 @@ creating states that assign values to the the "position" properties of each of the nodes in the skeleton graph. - \snippet widgets/animation/stickman/lifecycle.cpp 1 + \snippet animation/stickman/lifecycle.cpp 1 The states are then bound together with signal transitions that listen to the propertiesAssigned() signal. - \snippet widgets/animation/stickman/lifecycle.cpp 2 + \snippet animation/stickman/lifecycle.cpp 2 The last frame state is given a transition to the first one, so that the animation will loop until it is interrupted when a transition out from the animation state is taken. To get smooth @@ -65,7 +65,7 @@ and will be selected by default when taking any transition that leads into a state that assigns values to these properties. - \snippet widgets/animation/stickman/lifecycle.cpp 3 + \snippet animation/stickman/lifecycle.cpp 3 Several such animation states are constructed, and are placed together as children of a top level "alive" state which represents the stickman life cycle. Transitions go from the parent @@ -81,18 +81,18 @@ a custom transition type called LightningSrikesTransition which samples every second and triggers at random (one out of fifty times on average.) - \snippet widgets/animation/stickman/lifecycle.cpp 4 + \snippet animation/stickman/lifecycle.cpp 4 When it triggers, the machine will first enter a "lightningBlink" state which uses a timer to pause for a brief period of time while the background color of the scene is white. This gives us a flash effect when the lightning strikes. - \snippet widgets/animation/stickman/lifecycle.cpp 5 + \snippet animation/stickman/lifecycle.cpp 5 We start and stop a QTimer object when entering and exiting the state. Then we transition into the "dead" state when the timer times out. - \snippet widgets/animation/stickman/lifecycle.cpp 0 + \snippet animation/stickman/lifecycle.cpp 0 When the machine is in the "dead" state, it will be unresponsive. This is because the "dead" state has no transitions leading out. diff --git a/examples/widgets/doc/sub-attaq.qdoc b/examples/widgets/doc/sub-attaq.qdoc index b2884eb0a9..ae00eb0926 100644 --- a/examples/widgets/doc/sub-attaq.qdoc +++ b/examples/widgets/doc/sub-attaq.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/animation/sub-attaq + \example animation/sub-attaq \title Sub-Attaq This example shows Qt's ability to combine \l{The Animation Framework}{the animation framework} diff --git a/examples/widgets/doc/syntaxhighlighter.qdoc b/examples/widgets/doc/syntaxhighlighter.qdoc index 2db485b808..66727c0030 100644 --- a/examples/widgets/doc/syntaxhighlighter.qdoc +++ b/examples/widgets/doc/syntaxhighlighter.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/richtext/syntaxhighlighter + \example richtext/syntaxhighlighter \title Syntax Highlighter Example The Syntax Highlighter example shows how to perform simple syntax @@ -53,7 +53,7 @@ \section1 Highlighter Class Definition - \snippet widgets/richtext/syntaxhighlighter/highlighter.h 0 + \snippet richtext/syntaxhighlighter/highlighter.h 0 To provide your own syntax highlighting, you must subclass QSyntaxHighlighter, reimplement the \l @@ -79,8 +79,8 @@ applied. In this example, we have also chosen to define our highlighting rules in the constructor: - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 0 - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 1 + \snippet richtext/syntaxhighlighter/highlighter.cpp 0 + \snippet richtext/syntaxhighlighter/highlighter.cpp 1 First we define a keyword rule which recognizes the most common C++ keywords. We give the \c keywordFormat a bold, dark blue @@ -88,11 +88,11 @@ format to a HighlightingRule object and append the object to our list of rules. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 2 + \snippet richtext/syntaxhighlighter/highlighter.cpp 2 \codeline - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 4 + \snippet richtext/syntaxhighlighter/highlighter.cpp 4 \codeline - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 5 + \snippet richtext/syntaxhighlighter/highlighter.cpp 5 Then we create a format that we will apply to Qt class names. The class names will be rendered with a dark magenta color and a bold @@ -106,9 +106,9 @@ expressions and are stored in HighlightingRule objects with the associated format. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 3 + \snippet richtext/syntaxhighlighter/highlighter.cpp 3 \codeline - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 6 + \snippet richtext/syntaxhighlighter/highlighter.cpp 6 The C++ language has two variations of comments: The single line comment (\c //) and the multiline comment (\c{/*...*}\c{/}). The single @@ -126,7 +126,7 @@ function. At this point we only specify the multiline comment's color. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 7 + \snippet richtext/syntaxhighlighter/highlighter.cpp 7 The highlightBlock() function is called automatically whenever it is necessary by the rich text engine, i.e. when there are text @@ -154,7 +154,7 @@ This process is repeated until the last occurrence of the pattern in the current text block is found. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 8 + \snippet richtext/syntaxhighlighter/highlighter.cpp 8 To deal with constructs that can span several text blocks (like the C++ multiline comment), it is necessary to know the end state @@ -180,7 +180,7 @@ syntax highlighting rules are applied we initialize the current block state to 0. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 9 + \snippet richtext/syntaxhighlighter/highlighter.cpp 9 If the previous block state was "in comment" (\c {previousBlockState() == 1}), we start the search for an end @@ -188,8 +188,8 @@ previousBlockState() returns 0, we start the search at the location of the first occurrence of a start expression. - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 10 - \snippet widgets/richtext/syntaxhighlighter/highlighter.cpp 11 + \snippet richtext/syntaxhighlighter/highlighter.cpp 10 + \snippet richtext/syntaxhighlighter/highlighter.cpp 11 When an end expression is found, we calculate the length of the comment and apply the multiline comment format. Then we search for @@ -206,7 +206,7 @@ application with an instance of the class and pass it the document upon which you want the highlighting to be applied. - \snippet widgets/richtext/syntaxhighlighter/mainwindow.h 0 + \snippet richtext/syntaxhighlighter/mainwindow.h 0 In this example we declare a pointer to a \c Highlighter instance which we later will initialize in the private \c setupEditor() @@ -219,12 +219,12 @@ central widget of the application. Finally we set the main window's title. - \snippet widgets/richtext/syntaxhighlighter/mainwindow.cpp 0 + \snippet richtext/syntaxhighlighter/mainwindow.cpp 0 We initialize and install the \c Highlighter object in the private setupEditor() convenience function: - \snippet widgets/richtext/syntaxhighlighter/mainwindow.cpp 1 + \snippet richtext/syntaxhighlighter/mainwindow.cpp 1 First we create the font we want to use in the editor, then we create the editor itself which is an instance of the QTextEdit diff --git a/examples/widgets/doc/tabdialog.qdoc b/examples/widgets/doc/tabdialog.qdoc index dea17807a3..98983d124b 100644 --- a/examples/widgets/doc/tabdialog.qdoc +++ b/examples/widgets/doc/tabdialog.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/tabdialog + \example dialogs/tabdialog \title Tab Dialog Example The Tab Dialog example shows how to construct a tab dialog using the @@ -52,7 +52,7 @@ only contain the class constructor and a private data member for the QTabWidget: - \snippet widgets/dialogs/tabdialog/tabdialog.h 3 + \snippet dialogs/tabdialog/tabdialog.h 3 In the example, the widget will be used as a top-level window, but we define the constructor so that it can take a parent widget. This @@ -64,7 +64,7 @@ The constructor calls the QDialog constructor and creates a QFileInfo object for the specified filename. - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 0 + \snippet dialogs/tabdialog/tabdialog.cpp 0 The tab widget is populated with three custom widgets that each contain information about the file. We construct each of these @@ -74,16 +74,16 @@ We create two standard push buttons, and connect each of them to the appropriate slots in the dialog: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 1 - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 3 + \snippet dialogs/tabdialog/tabdialog.cpp 1 + \snippet dialogs/tabdialog/tabdialog.cpp 3 We arrange the tab widget above the buttons in the dialog: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 4 + \snippet dialogs/tabdialog/tabdialog.cpp 4 Finally, we set the dialog's title: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 5 + \snippet dialogs/tabdialog/tabdialog.cpp 5 Each of the tabs are subclassed from QWidget, and only provide constructors. @@ -93,7 +93,7 @@ The GeneralTab widget definition is simple because we are only interested in displaying the contents of a widget within a tab: - \snippet widgets/dialogs/tabdialog/tabdialog.h 0 + \snippet dialogs/tabdialog/tabdialog.h 0 \section1 GeneralTab Class Implementation @@ -101,14 +101,14 @@ passed by the TabDialog. Various widgets for this purpose, and these are arranged within a vertical layout: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 6 + \snippet dialogs/tabdialog/tabdialog.cpp 6 \section1 PermissionsTab Class Definition Like the GeneralTab, the PermissionsTab is just used as a placeholder widget for its children: - \snippet widgets/dialogs/tabdialog/tabdialog.h 1 + \snippet dialogs/tabdialog/tabdialog.h 1 \section1 PermissionsTab Class Implementation @@ -116,19 +116,19 @@ displaying details of the file permissions and owner in widgets that are arranged in nested layouts: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 7 + \snippet dialogs/tabdialog/tabdialog.cpp 7 \section1 ApplicationsTab Class Definition The ApplicationsTab is another placeholder widget that is mostly cosmetic: - \snippet widgets/dialogs/tabdialog/tabdialog.h 2 + \snippet dialogs/tabdialog/tabdialog.h 2 \section1 ApplicationsTab Class Implementation The ApplicationsTab does not show any useful information, but could be used as a template for a more complicated example: - \snippet widgets/dialogs/tabdialog/tabdialog.cpp 8 + \snippet dialogs/tabdialog/tabdialog.cpp 8 */ diff --git a/examples/widgets/doc/textedit.qdoc b/examples/widgets/doc/textedit.qdoc index 1eb762aa3d..1bb596eb6e 100644 --- a/examples/widgets/doc/textedit.qdoc +++ b/examples/widgets/doc/textedit.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/richtext/textedit + \example richtext/textedit \title Text Edit The Text Edit example shows Qt's rich text editing facilities in action, diff --git a/examples/widgets/doc/trafficlight.qdoc b/examples/widgets/doc/trafficlight.qdoc index c35fa4915d..ec3578abaa 100644 --- a/examples/widgets/doc/trafficlight.qdoc +++ b/examples/widgets/doc/trafficlight.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/statemachine/trafficlight + \example statemachine/trafficlight \title Traffic Light Example The Traffic Light example shows how to use \l{The State Machine Framework} @@ -39,20 +39,20 @@ one light to another (red to yellow to green to yellow to red again) at certain intervals. - \snippet widgets/statemachine/trafficlight/main.cpp 0 + \snippet statemachine/trafficlight/main.cpp 0 The LightWidget class represents a single light of the traffic light. It provides an \c on property and two slots, turnOn() and turnOff(), to turn the light on and off, respectively. The widget paints itself in the color that's passed to the constructor. - \snippet widgets/statemachine/trafficlight/main.cpp 1 + \snippet statemachine/trafficlight/main.cpp 1 The TrafficLightWidget class represents the visual part of the traffic light; it's a widget that contains three lights arranged vertically, and provides accessor functions for these. - \snippet widgets/statemachine/trafficlight/main.cpp 2 + \snippet statemachine/trafficlight/main.cpp 2 The createLightState() function creates a state that turns a light on when the state is entered, and off when the state is exited. The state uses a @@ -64,7 +64,7 @@ \caption This is a caption \endomit - \snippet widgets/statemachine/trafficlight/main.cpp 3 + \snippet statemachine/trafficlight/main.cpp 3 The TrafficLight class combines the TrafficLightWidget with a state machine. The state graph has four states: red-to-yellow, yellow-to-green, @@ -78,7 +78,7 @@ \caption This is a caption \endomit - \snippet widgets/statemachine/trafficlight/main.cpp 4 + \snippet statemachine/trafficlight/main.cpp 4 The main() function constructs a TrafficLight and shows it. diff --git a/examples/widgets/doc/transformations.qdoc b/examples/widgets/doc/transformations.qdoc index af548b92d0..79681a2799 100644 --- a/examples/widgets/doc/transformations.qdoc +++ b/examples/widgets/doc/transformations.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/painting/transformations + \example painting/transformations \title Transformations Example The Transformations example shows how transformations influence @@ -76,7 +76,7 @@ transformation matrix, see the \l {Coordinate System} and QTransform documentation. - \snippet widgets/painting/transformations/renderarea.h 0 + \snippet painting/transformations/renderarea.h 0 The global \c Operation enum is declared in the \c renderarea.h file and describes the various transformation operations available @@ -87,7 +87,7 @@ The \c RenderArea class inherits QWidget, and controls the rendering of a given shape. - \snippet widgets/painting/transformations/renderarea.h 1 + \snippet painting/transformations/renderarea.h 1 We declare two public functions, \c setOperations() and \c setShape(), to be able to specify the \c RenderArea widget's shape @@ -101,7 +101,7 @@ reimplement the QWidget::paintEvent() event handler to draw the render area's shape applying the user's transformation choices. - \snippet widgets/painting/transformations/renderarea.h 2 + \snippet painting/transformations/renderarea.h 2 We also declare several convenience functions to draw the shape, the coordinate system's outline and the coordinates, and to @@ -120,7 +120,7 @@ we will take a quick look at the constructor and at the functions that provides access to the \c RenderArea widget: - \snippet widgets/painting/transformations/renderarea.cpp 0 + \snippet painting/transformations/renderarea.cpp 0 In the constructor we pass the parent parameter on to the base class, and customize the font that we will use to render the @@ -140,18 +140,18 @@ bounding rectangle of the given character relative to the left-most point on the base line. - \snippet widgets/painting/transformations/renderarea.cpp 1 + \snippet painting/transformations/renderarea.cpp 1 \codeline - \snippet widgets/painting/transformations/renderarea.cpp 2 + \snippet painting/transformations/renderarea.cpp 2 In the \c setShape() and \c setOperations() functions we update the \c RenderArea widget by storing the new value or values followed by a call to the QWidget::update() slot which schedules a paint event for processing when Qt returns to the main event loop. - \snippet widgets/painting/transformations/renderarea.cpp 3 + \snippet painting/transformations/renderarea.cpp 3 \codeline - \snippet widgets/painting/transformations/renderarea.cpp 4 + \snippet painting/transformations/renderarea.cpp 4 We reimplement the QWidget's \l {QWidget::minimumSizeHint()}{minimumSizeHint()} and \l @@ -161,7 +161,7 @@ if there is no layout for this widget, and returns the layout's minimum size or preferred size, respectively, otherwise. - \snippet widgets/painting/transformations/renderarea.cpp 5 + \snippet painting/transformations/renderarea.cpp 5 The \c paintEvent() event handler receives the \c RenderArea widget's paint events. A paint event is a request to repaint all @@ -179,7 +179,7 @@ ensure that the original shape is renderend with a suitable margin. - \snippet widgets/painting/transformations/renderarea.cpp 6 + \snippet painting/transformations/renderarea.cpp 6 Before we start to render the shape, we call the QPainter::save() function. @@ -197,11 +197,11 @@ the QPainter::restore() function (i.e. popping the saved state off the stack). - \snippet widgets/painting/transformations/renderarea.cpp 7 + \snippet painting/transformations/renderarea.cpp 7 Then we draw the square outline. - \snippet widgets/painting/transformations/renderarea.cpp 8 + \snippet painting/transformations/renderarea.cpp 8 Since we want the coordinates to correspond with the coordinate system the shape is rendered within, we must make another call to @@ -217,11 +217,11 @@ There is no need to save the QPainter state this time since drawing the coordinates is the last painting operation. - \snippet widgets/painting/transformations/renderarea.cpp 9 + \snippet painting/transformations/renderarea.cpp 9 \codeline - \snippet widgets/painting/transformations/renderarea.cpp 10 + \snippet painting/transformations/renderarea.cpp 10 \codeline - \snippet widgets/painting/transformations/renderarea.cpp 11 + \snippet painting/transformations/renderarea.cpp 11 The \c drawCoordinates(), \c drawOutline() and \c drawShape() are convenience functions called from the \c paintEvent() event @@ -229,7 +229,7 @@ operations and how to display basic graphics primitives, see the \l {painting/basicdrawing}{Basic Drawing} example. - \snippet widgets/painting/transformations/renderarea.cpp 12 + \snippet painting/transformations/renderarea.cpp 12 The \c transformPainter() convenience function is also called from the \c paintEvent() event handler, and transforms the given @@ -247,7 +247,7 @@ addition to all the transformations applied to the \c RenderArea widgets to their left. - \snippet widgets/painting/transformations/window.h 0 + \snippet painting/transformations/window.h 0 We declare two public slots to make the application able to respond to user interaction, updating the displayed \c RenderArea @@ -259,7 +259,7 @@ \c shapeSelected() slot updates the \c RenderArea widgets' shapes whenever the user changes the preferred shape. - \snippet widgets/painting/transformations/window.h 1 + \snippet painting/transformations/window.h 1 We also declare a private convenience function, \c setupShapes(), that is used when constructing the \c Window widget, and we @@ -274,7 +274,7 @@ In the constructor we create and initialize the application's components: - \snippet widgets/painting/transformations/window.cpp 0 + \snippet painting/transformations/window.cpp 0 First we create the \c RenderArea widget that will render the shape in the default coordinate system. We also create the @@ -283,7 +283,7 @@ themselves are created at the end of the constructor, using the \c setupShapes() convenience function. - \snippet widgets/painting/transformations/window.cpp 1 + \snippet painting/transformations/window.cpp 1 Then we create the \c RenderArea widgets that will render their shapes with coordinate tranformations. By default the applied @@ -298,7 +298,7 @@ operationChanged() slot to update the application whenever the user changes the selected transformation operations. - \snippet widgets/painting/transformations/window.cpp 2 + \snippet painting/transformations/window.cpp 2 Finally, we set the layout for the application window using the QWidget::setLayout() function, construct the available shapes @@ -307,13 +307,13 @@ \c shapeSelected() slot before we set the window title. - \snippet widgets/painting/transformations/window.cpp 3 - \snippet widgets/painting/transformations/window.cpp 4 - \snippet widgets/painting/transformations/window.cpp 5 - \snippet widgets/painting/transformations/window.cpp 6 + \snippet painting/transformations/window.cpp 3 + \snippet painting/transformations/window.cpp 4 + \snippet painting/transformations/window.cpp 5 + \snippet painting/transformations/window.cpp 6 \dots - \snippet widgets/painting/transformations/window.cpp 7 + \snippet painting/transformations/window.cpp 7 The \c setupShapes() function is called from the constructor and create the QPainterPath objects representing the shapes that are @@ -327,7 +327,7 @@ shapeSelected() slot to update the application when the user changes the preferred shape. - \snippet widgets/painting/transformations/window.cpp 8 + \snippet painting/transformations/window.cpp 8 The public \c operationChanged() slot is called whenever the user changes the selected operations. @@ -342,7 +342,7 @@ associated operation to a QList of transformations which we apply to the widget before proceeding to the next. - \snippet widgets/painting/transformations/window.cpp 9 + \snippet painting/transformations/window.cpp 9 The \c shapeSelected() slot is called whenever the user changes the preferred shape, updating the \c RenderArea widgets using diff --git a/examples/widgets/doc/trivialwizard.qdoc b/examples/widgets/doc/trivialwizard.qdoc index fb4a08a527..e27f9cadc2 100644 --- a/examples/widgets/doc/trivialwizard.qdoc +++ b/examples/widgets/doc/trivialwizard.qdoc @@ -26,7 +26,7 @@ ****************************************************************************/ /*! - \example widgets/dialogs/trivialwizard + \example dialogs/trivialwizard \title Trivial Wizard Example The Trivial Wizard example illustrates how to create a linear three-page @@ -45,7 +45,7 @@ A QVBoxLayout is used to hold the \c label. This \c page is returned when the \c createIntroPage() function is called. - \snippet widgets/dialogs/trivialwizard/trivialwizard.cpp 0 + \snippet dialogs/trivialwizard/trivialwizard.cpp 0 \section1 Registration Page @@ -56,7 +56,7 @@ and an e-mail address. A QGridLayout is used to hold the QLabel and QLineEdit objects. - \snippet widgets/dialogs/trivialwizard/trivialwizard.cpp 2 + \snippet dialogs/trivialwizard/trivialwizard.cpp 2 \section1 Conclusion Page @@ -67,7 +67,7 @@ QLabel is used to inform the user that the registration process has completed successfully. - \snippet widgets/dialogs/trivialwizard/trivialwizard.cpp 6 + \snippet dialogs/trivialwizard/trivialwizard.cpp 6 \section1 \c main() Function @@ -76,7 +76,7 @@ set to "Trivial Wizard" and its \c show() function is invoked to display it. - \snippet widgets/dialogs/trivialwizard/trivialwizard.cpp 10 + \snippet dialogs/trivialwizard/trivialwizard.cpp 10 \sa QWizard, {Class Wizard Example}, {License Wizard Example} */ diff --git a/examples/widgets/doc/twowaybutton.qdoc b/examples/widgets/doc/twowaybutton.qdoc index a380d14122..40f8c6f1f3 100644 --- a/examples/widgets/doc/twowaybutton.qdoc +++ b/examples/widgets/doc/twowaybutton.qdoc @@ -26,41 +26,41 @@ ****************************************************************************/ /*! - \example widgets/statemachine/twowaybutton + \example statemachine/twowaybutton \title Two-way Button Example The Two-way button example shows how to use \l{The State Machine Framework} to implement a simple state machine that toggles the current state when a button is clicked. - \snippet widgets/statemachine/twowaybutton/main.cpp 0 + \snippet statemachine/twowaybutton/main.cpp 0 The application's main() function begins by constructing the application object, a button and a state machine. - \snippet widgets/statemachine/twowaybutton/main.cpp 1 + \snippet statemachine/twowaybutton/main.cpp 1 The state machine has two states; \c on and \c off. When either state is entered, the text of the button will be set accordingly. - \snippet widgets/statemachine/twowaybutton/main.cpp 2 + \snippet statemachine/twowaybutton/main.cpp 2 When the state machine is in the \c off state and the button is clicked, it will transition to the \c on state; when the state machine is in the \c on state and the button is clicked, it will transition to the \c off state. - \snippet widgets/statemachine/twowaybutton/main.cpp 3 + \snippet statemachine/twowaybutton/main.cpp 3 The states are added to the state machine; they become top-level (sibling) states. - \snippet widgets/statemachine/twowaybutton/main.cpp 4 + \snippet statemachine/twowaybutton/main.cpp 4 The initial state is \c off; this is the state the state machine will immediately transition to once the state machine is started. - \snippet widgets/statemachine/twowaybutton/main.cpp 5 + \snippet statemachine/twowaybutton/main.cpp 5 Finally, the button is resized and made visible, and the application event loop is entered. -- cgit v1.2.3