diff options
author | Liang Qi <liang.qi@qt.io> | 2017-10-15 21:45:47 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-15 21:47:27 +0200 |
commit | 81eb502b85008c8d50c2e0c947ae59fcf9263f00 (patch) | |
tree | 92bc0a22446bfc8df42bded24f98988ca5f2373e /examples | |
parent | 9099c8934ebc042b38435eae293cd46e4fd9b883 (diff) | |
parent | c7a44cfb5b243028bfe187715297c6deb2c09ffa (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
.qmake.conf
examples/examples.pro
Change-Id: I1b10716619d6a07466db9d5407a958062e7cd38a
Diffstat (limited to 'examples')
-rw-r--r-- | examples/assistant/doc/src/simpletextviewer.qdoc | 17 | ||||
-rw-r--r-- | examples/assistant/remotecontrol/main.cpp | 8 | ||||
-rw-r--r-- | examples/assistant/remotecontrol/remotecontrol.cpp | 15 | ||||
-rw-r--r-- | examples/assistant/remotecontrol/remotecontrol.h | 9 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/assistant.cpp | 17 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/assistant.h | 4 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/findfiledialog.cpp | 26 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/findfiledialog.h | 6 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/main.cpp | 6 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/mainwindow.cpp | 20 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/mainwindow.h | 9 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/textedit.cpp | 8 | ||||
-rw-r--r-- | examples/assistant/simpletextviewer/textedit.h | 8 |
13 files changed, 77 insertions, 76 deletions
diff --git a/examples/assistant/doc/src/simpletextviewer.qdoc b/examples/assistant/doc/src/simpletextviewer.qdoc index 7afef1a78..4954fbfc5 100644 --- a/examples/assistant/doc/src/simpletextviewer.qdoc +++ b/examples/assistant/doc/src/simpletextviewer.qdoc @@ -34,15 +34,14 @@ \image simpletextviewer-example.png - This is done in two stages. Firstly, documentation is created and \QA - is customized; secondly, the functionality to launch and control - \QA is added to the application. + This example shows how to use \QA as a customized help viewer in + a custom application. This is done in two stages. Firstly, + documentation is created and \QA is customized; secondly, the + functionality to launch and control \QA is added to the application. The Simple Text Viewer application lets the user select and view - existing files. - - The application provides its own custom documentation that is - available from the \gui Help menu in the main window's menu bar + existing files. The application provides its own custom documentation + that is available from the \gui Help menu in the main window's menu bar or by clicking the \gui Help button in the application's find file dialog. @@ -353,8 +352,8 @@ The implementation for \c showDocumentation() is now straightforward. Firstly, we ensure that \QA is running, then we send the request to display the \a page via the \c stdin channel of the process. It is very - important here that the command is terminated by the '\\0' character - followed by an end of line token to flush the channel. + important here that the command is terminated by an end of line token + to flush the channel. \snippet simpletextviewer/assistant.cpp 1 diff --git a/examples/assistant/remotecontrol/main.cpp b/examples/assistant/remotecontrol/main.cpp index 3652e6251..ee5201b79 100644 --- a/examples/assistant/remotecontrol/main.cpp +++ b/examples/assistant/remotecontrol/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,16 +48,14 @@ ** ****************************************************************************/ -#include <QtWidgets/QApplication> #include "remotecontrol.h" +#include <QApplication> + int main(int argc, char *argv[]) { - Q_INIT_RESOURCE(remotecontrol); - QApplication a(argc, argv); RemoteControl w; w.show(); - a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); return a.exec(); } diff --git a/examples/assistant/remotecontrol/remotecontrol.cpp b/examples/assistant/remotecontrol/remotecontrol.cpp index 3ee8bb27d..916a08efd 100644 --- a/examples/assistant/remotecontrol/remotecontrol.cpp +++ b/examples/assistant/remotecontrol/remotecontrol.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,15 +48,14 @@ ** ****************************************************************************/ -#include <QtCore/QDir> -#include <QtCore/QProcess> -#include <QtCore/QTextStream> -#include <QtCore/QLibraryInfo> - -#include <QtWidgets/QMessageBox> - #include "remotecontrol.h" +#include <QDir> +#include <QLibraryInfo> +#include <QMessageBox> +#include <QProcess> +#include <QTextStream> + RemoteControl::RemoteControl(QWidget *parent, Qt::WindowFlags flags) : QMainWindow(parent, flags) { diff --git a/examples/assistant/remotecontrol/remotecontrol.h b/examples/assistant/remotecontrol/remotecontrol.h index 16a9f9441..40e370f71 100644 --- a/examples/assistant/remotecontrol/remotecontrol.h +++ b/examples/assistant/remotecontrol/remotecontrol.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,19 +51,20 @@ #ifndef REMOTECONTROL_H #define REMOTECONTROL_H -#include <QtWidgets/QMainWindow> #include "ui_remotecontrol.h" +#include <QMainWindow> + QT_BEGIN_NAMESPACE class QProcess; -QT_END_NAMESPACE; +QT_END_NAMESPACE class RemoteControl : public QMainWindow { Q_OBJECT public: - RemoteControl(QWidget *parent = 0, Qt::WindowFlags flags = 0); + RemoteControl(QWidget *parent = nullptr, Qt::WindowFlags flags = 0); ~RemoteControl(); private: diff --git a/examples/assistant/simpletextviewer/assistant.cpp b/examples/assistant/simpletextviewer/assistant.cpp index a9b2776b6..9e668bb7f 100644 --- a/examples/assistant/simpletextviewer/assistant.cpp +++ b/examples/assistant/simpletextviewer/assistant.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,15 +48,14 @@ ** ****************************************************************************/ -#include <QtCore/QByteArray> -#include <QtCore/QDir> -#include <QtCore/QLibraryInfo> -#include <QtCore/QProcess> - -#include <QtWidgets/QMessageBox> - #include "assistant.h" +#include <QByteArray> +#include <QDir> +#include <QLibraryInfo> +#include <QMessageBox> +#include <QProcess> + Assistant::Assistant() : proc(0) { @@ -109,7 +108,7 @@ bool Assistant::startAssistant() proc->start(app, args); if (!proc->waitForStarted()) { - QMessageBox::critical(0, QObject::tr("Simple Text Viewer"), + QMessageBox::critical(nullptr, QObject::tr("Simple Text Viewer"), QObject::tr("Unable to launch Qt Assistant (%1)").arg(app)); return false; } diff --git a/examples/assistant/simpletextviewer/assistant.h b/examples/assistant/simpletextviewer/assistant.h index fce67f0da..dada5a1ee 100644 --- a/examples/assistant/simpletextviewer/assistant.h +++ b/examples/assistant/simpletextviewer/assistant.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,7 +51,7 @@ #ifndef ASSISTANT_H #define ASSISTANT_H -#include <QtCore/QString> +#include <QString> QT_BEGIN_NAMESPACE class QProcess; diff --git a/examples/assistant/simpletextviewer/findfiledialog.cpp b/examples/assistant/simpletextviewer/findfiledialog.cpp index b34b8aeae..cf64e9a6a 100644 --- a/examples/assistant/simpletextviewer/findfiledialog.cpp +++ b/examples/assistant/simpletextviewer/findfiledialog.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,21 +48,21 @@ ** ****************************************************************************/ -#include <QtCore/QDir> -#include <QtWidgets/QLayout> -#include <QtWidgets/QComboBox> -#include <QtWidgets/QTreeWidget> -#include <QtWidgets/QLayout> -#include <QtWidgets/QFileDialog> -#include <QtWidgets/QDialogButtonBox> -#include <QtWidgets/QToolButton> -#include <QtWidgets/QPushButton> -#include <QtWidgets/QLabel> - -#include "findfiledialog.h" #include "assistant.h" +#include "findfiledialog.h" #include "textedit.h" +#include <QComboBox> +#include <QDialogButtonBox> +#include <QDir> +#include <QFileDialog> +#include <QHBoxLayout> +#include <QLabel> +#include <QPushButton> +#include <QToolButton> +#include <QTreeWidget> +#include <QTreeWidgetItem> + //! [0] FindFileDialog::FindFileDialog(TextEdit *editor, Assistant *assistant) : QDialog(editor) diff --git a/examples/assistant/simpletextviewer/findfiledialog.h b/examples/assistant/simpletextviewer/findfiledialog.h index 2d5b1378a..6ca57b061 100644 --- a/examples/assistant/simpletextviewer/findfiledialog.h +++ b/examples/assistant/simpletextviewer/findfiledialog.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,7 +51,7 @@ #ifndef FINDFILEDIALOG_H #define FINDFILEDIALOG_H -#include <QtWidgets/QDialog> +#include <QDialog> QT_BEGIN_NAMESPACE class QComboBox; @@ -76,7 +76,7 @@ public: private slots: void browse(); void help(); - void openFile(QTreeWidgetItem *item = 0); + void openFile(QTreeWidgetItem *item = nullptr); void update(); private: diff --git a/examples/assistant/simpletextviewer/main.cpp b/examples/assistant/simpletextviewer/main.cpp index 30c886f5a..55c1039f8 100644 --- a/examples/assistant/simpletextviewer/main.cpp +++ b/examples/assistant/simpletextviewer/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,10 +48,10 @@ ** ****************************************************************************/ -#include <QtWidgets/QApplication> - #include "mainwindow.h" +#include <QApplication> + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp index 0660a0426..5b0564ca1 100644 --- a/examples/assistant/simpletextviewer/mainwindow.cpp +++ b/examples/assistant/simpletextviewer/mainwindow.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,18 +48,18 @@ ** ****************************************************************************/ -#include <QtCore/QLibraryInfo> -#include <QtWidgets/QApplication> -#include <QtWidgets/QAction> -#include <QtWidgets/QMenu> -#include <QtWidgets/QMenuBar> -#include <QtWidgets/QMessageBox> - -#include "mainwindow.h" -#include "findfiledialog.h" #include "assistant.h" +#include "findfiledialog.h" +#include "mainwindow.h" #include "textedit.h" +#include <QAction> +#include <QApplication> +#include <QLibraryInfo> +#include <QMenu> +#include <QMenuBar> +#include <QMessageBox> + // ![0] MainWindow::MainWindow() { diff --git a/examples/assistant/simpletextviewer/mainwindow.h b/examples/assistant/simpletextviewer/mainwindow.h index 7026b5eca..e8e917ea3 100644 --- a/examples/assistant/simpletextviewer/mainwindow.h +++ b/examples/assistant/simpletextviewer/mainwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,7 +51,12 @@ #ifndef MAINWINDOW_H #define MAINWINDOW_H -#include <QtWidgets/QMainWindow> +#include <QMainWindow> + +QT_BEGIN_NAMESPACE +class QAction; +class QMenu; +QT_END_NAMESPACE class Assistant; class TextEdit; diff --git a/examples/assistant/simpletextviewer/textedit.cpp b/examples/assistant/simpletextviewer/textedit.cpp index 81cb3251a..18cd767eb 100644 --- a/examples/assistant/simpletextviewer/textedit.cpp +++ b/examples/assistant/simpletextviewer/textedit.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -48,11 +48,11 @@ ** ****************************************************************************/ -#include <QtCore/QFileInfo> -#include <QtCore/QFile> - #include "textedit.h" +#include <QFile> +#include <QFileInfo> + TextEdit::TextEdit(QWidget *parent) : QTextEdit(parent) { diff --git a/examples/assistant/simpletextviewer/textedit.h b/examples/assistant/simpletextviewer/textedit.h index 70bcf75af..b1cb243fb 100644 --- a/examples/assistant/simpletextviewer/textedit.h +++ b/examples/assistant/simpletextviewer/textedit.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,15 +51,15 @@ #ifndef TEXTEDIT_H #define TEXTEDIT_H -#include <QtCore/QUrl> -#include <QtWidgets/QTextEdit> +#include <QTextEdit> +#include <QUrl> class TextEdit : public QTextEdit { Q_OBJECT public: - TextEdit(QWidget *parent = 0); + TextEdit(QWidget *parent = nullptr); void setContents(const QString &fileName); private: |