summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
diff options
context:
space:
mode:
authorOleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io>2025-08-05 10:01:40 +0200
committerOleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io>2025-08-05 17:35:52 +0200
commit67086b4149da86427666967d11f3c0f33330b5b3 (patch)
treec3a16a64d4847593840c35c11540189e5a41151a /src/widgets/doc/snippets/whatsthis/whatsthis.cpp
parent965638584a9ed88d720a23f0c170c4f636839671 (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/whatsthis/whatsthis.cpp')
-rw-r--r--src/widgets/doc/snippets/whatsthis/whatsthis.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/widgets/doc/snippets/whatsthis/whatsthis.cpp b/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
index c0ec07df7c3..96ff866a030 100644
--- a/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
+++ b/src/widgets/doc/snippets/whatsthis/whatsthis.cpp
@@ -1,26 +1,24 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtGui>
+#include <QMainWindow>
+#include <QAction>
class MainWindow : public QMainWindow
{
public:
- MainWindow();
-
QAction *newAct;
+ MainWindow()
+ {
+ //! [0]
+ newAct = new QAction(tr("&New"), this);
+ newAct->setShortcut(tr("Ctrl+N"));
+ newAct->setStatusTip(tr("Create a new file"));
+ newAct->setWhatsThis(tr("Click this option to create a new file."));
+ //! [0]
+ }
};
-MainWindow()
-{
-//! [0]
- newAct = new QAction(tr("&New"), this);
- newAct->setShortcut(tr("Ctrl+N"));
- newAct->setStatusTip(tr("Create a new file"));
- newAct->setWhatsThis(tr("Click this option to create a new file."));
-//! [0]
-}
-
int main()
{
return 0;