diff options
| author | Oleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io> | 2025-08-05 10:01:40 +0200 |
|---|---|---|
| committer | Oleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io> | 2025-08-05 17:35:52 +0200 |
| commit | 67086b4149da86427666967d11f3c0f33330b5b3 (patch) | |
| tree | c3a16a64d4847593840c35c11540189e5a41151a /src/widgets/doc/snippets/qsplashscreen/main.cpp | |
| parent | 965638584a9ed88d720a23f0c170c4f636839671 (diff) | |
Make snippets in widget folder compilable and add to the build system
Created a CMakeLists.txt file in the widgets folder and added snippets
to it.
Fixed related issues with missing includes and compilation errors.
Task-number: QTBUG-137566
Change-Id: Ief61c3675d8b4d5935bbb0cb951d3a9e82f437f7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/qsplashscreen/main.cpp')
| -rw-r--r-- | src/widgets/doc/snippets/qsplashscreen/main.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/widgets/doc/snippets/qsplashscreen/main.cpp b/src/widgets/doc/snippets/qsplashscreen/main.cpp index afcd9aad9fb..c4821c6ad00 100644 --- a/src/widgets/doc/snippets/qsplashscreen/main.cpp +++ b/src/widgets/doc/snippets/qsplashscreen/main.cpp @@ -2,10 +2,9 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include <QtGui> +#include <QtWidgets> #include <stdlib.h> -#include "mainwindow.h" - //! [0] int main(int argc, char *argv[]) { @@ -16,7 +15,6 @@ int main(int argc, char *argv[]) app.processEvents(); //! [0] - sleep(5); //! [1] QMainWindow window; window.show(); @@ -25,9 +23,12 @@ int main(int argc, char *argv[]) } //! [1] -//! [2] -QScreen *screen = QGuiApplication::screens().at(1); -QPixmap pixmap(":/splash.png"); -QSplashScreen splash(screen, pixmap); -splash.show(); -//! [2] +void example() +{ + //! [2] + QScreen *screen = QGuiApplication::screens().at(1); + QPixmap pixmap(":/splash.png"); + QSplashScreen splash(screen, pixmap); + splash.show(); + //! [2] +} |
