Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/doc/src/tutorials/addressbook-fr.qdoc

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the documentation of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545    \startpage {index.html}{Qt Reference Documentation}
     46    \contentspage Tutorials
    4647    \nextpage {tutorials/addressbook-fr/part1}{Chapitre 1}
    4748
    4849    \title Tutoriel "Carnet d'adresses"
    49     \ingroup howto
    50     \ingroup tutorials
    5150    \brief Une introduction à la programation d'interface graphique montrant comment construire une application simple avec Qt.
    5251
     
    221220    comme argument optionnel. Ceci est destiné à assurer qu'il ne sera pas centré
    222221    verticalement dans la cellule (1,0). Pour un aperçu rapide des layouts de Qt,
    223     consultez la section \l{Layout Classes}.
     222    consultez la section \l{Layout Management}.
    224223
    225224    Afin d'installer l'objet layout dans un widget, il faut appeler la méthode
     
    240239    \snippet tutorials/addressbook/part1/main.cpp main function
    241240
    242     On construit un nouveau widget \c AddressBook sur le tas en utilisant le mot-clé
    243     \c new et en invoquant sa méthode \l{QWidget::show()}{show()} pour l'afficher.
     241    On construit un nouveau widget \c AddressBook sur la pile et on invoque
     242    sa méthode \l{QWidget::show()}{show()} pour l'afficher.
    244243    Cependant, le widget ne sera pas visible tant que la boucle d'évènements
    245244    n'aura pas été lancée. On démarre la boucle d'évènements en appelant la
     
    247246    par cette méthode est lui même utilisé comme valeur de retour pour la méthode
    248247    \c main().
     248    On comprend maintenant pourquoi \c AddressBook a été créé sur la pile: à la fin
     249    du programme, l'objet sort du scope de la fonction \c main() et tous ses widgets enfants
     250    sont supprimés, assurant ainsi qu'il n'y aura pas de fuites de mémoire.
    249251*/
    250252
  • trunk/doc/src/tutorials/addressbook.qdoc

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the documentation of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4444
    4545    \startpage {index.html}{Qt Reference Documentation}
     46    \contentspage Tutorials
    4647    \nextpage {tutorials/addressbook/part1}{Chapter 1}
    4748
    4849    \title Address Book Tutorial
    49     \ingroup howto
    50     \ingroup tutorials
    5150    \brief An introduction to GUI programming, showing how to put together a
    5251    simple yet fully-functioning application.
     
    223222    Notice that \c addressLabel is positioned using Qt::AlignTop as an
    224223    additional argument. This is to make sure it is not vertically centered in
    225     cell (1,0). For a basic overview on Qt Layouts, refer to the \l{Layout Classes}
    226     document.
     224    cell (1,0). For a basic overview on Qt Layouts, refer to the
     225    \l{Layout Management} documentation.
    227226
    228227    In order to install the layout object onto the widget, we have to invoke
     
    243242    \snippet tutorials/addressbook/part1/main.cpp main function
    244243
    245     We construct a new \c AddressBook widget on the heap using the \c new
    246     keyword and invoke its \l{QWidget::show()}{show()} function to display it.
     244    We construct a new \c AddressBook widget on the stack and invoke
     245    its \l{QWidget::show()}{show()} function to display it.
    247246    However, the widget will not be shown until the application's event loop
    248247    is started. We start the event loop by calling the application's
    249248    \l{QApplication::}{exec()} function; the result returned by this function
    250     is used as the return value from the \c main() function.
     249    is used as the return value from the \c main() function. At this point,
     250    it becomes apparent why we instanciated \c AddressBook on the stack: It
     251    will now go out of scope. Therefore, \c AddressBook and all its child widgets
     252    will be deleted, thus preventing memory leaks.
    251253*/
    252254
     
    297299    We also declare two private QString objects, \c oldName and \c oldAddress.
    298300    These objects are needed to hold the name and address of the contact that
    299     was last displayed, before the user clicked "Add". So, when the user clicks
    300     "Cancel", we can revert to displaying the details of the last contact.
     301    was last displayed, before the user clicked \gui Add. So, when the user clicks
     302    \gui Cancel, we can revert to displaying the details of the last contact.
    301303
    302304    \section1 Implementing the AddressBook Class
     
    304306    Within the constructor of \c AddressBook, we set the \c nameLine and
    305307    \c addressText to read-only, so that we can only display but not edit
    306     existing cotact details.
     308    existing contact details.
    307309
    308310    \dots
     
    319321    {show()} function, while the \c submitButton and \c cancelButton are
    320322    hidden by invoking \l{QPushButton::hide()}{hide()}. These two push
    321     buttons will only be displayed when the user clicks "Add" and this is
     323    buttons will only be displayed when the user clicks \gui Add and this is
    322324    handled by the \c addContact() function discussed below.
    323325
     
    363365    \o We extract the contact's details from \c nameLine and \c addressText
    364366    and store them in QString objects. We also validate to make sure that the
    365     user did not click "Submit" with empty input fields; otherwise, a
     367    user did not click \gui Submit with empty input fields; otherwise, a
    366368    QMessageBox is displayed to remind the user for a name and address.
    367369
     
    375377
    376378    If the contact already exists, again, we display a QMessageBox to inform
    377     the user about this, to prevent the user from adding duplicate contacts.
    378     Our \c contacts object is based on key-value pairs of name and addresses,
     379    the user about this, preventing the user from adding duplicate contacts.
     380    Our \c contacts object is based on key-value pairs of name and address,
    379381    hence, we want to ensure that \e key is unique.
    380382
     
    397399    \snippet tutorials/addressbook/part2/addressbook.cpp cancel
    398400
    399     The general idea to add a contact is to give the user the flexibility to
    400     click "Submit" or "Cancel" at any time. The flowchart below further
    401     explains this concept:
     401    The general idea behind adding a contact is to give the user the
     402    flexibility to click \gui Submit or \gui Cancel at any time. The flowchart below
     403    further explains this concept:
    402404
    403405    \image addressbook-tutorial-part2-add-flowchart.png
     
    455457
    456458    The image below is our expected graphical user interface. Notice that it
    457     is getting closer to our expected final output.
     459    is getting closer to our final application.
    458460
    459461    \image addressbook-tutorial-part3-screenshot.png
     
    511513        \o If the iterator is at the end of \c contacts, we clear the
    512514        display and return.
    513         \o If the iterator is the beginning of \c contacts, we move it to
     515        \o If the iterator is at the beginning of \c contacts, we move it to
    514516        the end.
    515517        \o We then decrement the iterator by one.
     
    530532    \title Address Book 4 - Editing and Removing Addresses
    531533
    532     In this chapter, we look at ways to modify the contents of contact stored
     534    In this chapter, we look at ways to modify the contents of contacts stored
    533535    in the address book application.
    534536
     
    540542    when needed. However, this requires a little improvement, in the form of
    541543    enums. In our previous chapters, we had two modes: \c{AddingMode} and
    542     \c{NavigationMode} - but they weren't defined as enums. Instead, we
     544    \c{NavigationMode} - but they were not defined as enums. Instead, we
    543545    enabled and disabled the corresponding buttons manually, resulting in
    544546    multiple lines of repeated code.
     
    574576    \snippet tutorials/addressbook/part4/addressbook.h mode declaration
    575577
    576     Lastly, we declare \c currentMode to keep track of the current mode of the
    577     enum.
     578    Lastly, we declare \c currentMode to keep track of the enum's current mode.
    578579
    579580    \section1 Implementing the AddressBook Class
     
    645646    \snippet tutorials/addressbook/part4/addressbook.cpp update interface() part 1
    646647
    647     For \c NavigationMode, however, we include conditions within the
    648     parameters of the QPushButton::setEnabled(). This is to ensure that
    649     the \c editButton and \c removeButton push buttons are enabled when there
    650     is at least one contact in the address book; \c nextButton and \c previousButton
    651     are only enabled when there is more than one contact in the address book.
     648    For \c NavigationMode, however, we include conditions within the parameters
     649    of the QPushButton::setEnabled() function. This is to ensure that
     650    \c editButton and \c removeButton are enabled when there is at least one
     651    contact in the address book; \c nextButton and \c previousButton are only
     652    enabled when there is more than one contact in the address book.
    652653
    653654    \snippet tutorials/addressbook/part4/addressbook.cpp update interface() part 2
     
    696697    \snippet tutorials/addressbook/part5/finddialog.h FindDialog header
    697698
    698     We define a public function, \c getFindText() for use by classes that
    699     instantiate \c FindDialog, which allows them to obtain the text
    700     entered by the user. A public slot, \c findClicked(), is defined to
    701     handle the search string when the user clicks the \gui Find button.
     699    We define a public function, \c getFindText(), to be used by classes that
     700    instantiate \c FindDialog. This function allows these classes to obtain the
     701    search string entered by the user. A public slot, \c findClicked(), is also
     702    defined to handle the search string when the user clicks the \gui Find
     703    button.
    702704
    703705    Lastly, we define the private variables, \c findButton, \c lineEdit
     
    714716    \snippet tutorials/addressbook/part5/finddialog.cpp constructor
    715717
    716     We set the layout and window title, as well as connect the signals
    717     to their respective slots. Notice that \c{findButton}'s
    718     \l{QPushButton::clicked()}{clicked()} signal is connected to to
    719     \c findClicked() and \l{QDialog::accept()}{accept()}. The
    720     \l{QDialog::accept()}{accept()} slot provided by QDialog hides
    721     the dialog and sets the result code to \l{QDialog::}{Accepted}.
    722     We use this function to help \c{AddressBook}'s \c findContact() function
    723     know when the \c FindDialog object has been closed. This will be
    724     further explained when discussing the \c findContact() function.
     718    We set the layout and window title, as well as connect the signals to their
     719    respective slots. Notice that \c{findButton}'s \l{QPushButton::clicked()}
     720    {clicked()} signal is connected to to \c findClicked() and
     721    \l{QDialog::accept()}{accept()}. The \l{QDialog::accept()}{accept()} slot
     722    provided by QDialog hides the dialog and sets the result code to
     723    \l{QDialog::}{Accepted}. We use this function to help \c{AddressBook}'s
     724    \c findContact() function know when the \c FindDialog object has been
     725    closed. We will explain this logic in further detail when discussing the
     726    \c findContact() function.
    725727
    726728    \image addressbook-tutorial-part5-signals-and-slots.png
     
    816818    \image addressbook-tutorial-part6-screenshot.png
    817819
    818     Although browsing and searching for contacts are useful features, our address
    819     book is not really fully ready for use until we can saving existing contacts
    820     and load them again at a later time.
    821     Qt provides a number of classes for \l{Input/Output and Networking}{input and output},
    822     but we have chosen to use two which are simple to use in combination: QFile and
    823     QDataStream.
    824 
    825     A QFile object represents a file on disk that can be read from and written to.
    826     QFile is a subclass of the more general QIODevice class which represents many
    827     different kinds of devices.
    828 
    829     A QDataStream object is used to serialize binary data so that it can be stored
    830     in a QIODevice and retrieved again later. Reading from a QIODevice and writing
    831     to it is as simple as opening the stream - with the respective device as a
    832     parameter - and reading from or writing to it.
     820    Although browsing and searching for contacts are useful features, our
     821    address book is not ready for use until we can save existing contacts and
     822    load them again at a later time.
     823
     824    Qt provides a number of classes for \l{Input/Output and Networking}
     825    {input and output}, but we have chosen to use two which are simple to use
     826    in combination: QFile and QDataStream.
     827
     828    A QFile object represents a file on disk that can be read from and written
     829    to. QFile is a subclass of the more general QIODevice class which
     830    represents many different kinds of devices.
     831
     832    A QDataStream object is used to serialize binary data so that it can be
     833    stored in a QIODevice and retrieved again later. Reading from a QIODevice
     834    and writing to it is as simple as opening the stream - with the respective
     835    device as a parameter - and reading from or writing to it.
     836
    833837
    834838    \section1 Defining the AddressBook Class
     
    872876    \image addressbook-tutorial-part6-save.png
    873877
    874     If \c fileName is not empty, we create a QFile object, \c file with
     878    If \c fileName is not empty, we create a QFile object, \c file, with
    875879    \c fileName. QFile works with QDataStream as QFile is a QIODevice.
    876880
     
    902906
    903907    If \c fileName is not empty, again, we use a QFile object, \c file, and
    904     attempt to open it in \l{QIODevice::}{ReadOnly} mode. In a similar way
    905     to our implementation of \c saveToFile(), if this attempt is unsuccessful,
    906     we display a QMessageBox to inform the user.
     908    attempt to open it in \l{QIODevice::}{ReadOnly} mode. Similar to our
     909    implementation of \c saveToFile(), if this attempt is unsuccessful, we
     910    display a QMessageBox to inform the user.
    907911
    908912    \snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part2
     
    910914    Otherwise, we instantiate a QDataStream object, \c in, set its version as
    911915    above and read the serialized data into the \c contacts data structure.
    912     Note that we empty \c contacts before reading data into it to simplify the
    913     file reading process. A more advanced method would be to read the contacts
    914     into temporary QMap object, and copy only the contacts that do not already
    915     exist in \c contacts.
     916    The \c contacts object is emptied before data is read into it to simplify
     917    the file reading process. A more advanced method would be to read the
     918    contacts into a temporary QMap object, and copy over non-duplicate contacts
     919    into \c contacts.
    916920
    917921    \snippet tutorials/addressbook/part6/addressbook.cpp loadFromFile() function part3
  • trunk/doc/src/tutorials/widgets-tutorial.qdoc

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information (qt-info@nokia.com)
     4** All rights reserved.
     5** Contact: Nokia Corporation (qt-info@nokia.com)
    56**
    67** This file is part of the documentation of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     24** In addition, as a special exception, Nokia gives you certain additional
     25** rights.  These rights are described in the Nokia Qt LGPL Exception
     26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you have questions regarding the use of this file, please contact
     37** Nokia at qt-info@nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    4242/*!
    4343    \page widgets-tutorial.html
    44 
    4544    \title Widgets Tutorial
    46     \ingroup tutorials
    47 
    48     \brief This tutorial covers basic usage of widgets and layouts, showing how they are used to build GUI applications.
     45    \brief This tutorial covers basic usage of widgets and layouts, showing how
     46    they are used to build GUI applications.
     47
     48    \startpage {index.html}{Qt Reference Documentation}
     49    \contentspage Tutorials
     50    \nextpage {tutorials/widgets/toplevel}{Creating a Window}
     51
    4952
    5053    \section1 Introduction
     
    6972    the widgets it contains are automatically deleted.
    7073
    71     \section1 Creating a Window
     74    \section1 Writing a main Function
     75
     76    Many of the GUI examples in Qt follow the pattern of having a \c{main.cpp}
     77    file containing code to initialize the application, and a number of other
     78    source and header files containing the application logic and custom GUI
     79    components.
     80
     81    A typical \c main() function, written in \c{main.cpp}, looks like this:
     82
     83    \snippet doc/src/snippets/widgets-tutorial/template.cpp main.cpp body
     84
     85    We first construct a QApplication object which is configured using any
     86    arguments passed in from the command line. After any widgets have been
     87    created and shown, we call QApplication::exec() to start Qt's event loop.
     88    Control passes to Qt until this function returns, at which point we return
     89    the value we obtain from this function.
     90
     91    In each part of this tutorial, we provide an example that is written
     92    entirely within a \c main() function. In more sophisticated examples, the
     93    code to set up widgets and layouts is written in other parts of the
     94    example. For example, the GUI for a main window may be set up in the
     95    constructor of a QMainWindow subclass.
     96
     97    The \l{Widgets examples} are a good place to look for
     98    more complex and complete examples and applications.
     99
     100    \section1 Building Examples and Tutorials
     101
     102    If you obtained a binary package of Qt or compiled it yourself, the
     103    examples described in this tutorial should already be ready to run.
     104    However, if you may wish to modify them and recompile them, you need to
     105    perform the following steps:
     106
     107    \list 1
     108    \o At the command line, enter the directory containing the example you
     109       wish to recompile.
     110    \o Type \c qmake and press \key{Return}. If this doesn't work, make sure
     111       that the executable is on your path, or enter its full location.
     112    \o On Linux/Unix and Mac OS X, type \c make and press \key{Return};
     113       on Windows with Visual Studio, type \c nmake and press \key{Return}.
     114    \endlist
     115
     116    An executable file should have been created within the current directory.
     117    On Windows, this file may be located within a \c debug or \c release
     118    subdirectory. You can run this file to see the example code at work.
     119*/
     120
     121/*!
     122    \page widgets-tutorial-toplevel.html
     123    \contentspage {Widgets Tutorial}{Contents}
     124    \previouspage {Widgets Tutorial}
     125    \nextpage {Widgets Tutorial - Child Widgets}
     126    \example tutorials/widgets/toplevel
     127    \title Widgets Tutorial - Creating a Window
    72128
    73129    If a widget is created without a parent, it is treated as a window, or
     
    83139    <tr class="qt-code"><td>
    84140    \endraw
    85     \snippet snippets/widgets-tutorial/toplevel/main.cpp create, resize and show
     141    \snippet tutorials/widgets/toplevel/main.cpp main program
    86142    \raw HTML
    87143    </td><td align="right">
     
    93149    \endraw
    94150
    95     We can add a child widget to this window by passing \c window as the
    96     parent to its constructor. In this case, we add a button to the window
    97     and place it in a specific location:
    98 
    99     \raw HTML
    100     <table align="left" width="100%">
    101     <tr class="qt-code"><td>
    102     \endraw
    103     \snippet snippets/widgets-tutorial/childwidget/main.cpp create, position and show
     151    To create a real GUI, we need to place widgets inside the window. To do
     152    this, we pass a QWidget instance to a widget's constructor, as we will
     153    demonstrate in the next part of this tutorial.
     154*/
     155
     156/*!
     157    \page widgets-tutorial-childwidget.html
     158    \contentspage {Widgets Tutorial}{Contents}
     159    \previouspage {Widgets Tutorial - Creating a Window}
     160    \nextpage {Widgets Tutorial - Using Layouts}
     161    \example tutorials/widgets/childwidget
     162    \title Widgets Tutorial - Child Widgets
     163
     164    We can add a child widget to the window created in the previous example by
     165    passing \c window as the parent to its constructor. In this case, we add a
     166    button to the window and place it in a specific location:
     167
     168    \raw HTML
     169    <table align="left" width="100%">
     170    <tr class="qt-code"><td>
     171    \endraw
     172    \snippet tutorials/widgets/childwidget/main.cpp main program
    104173    \raw HTML
    105174    </td><td align="right">
     
    113182    The button is now a child of the window and will be deleted when the
    114183    window is destroyed. Note that hiding or closing the window does not
    115     automatically destroy it.
    116 
    117     \section1 Using Layouts
     184    automatically destroy it. It will be destroyed when the example exits.
     185*/
     186
     187/*!
     188    \page widgets-tutorial-windowlayout.html
     189    \contentspage {Widgets Tutorial}{Contents}
     190    \previouspage {Widgets Tutorial - Child Widgets}
     191    \nextpage {Widgets Tutorial - Nested Layouts}
     192    \example tutorials/widgets/windowlayout
     193    \title Widgets Tutorial - Using Layouts
    118194
    119195    Usually, child widgets are arranged inside a window using layout objects
     
    126202    <tr class="qt-code"><td>
    127203    \endraw
    128     \snippet snippets/widgets-tutorial/windowlayout/main.cpp create, lay out widgets and show
     204    \snippet tutorials/widgets/windowlayout/main.cpp main program
    129205    \raw HTML
    130206    </td><td align="right">
     
    150226    widgets and the layout itself are ''reparented'' to become children of
    151227    the window.
     228*/
     229
     230/*!
     231    \page widgets-tutorial-nestedlayouts.html
     232    \contentspage {Widgets Tutorial}{Contents}
     233    \previouspage {Widgets Tutorial - Using Layouts}
     234    \example tutorials/widgets/nestedlayouts
     235    \title Widgets Tutorial - Nested Layouts
    152236
    153237    Just as widgets can contain other widgets, layouts can be used to provide
     
    156240    showing the results of a query.
    157241
    158     \raw HTML
    159     <table align="left" width="100%">
    160     <tr class="qt-code"><td>
    161     \endraw
    162     \snippet snippets/widgets-tutorial/nestedlayouts/main.cpp create, lay out widgets and show
     242    We achieve this by creating two layouts: \c{queryLayout} is a QHBoxLayout
     243    that contains QLabel and QLineEdit widgets placed side-by-side;
     244    \c{mainLayout} is a QVBoxLayout that contains \c{queryLayout} and a
     245    QTableView arranged vertically.
     246
     247    \raw HTML
     248    <table align="left" width="100%">
     249    <tr class="qt-code"><td>
     250    \endraw
     251    \snippet tutorials/widgets/nestedlayouts/main.cpp first part
     252    \snippet tutorials/widgets/nestedlayouts/main.cpp last part
    163253    \raw HTML
    164254    </td><td align="right">
     
    169259    </table>
    170260    \endraw
     261
     262    Note that we call the \c{mainLayout}'s \l{QBoxLayout::}{addLayout()}
     263    function to insert the \c{queryLayout} above the \c{resultView} table.
     264
     265    We have omitted the code that sets up the model containing the data shown
     266    by the QTableView widget, \c resultView. For completeness, we show this below.
    171267
    172268    As well as QHBoxLayout and QVBoxLayout, Qt also provides QGridLayout
    173269    and QFormLayout classes to help with more complex user interfaces.
    174 */
     270    These can be seen if you run \l{Qt Designer}.
     271
     272    \section1 Setting up the Model
     273
     274    In the code above, we did not show where the table's data came from
     275    because we wanted to concentrate on the use of layouts. Here, we see
     276    that the model holds a number of items corresponding to rows, each of
     277    which is set up to contain data for two columns.
     278
     279    \snippet tutorials/widgets/nestedlayouts/main.cpp set up the model
     280
     281    The use of models and views is covered in the
     282    \l{Item Views Examples} and in the \l{Model/View Programming} overview.
     283*/
Note: See TracChangeset for help on using the changeset viewer.