diff options
Diffstat (limited to 'src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp')
| -rw-r--r-- | src/widgets/doc/snippets/qtablewidget-resizing/mainwindow.cpp | 17 |
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); |
