From 84cfb1aaa663c9312ef9f36d540d49a1b0d941d4 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Tue, 22 Sep 2020 07:45:05 +0200 Subject: [PATCH] Doc: Make widgets snippets a subdirs/lib project Task-number: QTBUG-86497 Change-Id: Ia43f9eb3bf8a3d2f6e76a1932179aaa94266540b Reviewed-by: Joerg Bornemann (cherry picked from commit f4ee89363ec40cac2b29cf0677e7655c45739a7f) Reviewed-by: Paul Wicking --- .../customviewstyle/customviewstyle.cpp | 2 +- .../customviewstyle/customviewstyle.pro | 10 ++++++++ .../filedialogurls/filedialogurls.pro | 6 +++++ .../graphicssceneadditem.pro | 6 +++++ .../snippets/graphicsview/graphicsview.cpp | 15 ++++++------ .../snippets/graphicsview/graphicsview.pro | 6 +++++ src/widgets/doc/snippets/mdiarea/mdiarea.pro | 7 ++++++ .../doc/snippets/mdiarea/mdiareasnippets.cpp | 22 ----------------- .../snippets/myscrollarea/myscrollarea.pro | 7 ++++++ src/widgets/doc/snippets/snippets.pro | 24 +++++++++++-------- 10 files changed, 65 insertions(+), 40 deletions(-) create mode 100644 src/widgets/doc/snippets/customviewstyle/customviewstyle.pro create mode 100644 src/widgets/doc/snippets/filedialogurls/filedialogurls.pro create mode 100644 src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditem.pro create mode 100644 src/widgets/doc/snippets/graphicsview/graphicsview.pro create mode 100644 src/widgets/doc/snippets/mdiarea/mdiarea.pro create mode 100644 src/widgets/doc/snippets/myscrollarea/myscrollarea.pro diff --git a/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp index 1e4cf2b711..1523c5db5e 100644 --- a/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp +++ b/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp @@ -50,7 +50,7 @@ #include -#include "./customstyle/customstyle.h" +#include "../customstyle/customstyle.h" void CustomStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const diff --git a/src/widgets/doc/snippets/customviewstyle/customviewstyle.pro b/src/widgets/doc/snippets/customviewstyle/customviewstyle.pro new file mode 100644 index 0000000000..9b09e5e4f3 --- /dev/null +++ b/src/widgets/doc/snippets/customviewstyle/customviewstyle.pro @@ -0,0 +1,10 @@ +TEMPLATE = lib +TARGET = widgets_customviewstyle_snippets +QT = core widgets + +HEADERS = \ + ../customstyle/customstyle.h + +SOURCES = \ + customviewstyle.cpp + ../customstyle/customstyle.cpp diff --git a/src/widgets/doc/snippets/filedialogurls/filedialogurls.pro b/src/widgets/doc/snippets/filedialogurls/filedialogurls.pro new file mode 100644 index 0000000000..f48b07a14a --- /dev/null +++ b/src/widgets/doc/snippets/filedialogurls/filedialogurls.pro @@ -0,0 +1,6 @@ +TEMPLATE = lib +TARGET = widgets_filedialogurls_snippets +QT = core widgets + +SOURCES = \ + filedialogurls.cpp diff --git a/src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditem.pro b/src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditem.pro new file mode 100644 index 0000000000..8abaa0b1be --- /dev/null +++ b/src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditem.pro @@ -0,0 +1,6 @@ +TEMPLATE = lib +TARGET = widgets_graphicssceneadditem_snippets +QT = core widgets + +SOURCES = \ + graphicssceneadditemsnippet.cpp diff --git a/src/widgets/doc/snippets/graphicsview/graphicsview.cpp b/src/widgets/doc/snippets/graphicsview/graphicsview.cpp index 29187ba326..b85c6fc169 100644 --- a/src/widgets/doc/snippets/graphicsview/graphicsview.cpp +++ b/src/widgets/doc/snippets/graphicsview/graphicsview.cpp @@ -47,14 +47,15 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include void graphicsview_snippet_main() { diff --git a/src/widgets/doc/snippets/graphicsview/graphicsview.pro b/src/widgets/doc/snippets/graphicsview/graphicsview.pro new file mode 100644 index 0000000000..a76ceb149c --- /dev/null +++ b/src/widgets/doc/snippets/graphicsview/graphicsview.pro @@ -0,0 +1,6 @@ +TEMPLATE = lib +TARGET = widgets_graphicsview_snippets +QT = core widgets printsupport openglwidgets + +SOURCES = \ + graphicsview.cpp diff --git a/src/widgets/doc/snippets/mdiarea/mdiarea.pro b/src/widgets/doc/snippets/mdiarea/mdiarea.pro new file mode 100644 index 0000000000..23c5682999 --- /dev/null +++ b/src/widgets/doc/snippets/mdiarea/mdiarea.pro @@ -0,0 +1,7 @@ +TEMPLATE = lib +TARGET = mdiarea_snippets +QT += printsupport opengl openglwidgets + +SOURCES = \ + mdiareasnippets.cpp + diff --git a/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp b/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp index c1e2d37ccb..e554b85b74 100644 --- a/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp +++ b/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp @@ -84,25 +84,3 @@ void addingSubWindowsExample() mdiArea.show(); } - -/* -int main(int argv, char **args) -{ - QApplication app(argv, args); - - mainWindowExample(); - //addingSubWindowsExample(); - - QAction *act = new QAction(qApp); - act->setShortcut(Qt::ALT + Qt::Key_S); - act->setShortcutContext( Qt::ApplicationShortcut ); - QObject::connect(act, &QAction::triggered, qApp, &QApplication::aboutQt); - - QWidget widget5; - widget5.show(); - widget5.addAction(act); - - return app.exec(); -} -*/ - diff --git a/src/widgets/doc/snippets/myscrollarea/myscrollarea.pro b/src/widgets/doc/snippets/myscrollarea/myscrollarea.pro new file mode 100644 index 0000000000..190e4b0fa7 --- /dev/null +++ b/src/widgets/doc/snippets/myscrollarea/myscrollarea.pro @@ -0,0 +1,7 @@ +TEMPLATE = lib +TARGET = myscrollarea_snippets +QT += widgets + +SOURCES = \ + myscrollarea.cpp + diff --git a/src/widgets/doc/snippets/snippets.pro b/src/widgets/doc/snippets/snippets.pro index da92019127..d8c1c9fa5f 100644 --- a/src/widgets/doc/snippets/snippets.pro +++ b/src/widgets/doc/snippets/snippets.pro @@ -1,14 +1,18 @@ -TEMPLATE = lib - +TEMPLATE = subdirs TARGET = widgets_snippets +SUBDIRS = -QT += widgets printsupport +#! [qmake_use] +QT += widgets +#! [qmake_use] -SOURCES += customviewstyle/customviewstyle.cpp \ - filedialogurls/filedialogurls.cpp \ - graphicssceneadditem/graphicssceneadditemsnippet.cpp \ - graphicsview/graphicsview.cpp \ - mdiarea/mdiareasnippets.cpp \ - myscrollarea/myscrollarea.cpp +contains(QT_BUILD_PARTS, tests) { + SUBDIRS += \ + customviewstyle \ + filedialogurls \ + graphicssceneadditem \ + graphicsview \ + mdiarea \ + myscrollarea +} -load(qt_common)