summaryrefslogtreecommitdiffstats
path: root/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.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/qtablewidget-resizing/mainwindow.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/qtablewidget-resizing/mainwindow.cpp')
-rw-r--r--src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp b/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp
index 9c754af783d..8e75aae29df 100644
--- a/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp
+++ b/src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp
@@ -3,7 +3,18 @@
#include <QtWidgets>
-#include "mainwindow.h"
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ MainWindow();
+ void setupTableItems();
+ void changeWidth();
+ void changeHeight();
+
+private:
+ QTableWidget *tableWidget;
+};
MainWindow::MainWindow()
{
@@ -57,7 +68,7 @@ void MainWindow::changeWidth()
{
bool ok;
- int newWidth = QInputDialog::getInteger(this, tr("Change table width"),
+ int newWidth = QInputDialog::getInt(this, tr("Change table width"),
tr("Input the number of columns required (1-20):"),
tableWidget->columnCount(), 1, 20, 1, &ok);
@@ -69,7 +80,7 @@ void MainWindow::changeHeight()
{
bool ok;
- int newHeight = QInputDialog::getInteger(this, tr("Change table height"),
+ int newHeight = QInputDialog::getInt(this, tr("Change table height"),
tr("Input the number of rows required (1-20):"),
tableWidget->rowCount(), 1, 20, 1, &ok);