summaryrefslogtreecommitdiffstats
path: root/src/gui/doc
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-08-29 14:10:22 +0200
committerPaul Wicking <paul.wicking@qt.io>2020-09-01 06:13:08 +0200
commitb16b7d887980fbdbb2e12867e2d14b81c0361654 (patch)
treec751cf195a70c02ddaee4c57af50cda60cbdebff /src/gui/doc
parente81383eb0994a37b9489a2aebd0459e161dbeed2 (diff)
Doc: Compile textdocument-tables snippets
Minor code cleanup in passing. Task-number: QTBUG-81486 Change-Id: I23f8b3a22f627050582c69c81e5e0b85b5e45768 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/gui/doc')
-rw-r--r--src/gui/doc/snippets/snippets.pro3
-rw-r--r--src/gui/doc/snippets/textdocument-tables/main.cpp5
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.cpp6
-rw-r--r--src/gui/doc/snippets/textdocument-tables/mainwindow.h3
-rw-r--r--src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro13
5 files changed, 18 insertions, 12 deletions
diff --git a/src/gui/doc/snippets/snippets.pro b/src/gui/doc/snippets/snippets.pro
index d9abd0f5e1..78fd334bfc 100644
--- a/src/gui/doc/snippets/snippets.pro
+++ b/src/gui/doc/snippets/snippets.pro
@@ -23,5 +23,6 @@ contains(QT_BUILD_PARTS, tests) {
textdocument-lists \
textdocument-printing \
textdocument-resources \
- textdocument-selections
+ textdocument-selections \
+ textdocument-tables
}
diff --git a/src/gui/doc/snippets/textdocument-tables/main.cpp b/src/gui/doc/snippets/textdocument-tables/main.cpp
index f37ea92dc4..811aaded9a 100644
--- a/src/gui/doc/snippets/textdocument-tables/main.cpp
+++ b/src/gui/doc/snippets/textdocument-tables/main.cpp
@@ -47,11 +47,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#include <QtGui>
-
#include "mainwindow.h"
+#include <QApplication>
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
index 5d6fff47fd..7712362d57 100644
--- a/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.cpp
@@ -131,9 +131,9 @@ MainWindow::MainWindow()
}
//! [8]
- connect(saveAction, &QAction:triggered, this, &MainWindow::saveFile);
- connect(quitAction, &QAction:triggered, this, &MainWindow::close);
- connect(showTableAction, &QAction:triggered, this, &MainWindow::showTable);
+ connect(saveAction, &QAction::triggered, this, &MainWindow::saveFile);
+ connect(quitAction, &QAction::triggered, this, &MainWindow::close);
+ connect(showTableAction, &QAction::triggered, this, &MainWindow::showTable);
setCentralWidget(editor);
setWindowTitle(tr("Text Document Tables"));
diff --git a/src/gui/doc/snippets/textdocument-tables/mainwindow.h b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
index dc26cf3650..b0ff5c1b91 100644
--- a/src/gui/doc/snippets/textdocument-tables/mainwindow.h
+++ b/src/gui/doc/snippets/textdocument-tables/mainwindow.h
@@ -47,7 +47,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
#ifndef WINDOW_H
#define WINDOW_H
@@ -69,7 +68,7 @@ public slots:
private:
bool writeXml(const QString &fileName);
- QTextEdit *editor;
+ QTextEdit *editor = nullptr;
};
#endif
diff --git a/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro b/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
index 12a900a7c6..97081aa333 100644
--- a/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
+++ b/src/gui/doc/snippets/textdocument-tables/textdocument-tables.pro
@@ -1,3 +1,10 @@
-SOURCES = main.cpp \
- mainwindow.cpp
-HEADERS = mainwindow.h
+TEMPLATE = lib
+TARGET = textdocument-tables_snippets
+QT += core gui widgets
+
+HEADERS = \
+ mainwindow.h
+
+SOURCES = \
+ main.cpp \
+ mainwindow.cpp