diff options
| author | Oleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io> | 2025-08-19 10:05:29 +0200 |
|---|---|---|
| committer | Oleksii Zbykovskyi <Oleksii.Zbykovskyi@qt.io> | 2025-08-20 20:15:46 +0200 |
| commit | 46b8f2eb1a2ef9655c963b567a517352facd307c (patch) | |
| tree | d309756adb33a30e4bc17a02b796786b32476e59 /src/widgets/doc/snippets/reading-selections/window.cpp | |
| parent | ae6f389942d60959fcae0f5d9f2bb6eadd8efb06 (diff) | |
Widgets snippets: Use the header file instead of a new class each time
In several snippets, the TableModel class is created and used.
I included a header file to avoid code repetition.
Change-Id: Ie6318606cc89a2f5f1c137a36195fe290b6c1be6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/widgets/doc/snippets/reading-selections/window.cpp')
| -rw-r--r-- | src/widgets/doc/snippets/reading-selections/window.cpp | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/widgets/doc/snippets/reading-selections/window.cpp b/src/widgets/doc/snippets/reading-selections/window.cpp index c0c3bcbe6f4..1f219c861e1 100644 --- a/src/widgets/doc/snippets/reading-selections/window.cpp +++ b/src/widgets/doc/snippets/reading-selections/window.cpp @@ -17,25 +17,7 @@ #include <QTableView> #include "../include/mainwindow.h" - -class TableModel : public QAbstractTableModel -{ - Q_OBJECT -public: - TableModel(int rows, int columns, QObject *parent = nullptr) {} - - int rowCount(const QModelIndex &parent = QModelIndex()) const override { - return 0; - } - - int columnCount(const QModelIndex &parent = QModelIndex()) const override { - return 0; - } - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override { - return QVariant(); - } -}; +#include "../common-table-model/model.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) |
