summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/CMakeLists.txt5
-rw-r--r--src/network/doc/snippets/network/CMakeLists.txt5
-rw-r--r--src/network/doc/snippets/network/tcpwait.cpp7
-rw-r--r--src/sql/CMakeLists.txt5
-rw-r--r--src/sql/doc/snippets/code/CMakeLists.txt13
-rw-r--r--src/sql/doc/snippets/sqldatabase/CMakeLists.txt8
-rw-r--r--src/testlib/CMakeLists.txt5
-rw-r--r--src/testlib/doc/snippets/code/CMakeLists.txt26
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtestevent.cpp8
-rw-r--r--src/testlib/doc/snippets/code/doc_src_qtestevent.h58
-rw-r--r--src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp2
-rw-r--r--src/widgets/CMakeLists.txt11
-rw-r--r--src/widgets/doc/snippets/customstyle/customstyle.cpp2
-rw-r--r--src/widgets/doc/snippets/customstyle/customstyle.h2
-rw-r--r--src/widgets/doc/snippets/customviewstyle/CMakeLists.txt11
-rw-r--r--src/widgets/doc/snippets/filedialogurls/CMakeLists.txt9
-rw-r--r--src/widgets/doc/snippets/graphicssceneadditem/CMakeLists.txt9
-rw-r--r--src/widgets/doc/snippets/graphicsview/CMakeLists.txt12
-rw-r--r--src/widgets/doc/snippets/mdiarea/CMakeLists.txt9
-rw-r--r--src/widgets/doc/snippets/myscrollarea/CMakeLists.txt9
20 files changed, 200 insertions, 16 deletions
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 9c9976441f..38a62f1104 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -432,3 +432,8 @@ qt_internal_add_docs(Network
qt_internal_extend_target(Network CONDITION WIN32 PUBLIC_LIBRARIES ws2_32) # special case: mkspecs/common/msvc-desktop.conf
qt_internal_extend_target(Network CONDITION QNX PUBLIC_LIBRARIES socket) # special case: mkspecs/common/qcc-base-qnx.conf
+
+# include the snippet projects for developer-builds
+if(QT_FEATURE_private_tests)
+ add_subdirectory(doc/snippets/network)
+endif()
diff --git a/src/network/doc/snippets/network/CMakeLists.txt b/src/network/doc/snippets/network/CMakeLists.txt
new file mode 100644
index 0000000000..e1cdcefc76
--- /dev/null
+++ b/src/network/doc/snippets/network/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_library(network_cppsnippets OBJECT tcpwait.cpp)
+
+target_link_libraries(network_cppsnippets PRIVATE
+ Qt::Network
+)
diff --git a/src/network/doc/snippets/network/tcpwait.cpp b/src/network/doc/snippets/network/tcpwait.cpp
index b81c5c1d53..1ccac0850b 100644
--- a/src/network/doc/snippets/network/tcpwait.cpp
+++ b/src/network/doc/snippets/network/tcpwait.cpp
@@ -48,13 +48,10 @@
**
****************************************************************************/
-#include <QCoreApplication>
#include <QTcpSocket>
-int main(int argv, char **args)
+void test_tcpwait()
{
- QCoreApplication app(argv, args);
-
QTcpSocket socket;
socket.connectToHost("localhost", 1025);
@@ -72,6 +69,4 @@ int main(int argv, char **args)
break;
}
//! [0]
-
- return app.exec();
}
diff --git a/src/sql/CMakeLists.txt b/src/sql/CMakeLists.txt
index 43ec949fdd..3398b09a75 100644
--- a/src/sql/CMakeLists.txt
+++ b/src/sql/CMakeLists.txt
@@ -55,3 +55,8 @@ qt_internal_add_docs(Sql
doc/qtsql.qdocconf
)
+# include the snippet projects for developer-builds
+if(QT_FEATURE_private_tests)
+ add_subdirectory(doc/snippets/code)
+ add_subdirectory(doc/snippets/sqldatabase)
+endif()
diff --git a/src/sql/doc/snippets/code/CMakeLists.txt b/src/sql/doc/snippets/code/CMakeLists.txt
new file mode 100644
index 0000000000..4ee4a41312
--- /dev/null
+++ b/src/sql/doc/snippets/code/CMakeLists.txt
@@ -0,0 +1,13 @@
+add_library(code_snippets OBJECT
+ doc_src_sql-driver.cpp
+ src_sql_kernel_qsqldatabase.cpp
+ src_sql_kernel_qsqlerror.cpp
+ src_sql_kernel_qsqlresult.cpp
+ src_sql_kernel_qsqldriver.cpp
+ src_sql_models_qsqlquerymodel.cpp
+)
+
+target_link_libraries(code_snippets PRIVATE
+ Qt::Core
+ Qt::Sql
+)
diff --git a/src/sql/doc/snippets/sqldatabase/CMakeLists.txt b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
new file mode 100644
index 0000000000..80f2ae0b73
--- /dev/null
+++ b/src/sql/doc/snippets/sqldatabase/CMakeLists.txt
@@ -0,0 +1,8 @@
+add_library(sqldatabase_snippets OBJECT
+ sqldatabase.cpp
+)
+
+target_link_libraries(sqldatabase_snippets PRIVATE
+ Qt::Core
+ Qt::Sql
+)
diff --git a/src/testlib/CMakeLists.txt b/src/testlib/CMakeLists.txt
index 35f824af49..56ab1eb4c5 100644
--- a/src/testlib/CMakeLists.txt
+++ b/src/testlib/CMakeLists.txt
@@ -133,3 +133,8 @@ qt_internal_add_docs(Test
# special case begin
qt_internal_apply_testlib_coverage_options(Test)
# special case end
+
+# include the snippet projects for developer-builds
+if(QT_FEATURE_private_tests)
+ add_subdirectory(doc/snippets/code)
+endif()
diff --git a/src/testlib/doc/snippets/code/CMakeLists.txt b/src/testlib/doc/snippets/code/CMakeLists.txt
new file mode 100644
index 0000000000..8a244e4dd6
--- /dev/null
+++ b/src/testlib/doc/snippets/code/CMakeLists.txt
@@ -0,0 +1,26 @@
+add_library(testlib_code_snippets OBJECT
+ doc_src_qtqskip.cpp
+ doc_src_qttest.cpp
+ src_corelib_kernel_qtestsupport_core.cpp
+)
+
+target_link_libraries(testlib_code_snippets PRIVATE
+ Qt::Core
+ Qt::Test
+)
+
+qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_gui AND QT_FEATURE_sql
+ SOURCES
+ doc_src_qtestlib.cpp
+ PUBLIC_LIBRARIES
+ Qt::Gui
+ Qt::Sql
+)
+
+qt_internal_extend_target(testlib_code_snippets CONDITION QT_FEATURE_widgets
+ SOURCES
+ doc_src_qtestevent.cpp
+ doc_src_qtestevent.h
+ PUBLIC_LIBRARIES
+ Qt::Widgets
+)
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
index 1d91ebd644..a987cf79fb 100644
--- a/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
+++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.cpp
@@ -51,13 +51,7 @@
#include <QTest>
#include <QLineEdit>
-// dummy
-class TestGui: public QObject
-{
- Q_OBJECT
-public:
- void testGui_data();
-};
+#include "doc_src_qtestevent.h"
void TestGui::testGui_data()
{
diff --git a/src/testlib/doc/snippets/code/doc_src_qtestevent.h b/src/testlib/doc/snippets/code/doc_src_qtestevent.h
new file mode 100644
index 0000000000..af2bf607f1
--- /dev/null
+++ b/src/testlib/doc/snippets/code/doc_src_qtestevent.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+// dummy
+class TestGui: public QObject
+{
+ Q_OBJECT
+public:
+ void testGui_data();
+};
diff --git a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
index 01f4e11eb4..ceb2743141 100644
--- a/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
+++ b/src/testlib/doc/snippets/code/src_qtestlib_qtestcase.cpp
@@ -49,7 +49,7 @@
****************************************************************************/
#include <QTest>
#include <QSqlDatabase>
-#include <QtGui/qfontdatabase.h>
+#include <QFontDatabase>
#include <initializer_list>
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
index 34c8d2bc1e..7cfe9d05f6 100644
--- a/src/widgets/CMakeLists.txt
+++ b/src/widgets/CMakeLists.txt
@@ -824,3 +824,14 @@ qt_internal_add_docs(Widgets
doc/qtwidgets.qdocconf
)
+# include the snippet projects for developer-builds
+if(QT_FEATURE_private_tests)
+ add_subdirectory(doc/snippets/customviewstyle)
+ add_subdirectory(doc/snippets/filedialogurls)
+ add_subdirectory(doc/snippets/graphicssceneadditem)
+ if(QT_FEATURE_opengl AND QT_FEATURE_printsupport)
+ add_subdirectory(doc/snippets/graphicsview)
+ endif()
+ add_subdirectory(doc/snippets/mdiarea)
+ add_subdirectory(doc/snippets/myscrollarea)
+endif()
diff --git a/src/widgets/doc/snippets/customstyle/customstyle.cpp b/src/widgets/doc/snippets/customstyle/customstyle.cpp
index 61a8ec5600..0f1d5f4b9b 100644
--- a/src/widgets/doc/snippets/customstyle/customstyle.cpp
+++ b/src/widgets/doc/snippets/customstyle/customstyle.cpp
@@ -52,7 +52,7 @@
#include "customstyle.h"
-CustomStyle::CustomStyle()
+CustomStyle::CustomStyle(const QWidget *widget)
{
//! [0]
const QSpinBox *spinBox = qobject_cast<const QSpinBox *>(widget);
diff --git a/src/widgets/doc/snippets/customstyle/customstyle.h b/src/widgets/doc/snippets/customstyle/customstyle.h
index be9edf0bf4..3cadd84650 100644
--- a/src/widgets/doc/snippets/customstyle/customstyle.h
+++ b/src/widgets/doc/snippets/customstyle/customstyle.h
@@ -59,7 +59,7 @@ class CustomStyle : public QProxyStyle
Q_OBJECT
public:
- CustomStyle();
+ CustomStyle(const QWidget *widget);
~CustomStyle() {}
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
diff --git a/src/widgets/doc/snippets/customviewstyle/CMakeLists.txt b/src/widgets/doc/snippets/customviewstyle/CMakeLists.txt
new file mode 100644
index 0000000000..4e9f7ca210
--- /dev/null
+++ b/src/widgets/doc/snippets/customviewstyle/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_library(widgets_customviewstyle_snippets OBJECT
+ ../customstyle/customstyle.h
+ ../customstyle/customstyle.cpp
+ customviewstyle.cpp
+)
+
+target_link_libraries(widgets_customviewstyle_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/widgets/doc/snippets/filedialogurls/CMakeLists.txt b/src/widgets/doc/snippets/filedialogurls/CMakeLists.txt
new file mode 100644
index 0000000000..8fd3d7a4bb
--- /dev/null
+++ b/src/widgets/doc/snippets/filedialogurls/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(widgets_filedialogurl_snippets OBJECT
+ filedialogurls.cpp
+)
+
+target_link_libraries(widgets_filedialogurl_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/widgets/doc/snippets/graphicssceneadditem/CMakeLists.txt b/src/widgets/doc/snippets/graphicssceneadditem/CMakeLists.txt
new file mode 100644
index 0000000000..c9b2c7b377
--- /dev/null
+++ b/src/widgets/doc/snippets/graphicssceneadditem/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(widgets_graphicssceneadditem_snippets OBJECT
+ graphicssceneadditemsnippet.cpp
+)
+
+target_link_libraries(widgets_graphicssceneadditem_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/widgets/doc/snippets/graphicsview/CMakeLists.txt b/src/widgets/doc/snippets/graphicsview/CMakeLists.txt
new file mode 100644
index 0000000000..182709fcd4
--- /dev/null
+++ b/src/widgets/doc/snippets/graphicsview/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_library(widgets_graphicsview_snippets OBJECT
+ graphicsview.cpp
+)
+
+target_link_libraries(widgets_graphicsview_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+ Qt::OpenGL
+ Qt::OpenGLWidgets
+ Qt::PrintSupport
+)
diff --git a/src/widgets/doc/snippets/mdiarea/CMakeLists.txt b/src/widgets/doc/snippets/mdiarea/CMakeLists.txt
new file mode 100644
index 0000000000..e4c2dd93a5
--- /dev/null
+++ b/src/widgets/doc/snippets/mdiarea/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(widgets_mdiarea_snippets OBJECT
+ mdiareasnippets.cpp
+)
+
+target_link_libraries(widgets_mdiarea_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
diff --git a/src/widgets/doc/snippets/myscrollarea/CMakeLists.txt b/src/widgets/doc/snippets/myscrollarea/CMakeLists.txt
new file mode 100644
index 0000000000..49d7e1c81f
--- /dev/null
+++ b/src/widgets/doc/snippets/myscrollarea/CMakeLists.txt
@@ -0,0 +1,9 @@
+add_library(widgets_myscrollarea_snippets OBJECT
+ myscrollarea.cpp
+)
+
+target_link_libraries(widgets_myscrollarea_snippets PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)