From 23b2d2ada5b1b66ad65eda10d70b5b48d32ef9c5 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 5 Mar 2018 16:19:40 +0100 Subject: Doc: Update Event Transitions Example - added screenshot - some modifications to the text Task-number QTBUG-60635 Change-Id: I57b269f93cdba696b424b5ba008d0f46ac612cda Reviewed-by: Martin Smith --- examples/widgets/doc/src/eventtransitions.qdoc | 27 +++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/src/eventtransitions.qdoc b/examples/widgets/doc/src/eventtransitions.qdoc index 2c59d0863d..4d332c0e00 100644 --- a/examples/widgets/doc/src/eventtransitions.qdoc +++ b/examples/widgets/doc/src/eventtransitions.qdoc @@ -29,17 +29,29 @@ \example statemachine/eventtransitions \title Event Transitions Example - \brief The Event Transitions example shows how to use event transitions, a - feature of \l{The State Machine Framework}. + \brief The Event Transitions example shows how to use event transitions, + a feature of \l{The State Machine Framework}. + + The Event Transitions Example illustrates how states change when a + user enters or leaves the area of a button. The states are handled by + a QStateMachine object. The screen consists of a QVBoxLayout with a + central button. + + When the mouse is outside the button, the text in the button displays + "Outside". When the mouse enters the button, it displays "Inside". + + \borderedimage transitions.png \snippet statemachine/eventtransitions/main.cpp 0 The \c Window class's constructors begins by creating a button. + This button is added to \c layout, which is a QVBoxLayout object. + Then two states are created: \s1 is the state + "Outside", and \c s2 is the state "Inside". \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. + State \c s1 is the state "Outside" and state \c s2 is state "Inside". \snippet statemachine/eventtransitions/main.cpp 2 @@ -54,11 +66,11 @@ \snippet statemachine/eventtransitions/main.cpp 4 - Next, the state \c s3 is created. \c s3 will be entered when the button + Next, state \c s3 is created. \c s3 will be entered when the button receives an event of type QEvent::MouseButtonPress and the state machine is in state \c s2. When the button receives an event of type QEvent::MouseButtonRelease and the state machine is in state \c s3, the - machine will transition back to state \c s2. + machine will revert to state \c s2. \snippet statemachine/eventtransitions/main.cpp 5 @@ -67,6 +79,7 @@ \snippet statemachine/eventtransitions/main.cpp 6 - The main() function constructs a Window object and shows it. + The main() function constructs a Window object that displays the QVBoxLayout + object \c layout with its \c button. */ -- cgit v1.2.3 From cb577004566e66c65bcdf53b5a84f0a41f039174 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 8 Mar 2018 14:29:06 +0100 Subject: Doc: Update Find Files example - review text - update screenshot Task-number: QTBUG-60635 Change-Id: I596ce0e08be9ed9aea7834eeda1c3c2c19c28d7a Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/findfiles.qdoc | 105 ++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 39 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/src/findfiles.qdoc b/examples/widgets/doc/src/findfiles.qdoc index a2eb326519..ad39b003ae 100644 --- a/examples/widgets/doc/src/findfiles.qdoc +++ b/examples/widgets/doc/src/findfiles.qdoc @@ -30,43 +30,74 @@ \title Find Files Example \ingroup examples-dialogs - \brief The Find Files example shows how to use QProgressDialog to provide - feedback on the progress of a slow operation. The example also - shows how to use QFileDialog to facilitate browsing, how to use - QTextStream's streaming operators to read a file, and how to use - QTableWidget to provide standard table display facilities for - applications. In addition, files can be opened using the - QDesktopServices class. + \brief A dialog for finding files in a specified folder + + The Find Files application allows the user to search for files in a + specified directory, matching a given file name or wildcard, + and containing a specified string (if filled in). The search + result is displayed in a table containing the names of the files + and their sizes. The application also shows the number of files found. + + The Find Files example illustrates the use of several classes: + + \table + \row + \li QProgressDialog + \li Provide feedback on the progress of a search operation + \row + \li QFileDialog + \li Browse through a file list + \row + \li QTextStream + \li Use stream operators to read a file + \row + \li QTableWidget + \li Browse through the search results in a table + \row + \li QDesktopServices + \li Open files in the result list in a suitable application + \endtable \image findfiles-example.png Screenshot of the Find Files example - With the Find Files application the user can search for files in a - specified directory, matching a specified file name (using wild - cards if appropriate) and containing a specified text. - - The user is provided with a \uicontrol Browse option, and the result of - the search is displayed in a table with the names of the files - found and their sizes. In addition the application provides a - total count of the files found. \section1 Window Class Definition The \c Window class inherits QWidget, and is the main application - widget. It shows the search options, and displays the search + widget. It shows the search options and displays the search results. \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 - find() slot is called whenever the user requests a search to be - performed by pressing the \uicontrol Find button. - - In addition we declare several private functions: We use the \c - findFiles() function to search for files matching the user's - specifications, we call the \c showFiles() function to display the - results, and we use \c createButton(), \c createComboBox() and \c - createFilesTable() when we are constructing the widget. + The application has two private slots: + \table + \row + \li The \c browse() slot + \li Called whenever the user wants to browse for a directory to search in + \row + \li The \c find() slot + \li Called whenever the user launches a search with the \uicontrol Find button + \endtable + + In addition we declare several private functions: + + \table + \row + \li findFiles() + \li Search for files matching the search parameters + \row + \li showFiles() + \li Display the search result + \row + \li ceateButton() + \li Construct the widget + \row + \li createComboBox() + \li Construct the widget + \row + \li createFilesTable() + \li Construct the widget + \endtable \section1 Window Class Implementation @@ -103,11 +134,11 @@ Here we use the static QFileDialog::getExistingDirectory() function which returns an existing directory selected by the user. Then we display the directory in the directory combobox - using the QComboBox::addItem() function, and updates the current + using the QComboBox::addItem() function and update the current index. QComboBox::addItem() adds an item to the combobox with the given - text (if it is not already present in the list), and containing + text (if not already present in the list), and containing the specified userData. The item is appended to the list of existing items. @@ -118,13 +149,13 @@ First we eliminate any previous search results by setting the table widgets row count to zero. Then we retrieve the - specified file name, text and directory path from the respective + specified file name, text, and directory path from the respective comboboxes. \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. + provides access to the directory structure and its contents. We use QDirIterator to iterate over the files that match the specified file name and build a QStringList of paths. @@ -144,15 +175,11 @@ In the private \c findFiles() function we search through a list of files, looking for the ones that contain a specified text. This can be a very slow operation depending on the number of files as - well as their sizes. In case there are a large number of files, or - there exists some large files on the list, we provide a - QProgressDialog. - - The QProgressDialog class provides feedback on the progress of a - slow operation. It is used to give the user an indication of how - long an operation is going to take, and to demonstrate that the - application has not frozen. It can also give the user an - opportunity to abort the operation. + well as their sizes. QProgressDialog displays a progress dialog + if the application has to search through a large number of files, + or if some of the files have a large size. QProgressDialog can + also allow the user to abort the operation if it takes too much + time. \snippet dialogs/findfiles/window.cpp 6 -- cgit v1.2.3 From 5c240f380aa936a4f0a781c035fcd148cd4b3720 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Mon, 12 Mar 2018 16:51:01 +0100 Subject: Doc: Add brief statements to Address Book Example chapters Task-number: QTBUG-60635 Change-Id: Ice6d2b6a475ba4352a87bb46366826334aed2af2 Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/doc/src/addressbook-tutorial.qdoc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/widgets/doc/src/addressbook-tutorial.qdoc b/examples/widgets/doc/src/addressbook-tutorial.qdoc index 31d1d64dac..1f6966e8ae 100644 --- a/examples/widgets/doc/src/addressbook-tutorial.qdoc +++ b/examples/widgets/doc/src/addressbook-tutorial.qdoc @@ -80,7 +80,7 @@ /*! \example tutorials/addressbook/part1 \title Part 1 - Designing the User Interface - + \brief Describes how to code the user interface of the Address Book Example. This first part covers the design of the basic graphical user interface (GUI) for our address book application. @@ -232,6 +232,7 @@ /*! \example tutorials/addressbook/part2 \title Part 2 - Adding Addresses + \brief Describes the code for inserting records in the Address Book Example. The next step in creating the address book is to implement some user interactions. @@ -381,9 +382,10 @@ /*! \example tutorials/addressbook/part3 \title Part 3 - Navigating between Entries + \brief Explains the code that enables navigating the contacts. The address book is now about half complete. We should add the - capability to navigate among the contacts, but first we must + capability to navigate the contacts, but first we must decide what sort of a data structure we need for containing these contacts. @@ -496,6 +498,7 @@ /*! \example tutorials/addressbook/part4 \title Part 4 - Editing and Removing Addresses + \brief Explains how to add edit and remove functionality. Now we look at ways to modify the contents of contacts stored in the address book. @@ -628,6 +631,7 @@ /*! \example tutorials/addressbook/part5 \title Part 5 - Adding a Find Function + \brief Describes how to add a find function. Here we look at ways to locate contacts and addresses in the address book. @@ -770,6 +774,7 @@ /*! \example tutorials/addressbook/part6 \title Part 6 - Loading and Saving + \brief Describes how to add save and load functionality. This part covers the Qt file handling features we use to write loading and saving routines for the address book. @@ -890,6 +895,7 @@ /*! \example tutorials/addressbook/part7 \title Part 7 - Additional Features + \brief Describes how to export data in VCard format. This part covers some additional features that make the address book more convenient for the frequent user. -- cgit v1.2.3 From 5ffd47b76418eb4ef3369a78471cd6567c4659d0 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 20 Mar 2018 10:41:04 +0100 Subject: Doc: Update connect syntax in I18n Widgets Example Task-number: QTBUG-60635 Change-Id: Icfa0d09ac6c9ad4396fbe1138277bb1dd866a803 Reviewed-by: Paul Wicking Reviewed-by: Venugopal Shivashankar --- examples/widgets/tools/i18n/languagechooser.cpp | 9 ++++++--- examples/widgets/tools/i18n/mainwindow.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp index 83aafe6b8a..58cf9d4047 100644 --- a/examples/widgets/tools/i18n/languagechooser.cpp +++ b/examples/widgets/tools/i18n/languagechooser.cpp @@ -70,7 +70,10 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent) for (int i = 0; i < qmFiles.size(); ++i) { QCheckBox *checkBox = new QCheckBox(languageName(qmFiles[i])); qmFileForCheckBoxMap.insert(checkBox, qmFiles[i]); - connect(checkBox, SIGNAL(toggled(bool)), this, SLOT(checkBoxToggled())); + connect(checkBox, + QOverload::of(&QCheckBox::toggled), + this, + &LanguageChooser::checkBoxToggled); if (languageMatch(defaultLang, qmFiles[i])) checkBox->setCheckState(Qt::Checked); groupBoxLayout->addWidget(checkBox, i / 2, i % 2); @@ -84,8 +87,8 @@ LanguageChooser::LanguageChooser(const QString& defaultLang, QWidget *parent) hideAllButton = buttonBox->addButton("Hide All", QDialogButtonBox::ActionRole); - connect(showAllButton, SIGNAL(clicked()), this, SLOT(showAll())); - connect(hideAllButton, SIGNAL(clicked()), this, SLOT(hideAll())); + connect(showAllButton, &QAbstractButton::clicked, this, &LanguageChooser::showAll); + connect(hideAllButton, &QAbstractButton::clicked, this, &LanguageChooser::hideAll); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(groupBox); diff --git a/examples/widgets/tools/i18n/mainwindow.cpp b/examples/widgets/tools/i18n/mainwindow.cpp index d5de81cab7..6ebfddfa98 100644 --- a/examples/widgets/tools/i18n/mainwindow.cpp +++ b/examples/widgets/tools/i18n/mainwindow.cpp @@ -76,7 +76,7 @@ MainWindow::MainWindow() centralWidget->setLayout(mainLayout); exitAction = new QAction(tr("E&xit"), this); - connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); + connect(exitAction, &QAction::triggered, qApp, QApplication::quit); fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->setPalette(QPalette(Qt::red)); -- cgit v1.2.3