From 3fede6cb547b783377e833c9b269d4cecfe47e61 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 6 Sep 2019 20:27:33 +0200 Subject: Cleanup QtWidgets (tools) examples Cleanup QtWidgets tools examples: - use member-init (clang-tidy) - fix includes/don't include QtWidgets globally - include own header first - use nullptr (clang-tidy) - avoid c-style casts - use QVector instead QList - use QItemDelegate instead QStyledItemDelegate Change-Id: Ibe9440cdf711e5cc2138c054864edebe1fc95731 Reviewed-by: Paul Wicking --- .../widgets/tools/treemodelcompleter/mainwindow.h | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'examples/widgets/tools/treemodelcompleter/mainwindow.h') diff --git a/examples/widgets/tools/treemodelcompleter/mainwindow.h b/examples/widgets/tools/treemodelcompleter/mainwindow.h index 2edcd5aab0..87f492c4ac 100644 --- a/examples/widgets/tools/treemodelcompleter/mainwindow.h +++ b/examples/widgets/tools/treemodelcompleter/mainwindow.h @@ -60,8 +60,6 @@ class QAbstractItemModel; class QComboBox; class QLabel; class QLineEdit; -class QProgressBar; -class QCheckBox; class QTreeView; QT_END_NAMESPACE @@ -71,27 +69,27 @@ class MainWindow : public QMainWindow Q_OBJECT public: - MainWindow(QWidget *parent = 0); + MainWindow(QWidget *parent = nullptr); private slots: void about(); void changeCase(int); void changeMode(int); - void highlight(const QModelIndex&); - void updateContentsLabel(const QString&); + void highlight(const QModelIndex &index); + void updateContentsLabel(const QString &sep); //! [0] //! [1] private: void createMenu(); - QAbstractItemModel *modelFromFile(const QString& fileName); + QAbstractItemModel *modelFromFile(const QString &fileName); - QTreeView *treeView; - QComboBox *caseCombo; - QComboBox *modeCombo; - QLabel *contentsLabel; - TreeModelCompleter *completer; - QLineEdit *lineEdit; + QTreeView *treeView = nullptr; + QComboBox *caseCombo = nullptr; + QComboBox *modeCombo = nullptr; + QLabel *contentsLabel = nullptr; + TreeModelCompleter *completer = nullptr; + QLineEdit *lineEdit = nullptr; }; //! [1] -- cgit v1.2.3