diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2018-05-07 17:33:02 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2018-05-13 19:53:14 +0000 |
commit | 63ef88d015006b9e60fe5f4fae3c8a15c52ad612 (patch) | |
tree | 81a15c3ab35acb4bae804e97e6934053ed2ef521 /src/libs/utils | |
parent | ebf2d6f4e25282d0aeedfaccfddbb333c59f606b (diff) | |
download | qt-creator-63ef88d015006b9e60fe5f4fae3c8a15c52ad612.tar.gz |
Utils: Consistently use nullptr
Fixed by clang-tidy modernize-use-nullptr.
Change-Id: I93edae67271a521e3b2a1f97f486e5fa97009836
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/libs/utils')
52 files changed, 101 insertions, 95 deletions
diff --git a/src/libs/utils/annotateditemdelegate.h b/src/libs/utils/annotateditemdelegate.h index d6223fb379..ffbcfbd9f4 100644 --- a/src/libs/utils/annotateditemdelegate.h +++ b/src/libs/utils/annotateditemdelegate.h @@ -34,7 +34,7 @@ namespace Utils { class QTCREATOR_UTILS_EXPORT AnnotatedItemDelegate : public QStyledItemDelegate { public: - AnnotatedItemDelegate(QObject *parent = 0); + AnnotatedItemDelegate(QObject *parent = nullptr); ~AnnotatedItemDelegate() override; void setAnnotationRole(int role); diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index 456672d656..653d9fb22b 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -53,7 +53,7 @@ public: ItemDelegateRole, }; - BaseTreeView(QWidget *parent = 0); + BaseTreeView(QWidget *parent = nullptr); ~BaseTreeView() override; void setSettings(QSettings *settings, const QByteArray &key); diff --git a/src/libs/utils/categorysortfiltermodel.h b/src/libs/utils/categorysortfiltermodel.h index a0ae25ff69..830ab19749 100644 --- a/src/libs/utils/categorysortfiltermodel.h +++ b/src/libs/utils/categorysortfiltermodel.h @@ -34,7 +34,7 @@ namespace Utils { class QTCREATOR_UTILS_EXPORT CategorySortFilterModel : public QSortFilterProxyModel { public: - CategorySortFilterModel(QObject *parent = 0); + CategorySortFilterModel(QObject *parent = nullptr); protected: bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override; diff --git a/src/libs/utils/classnamevalidatinglineedit.h b/src/libs/utils/classnamevalidatinglineedit.h index a24346cf1b..ecbea82a80 100644 --- a/src/libs/utils/classnamevalidatinglineedit.h +++ b/src/libs/utils/classnamevalidatinglineedit.h @@ -38,7 +38,7 @@ class QTCREATOR_UTILS_EXPORT ClassNameValidatingLineEdit : public FancyLineEdit Q_PROPERTY(bool lowerCaseFileName READ lowerCaseFileName WRITE setLowerCaseFileName) public: - explicit ClassNameValidatingLineEdit(QWidget *parent = 0); + explicit ClassNameValidatingLineEdit(QWidget *parent = nullptr); ~ClassNameValidatingLineEdit() override; bool namespacesEnabled() const; diff --git a/src/libs/utils/completinglineedit.h b/src/libs/utils/completinglineedit.h index 1cedaf0b7c..988e0324c4 100644 --- a/src/libs/utils/completinglineedit.h +++ b/src/libs/utils/completinglineedit.h @@ -35,7 +35,7 @@ class QTCREATOR_UTILS_EXPORT CompletingLineEdit : public QLineEdit Q_OBJECT public: - explicit CompletingLineEdit(QWidget *parent = 0); + explicit CompletingLineEdit(QWidget *parent = nullptr); protected: bool event(QEvent *e) override; diff --git a/src/libs/utils/completingtextedit.h b/src/libs/utils/completingtextedit.h index b45ce886a3..eb09dcb4f8 100644 --- a/src/libs/utils/completingtextedit.h +++ b/src/libs/utils/completingtextedit.h @@ -43,7 +43,7 @@ class QTCREATOR_UTILS_EXPORT CompletingTextEdit : public QTextEdit READ completionLengthThreshold WRITE setCompletionLengthThreshold) public: - CompletingTextEdit(QWidget *parent = 0); + CompletingTextEdit(QWidget *parent = nullptr); ~CompletingTextEdit() override; void setCompleter(QCompleter *c); diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 7ebdfbc678..7c58c55cc6 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -43,7 +43,7 @@ class QTCREATOR_UTILS_EXPORT ConsoleProcess : public QObject public: enum Mode { Run, Debug, Suspend }; - ConsoleProcess(QObject *parent = 0); + ConsoleProcess(QObject *parent = nullptr); ~ConsoleProcess() override; void setWorkingDirectory(const QString &dir); diff --git a/src/libs/utils/detailsbutton.h b/src/libs/utils/detailsbutton.h index 2c8dd72043..f66fa2ad4b 100644 --- a/src/libs/utils/detailsbutton.h +++ b/src/libs/utils/detailsbutton.h @@ -37,7 +37,7 @@ class QTCREATOR_UTILS_EXPORT FadingPanel : public QWidget Q_OBJECT public: - FadingPanel(QWidget *parent = 0) + FadingPanel(QWidget *parent = nullptr) : QWidget(parent) {} virtual void fadeTo(qreal value) = 0; @@ -48,7 +48,7 @@ class QTCREATOR_UTILS_EXPORT FadingWidget : public FadingPanel { Q_OBJECT public: - FadingWidget(QWidget *parent = 0); + FadingWidget(QWidget *parent = nullptr); void fadeTo(qreal value) override; qreal opacity(); void setOpacity(qreal value) override; @@ -62,7 +62,7 @@ class QTCREATOR_UTILS_EXPORT DetailsButton : public QAbstractButton Q_PROPERTY(float fader READ fader WRITE setFader) public: - DetailsButton(QWidget *parent = 0); + DetailsButton(QWidget *parent = nullptr); QSize sizeHint() const override; float fader() { return m_fader; } diff --git a/src/libs/utils/detailswidget.h b/src/libs/utils/detailswidget.h index 18f934170b..f96f0f549d 100644 --- a/src/libs/utils/detailswidget.h +++ b/src/libs/utils/detailswidget.h @@ -52,7 +52,7 @@ public: OnlySummary }; - explicit DetailsWidget(QWidget *parent = 0); + explicit DetailsWidget(QWidget *parent = nullptr); ~DetailsWidget() override; void setSummaryText(const QString &text); diff --git a/src/libs/utils/elidinglabel.h b/src/libs/utils/elidinglabel.h index 70b568f123..6a8bd23195 100644 --- a/src/libs/utils/elidinglabel.h +++ b/src/libs/utils/elidinglabel.h @@ -36,8 +36,8 @@ class QTCREATOR_UTILS_EXPORT ElidingLabel : public QLabel Q_PROPERTY(Qt::TextElideMode elideMode READ elideMode WRITE setElideMode DESIGNABLE true) public: - explicit ElidingLabel(QWidget *parent = 0); - explicit ElidingLabel(const QString &text, QWidget *parent = 0); + explicit ElidingLabel(QWidget *parent = nullptr); + explicit ElidingLabel(const QString &text, QWidget *parent = nullptr); Qt::TextElideMode elideMode() const; void setElideMode(const Qt::TextElideMode &elideMode); diff --git a/src/libs/utils/environmentmodel.h b/src/libs/utils/environmentmodel.h index b102ba92d3..3eb0ece6cb 100644 --- a/src/libs/utils/environmentmodel.h +++ b/src/libs/utils/environmentmodel.h @@ -40,7 +40,7 @@ class QTCREATOR_UTILS_EXPORT EnvironmentModel : public QAbstractTableModel Q_OBJECT public: - explicit EnvironmentModel(QObject *parent = 0); + explicit EnvironmentModel(QObject *parent = nullptr); ~EnvironmentModel() override; int rowCount(const QModelIndex &parent) const override; diff --git a/src/libs/utils/faketooltip.h b/src/libs/utils/faketooltip.h index 4b30cb4c35..ad335b5930 100644 --- a/src/libs/utils/faketooltip.h +++ b/src/libs/utils/faketooltip.h @@ -36,7 +36,7 @@ class QTCREATOR_UTILS_EXPORT FakeToolTip : public QWidget Q_OBJECT public: - explicit FakeToolTip(QWidget *parent = 0); + explicit FakeToolTip(QWidget *parent = nullptr); protected: void paintEvent(QPaintEvent *e) override; diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 9c0b87961f..8cef228b0d 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -46,7 +46,7 @@ class QTCREATOR_UTILS_EXPORT IconButton: public QAbstractButton Q_PROPERTY(float iconOpacity READ iconOpacity WRITE setIconOpacity) Q_PROPERTY(bool autoHide READ hasAutoHide WRITE setAutoHide) public: - explicit IconButton(QWidget *parent = 0); + explicit IconButton(QWidget *parent = nullptr); void paintEvent(QPaintEvent *event) override; float iconOpacity() { return m_iconOpacity; } void setIconOpacity(float value) { m_iconOpacity = value; update(); } @@ -79,7 +79,7 @@ class QTCREATOR_UTILS_EXPORT FancyLineEdit : public CompletingLineEdit public: enum Side {Left = 0, Right = 1}; - explicit FancyLineEdit(QWidget *parent = 0); + explicit FancyLineEdit(QWidget *parent = nullptr); ~FancyLineEdit() override; QIcon buttonIcon(Side side) const; diff --git a/src/libs/utils/fancymainwindow.h b/src/libs/utils/fancymainwindow.h index 772fa3e18a..be30e2c317 100644 --- a/src/libs/utils/fancymainwindow.h +++ b/src/libs/utils/fancymainwindow.h @@ -42,7 +42,7 @@ class QTCREATOR_UTILS_EXPORT FancyMainWindow : public QMainWindow Q_OBJECT public: - explicit FancyMainWindow(QWidget *parent = 0); + explicit FancyMainWindow(QWidget *parent = nullptr); ~FancyMainWindow() override; /* The widget passed in should have an objectname set diff --git a/src/libs/utils/filenamevalidatinglineedit.h b/src/libs/utils/filenamevalidatinglineedit.h index 9921501263..f0b5bd8b5d 100644 --- a/src/libs/utils/filenamevalidatinglineedit.h +++ b/src/libs/utils/filenamevalidatinglineedit.h @@ -37,15 +37,15 @@ class QTCREATOR_UTILS_EXPORT FileNameValidatingLineEdit : public FancyLineEdit Q_PROPERTY(bool forceFirstCapitalLetter READ forceFirstCapitalLetter WRITE setForceFirstCapitalLetter) public: - explicit FileNameValidatingLineEdit(QWidget *parent = 0); + explicit FileNameValidatingLineEdit(QWidget *parent = nullptr); static bool validateFileName(const QString &name, bool allowDirectories = false, - QString *errorMessage = 0); + QString *errorMessage = nullptr); static bool validateFileNameExtension(const QString &name, const QStringList &requiredExtensions = QStringList(), - QString *errorMessage = 0); + QString *errorMessage = nullptr); /** * Sets whether entering directories is allowed. This will enable the user diff --git a/src/libs/utils/filesearch.h b/src/libs/utils/filesearch.h index 8babf004ac..a25949e220 100644 --- a/src/libs/utils/filesearch.h +++ b/src/libs/utils/filesearch.h @@ -144,7 +144,7 @@ public: SubDirFileIterator(const QStringList &directories, const QStringList &filters, const QStringList &exclusionFilters, - QTextCodec *encoding = 0); + QTextCodec *encoding = nullptr); ~SubDirFileIterator() override; int maxProgress() const override; diff --git a/src/libs/utils/filesystemwatcher.h b/src/libs/utils/filesystemwatcher.h index 9db361659d..1f029eae4d 100644 --- a/src/libs/utils/filesystemwatcher.h +++ b/src/libs/utils/filesystemwatcher.h @@ -44,8 +44,8 @@ public: WatchAllChanges }; - explicit FileSystemWatcher(QObject *parent = 0); - explicit FileSystemWatcher(int id, QObject *parent = 0); + explicit FileSystemWatcher(QObject *parent = nullptr); + explicit FileSystemWatcher(int id, QObject *parent = nullptr); ~FileSystemWatcher() override; void addFile(const QString &file, WatchMode wm); diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index feb3b0a9dc..b0068f4341 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -112,9 +112,10 @@ using FileNameList = QList<FileName>; class QTCREATOR_UTILS_EXPORT FileUtils { public: - static bool removeRecursively(const FileName &filePath, QString *error = 0); - static bool copyRecursively(const FileName &srcFilePath, const FileName &tgtFilePath, - QString *error = 0, const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper = std::function<bool (QFileInfo, QFileInfo, QString *)>()); + static bool removeRecursively(const FileName &filePath, QString *error = nullptr); + static bool copyRecursively( + const FileName &srcFilePath, const FileName &tgtFilePath, QString *error = nullptr, + const std::function<bool (QFileInfo, QFileInfo, QString *)> ©Helper = nullptr); static bool isFileNewerThan(const FileName &filePath, const QDateTime &timeStamp); static FileName resolveSymlinks(const FileName &path); static FileName canonicalPath(const FileName &path); diff --git a/src/libs/utils/filewizardpage.h b/src/libs/utils/filewizardpage.h index 4c3ee48ff4..ede6c4d3ab 100644 --- a/src/libs/utils/filewizardpage.h +++ b/src/libs/utils/filewizardpage.h @@ -40,7 +40,7 @@ class QTCREATOR_UTILS_EXPORT FileWizardPage : public WizardPage Q_PROPERTY(QString fileName READ fileName WRITE setFileName DESIGNABLE true) public: - explicit FileWizardPage(QWidget *parent = 0); + explicit FileWizardPage(QWidget *parent = nullptr); ~FileWizardPage() override; QString fileName() const; @@ -55,7 +55,7 @@ public: void setForceFirstCapitalLetterForFileName(bool b); // Validate a base name entry field (potentially containing extension) - static bool validateBaseName(const QString &name, QString *errorMessage = 0); + static bool validateBaseName(const QString &name, QString *errorMessage = nullptr); signals: void activated(); diff --git a/src/libs/utils/fixedsizeclicklabel.h b/src/libs/utils/fixedsizeclicklabel.h index 0d83ac667b..eb89de7ab9 100644 --- a/src/libs/utils/fixedsizeclicklabel.h +++ b/src/libs/utils/fixedsizeclicklabel.h @@ -36,7 +36,7 @@ class QTCREATOR_UTILS_EXPORT FixedSizeClickLabel : public QLabel Q_PROPERTY(QString maxText READ maxText WRITE setMaxText DESIGNABLE true) public: - explicit FixedSizeClickLabel(QWidget *parent = 0); + explicit FixedSizeClickLabel(QWidget *parent = nullptr); void setText(const QString &text, const QString &maxText); using QLabel::setText; diff --git a/src/libs/utils/highlightingitemdelegate.h b/src/libs/utils/highlightingitemdelegate.h index ae184de2d7..a131ef613e 100644 --- a/src/libs/utils/highlightingitemdelegate.h +++ b/src/libs/utils/highlightingitemdelegate.h @@ -44,7 +44,7 @@ enum class HighlightingItemRole { class QTCREATOR_UTILS_EXPORT HighlightingItemDelegate : public QItemDelegate { public: - HighlightingItemDelegate(int tabWidth, QObject *parent = 0); + HighlightingItemDelegate(int tabWidth, QObject *parent = nullptr); void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override; void setTabWidth(int width); diff --git a/src/libs/utils/historycompleter.h b/src/libs/utils/historycompleter.h index 030c3103df..108f0d5628 100644 --- a/src/libs/utils/historycompleter.h +++ b/src/libs/utils/historycompleter.h @@ -43,7 +43,7 @@ class QTCREATOR_UTILS_EXPORT HistoryCompleter : public QCompleter public: static void setSettings(QSettings *settings); - HistoryCompleter(const QString &historyKey, QObject *parent = 0); + HistoryCompleter(const QString &historyKey, QObject *parent = nullptr); bool removeHistoryItem(int index); QString historyItem() const; static bool historyExistsFor(const QString &historyKey); diff --git a/src/libs/utils/itemviews.h b/src/libs/utils/itemviews.h index 91cfc927fc..92122a500d 100644 --- a/src/libs/utils/itemviews.h +++ b/src/libs/utils/itemviews.h @@ -49,7 +49,7 @@ template<class BaseT> class View : public BaseT { public: - View(QWidget *parent = 0) + View(QWidget *parent = nullptr) : BaseT(parent) {} void setActivationMode(ActivationMode mode) @@ -89,7 +89,7 @@ class QTCREATOR_UTILS_EXPORT TreeView : public View<QTreeView> { Q_OBJECT public: - TreeView(QWidget *parent = 0) + TreeView(QWidget *parent = nullptr) : View<QTreeView>(parent) {} }; @@ -98,7 +98,7 @@ class QTCREATOR_UTILS_EXPORT TreeWidget : public View<QTreeWidget> { Q_OBJECT public: - TreeWidget(QWidget *parent = 0) + TreeWidget(QWidget *parent = nullptr) : View<QTreeWidget>(parent) {} }; @@ -107,7 +107,7 @@ class QTCREATOR_UTILS_EXPORT ListView : public View<QListView> { Q_OBJECT public: - ListView(QWidget *parent = 0) + ListView(QWidget *parent = nullptr) : View<QListView>(parent) {} }; @@ -116,7 +116,7 @@ class QTCREATOR_UTILS_EXPORT ListWidget : public View<QListWidget> { Q_OBJECT public: - ListWidget(QWidget *parent = 0) + ListWidget(QWidget *parent = nullptr) : View<QListWidget>(parent) {} }; diff --git a/src/libs/utils/json.h b/src/libs/utils/json.h index c55fa79196..df7881a55e 100644 --- a/src/libs/utils/json.h +++ b/src/libs/utils/json.h @@ -82,13 +82,13 @@ public: Kind kind() const { return m_kind; } static QString kindToString(Kind kind); - virtual JsonStringValue *toString() { return 0; } - virtual JsonDoubleValue *toDouble() { return 0; } - virtual JsonIntValue *toInt() { return 0; } - virtual JsonObjectValue *toObject() { return 0; } - virtual JsonArrayValue *toArray() { return 0; } - virtual JsonBooleanValue *toBoolean() { return 0; } - virtual JsonNullValue *toNull() { return 0; } + virtual JsonStringValue *toString() { return nullptr; } + virtual JsonDoubleValue *toDouble() { return nullptr; } + virtual JsonIntValue *toInt() { return nullptr; } + virtual JsonObjectValue *toObject() { return nullptr; } + virtual JsonArrayValue *toArray() { return nullptr; } + virtual JsonBooleanValue *toBoolean() { return nullptr; } + virtual JsonNullValue *toNull() { return nullptr; } static JsonValue *create(const QString &s, JsonMemoryPool *pool); void *operator new(size_t size, JsonMemoryPool *pool); @@ -399,7 +399,7 @@ public: private: struct JsonSchemaData { - JsonSchemaData(const QString &absoluteFileName, JsonSchema *schema = 0) + JsonSchemaData(const QString &absoluteFileName, JsonSchema *schema = nullptr) : m_absoluteFileName(absoluteFileName) , m_schema(schema) {} diff --git a/src/libs/utils/macroexpander.h b/src/libs/utils/macroexpander.h index a8fd1afdab..ff96eb1089 100644 --- a/src/libs/utils/macroexpander.h +++ b/src/libs/utils/macroexpander.h @@ -52,7 +52,7 @@ public: bool resolveMacro(const QString &name, QString *ret) const; - QString value(const QByteArray &variable, bool *found = 0) const; + QString value(const QByteArray &variable, bool *found = nullptr) const; QString expand(const QString &stringWithVariables) const; QByteArray expand(const QByteArray &stringWithVariables) const; diff --git a/src/libs/utils/mimetypes/mimedatabase.h b/src/libs/utils/mimetypes/mimedatabase.h index 021accf78d..1a1c5c8a28 100644 --- a/src/libs/utils/mimetypes/mimedatabase.h +++ b/src/libs/utils/mimetypes/mimedatabase.h @@ -77,7 +77,7 @@ enum class MimeStartupPhase { QTCREATOR_UTILS_EXPORT void setMimeStartupPhase(MimeStartupPhase); QTCREATOR_UTILS_EXPORT void addMimeTypes(const QString &id, const QByteArray &data); -QTCREATOR_UTILS_EXPORT QString allFiltersString(QString *allFilesFilter = 0); +QTCREATOR_UTILS_EXPORT QString allFiltersString(QString *allFilesFilter = nullptr); QTCREATOR_UTILS_EXPORT QString allFilesFilterString(); QTCREATOR_UTILS_EXPORT QStringList allGlobPatterns(); QTCREATOR_UTILS_EXPORT QMap<int, QList<Internal::MimeMagicRule> > magicRulesForMimeType(const MimeType &mimeType); // priority -> rules diff --git a/src/libs/utils/mimetypes/mimemagicrule_p.h b/src/libs/utils/mimetypes/mimemagicrule_p.h index e1c8017903..1513750a29 100644 --- a/src/libs/utils/mimetypes/mimemagicrule_p.h +++ b/src/libs/utils/mimetypes/mimemagicrule_p.h @@ -71,7 +71,7 @@ public: enum Type { Invalid = 0, String, RegExp, Host16, Host32, Big16, Big32, Little16, Little32, Byte }; MimeMagicRule(Type type, const QByteArray &value, int startPos, int endPos, - const QByteArray &mask = QByteArray(), QString *errorString = 0); + const QByteArray &mask = QByteArray(), QString *errorString = nullptr); MimeMagicRule(const MimeMagicRule &other); ~MimeMagicRule(); diff --git a/src/libs/utils/navigationtreeview.h b/src/libs/utils/navigationtreeview.h index a99539d51b..ced2b797a8 100644 --- a/src/libs/utils/navigationtreeview.h +++ b/src/libs/utils/navigationtreeview.h @@ -35,7 +35,7 @@ class QTCREATOR_UTILS_EXPORT NavigationTreeView : public TreeView { Q_OBJECT public: - explicit NavigationTreeView(QWidget *parent = 0); + explicit NavigationTreeView(QWidget *parent = nullptr); void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) override; protected: diff --git a/src/libs/utils/networkaccessmanager.h b/src/libs/utils/networkaccessmanager.h index 94c26109fd..4f09123aab 100644 --- a/src/libs/utils/networkaccessmanager.h +++ b/src/libs/utils/networkaccessmanager.h @@ -37,7 +37,7 @@ class QTCREATOR_UTILS_EXPORT NetworkAccessManager : public QNetworkAccessManager { Q_OBJECT public: - NetworkAccessManager(QObject *parent = 0); + NetworkAccessManager(QObject *parent = nullptr); static NetworkAccessManager *instance(); diff --git a/src/libs/utils/newclasswidget.h b/src/libs/utils/newclasswidget.h index 53dd1de087..8790b21b7c 100644 --- a/src/libs/utils/newclasswidget.h +++ b/src/libs/utils/newclasswidget.h @@ -77,7 +77,7 @@ public: SharedDataClass }; - explicit NewClassWidget(QWidget *parent = 0); + explicit NewClassWidget(QWidget *parent = nullptr); ~NewClassWidget() override; bool namespacesEnabled() const; @@ -106,7 +106,7 @@ public: QString namesDelimiter() const; bool isClassTypeComboVisible() const; - bool isValid(QString *error = 0) const; + bool isValid(QString *error = nullptr) const; QStringList files() const; diff --git a/src/libs/utils/parameteraction.h b/src/libs/utils/parameteraction.h index a402844987..627d40fb5f 100644 --- a/src/libs/utils/parameteraction.h +++ b/src/libs/utils/parameteraction.h @@ -44,7 +44,7 @@ public: explicit ParameterAction(const QString &emptyText, const QString ¶meterText, EnablingMode em = AlwaysEnabled, - QObject *parent = 0); + QObject *parent = nullptr); QString emptyText() const; void setEmptyText(const QString &); diff --git a/src/libs/utils/pathlisteditor.h b/src/libs/utils/pathlisteditor.h index fa14f5ee2c..07392fbe6e 100644 --- a/src/libs/utils/pathlisteditor.h +++ b/src/libs/utils/pathlisteditor.h @@ -46,7 +46,7 @@ class QTCREATOR_UTILS_EXPORT PathListEditor : public QWidget Q_PROPERTY(QString fileDialogTitle READ fileDialogTitle WRITE setFileDialogTitle DESIGNABLE true) public: - explicit PathListEditor(QWidget *parent = 0); + explicit PathListEditor(QWidget *parent = nullptr); ~PathListEditor() override; QString pathListString() const; diff --git a/src/libs/utils/projectintropage.h b/src/libs/utils/projectintropage.h index 98b51693ae..909ad7d576 100644 --- a/src/libs/utils/projectintropage.h +++ b/src/libs/utils/projectintropage.h @@ -42,7 +42,7 @@ class QTCREATOR_UTILS_EXPORT ProjectIntroPage : public WizardPage Q_PROPERTY(bool forceSubProject READ forceSubProject WRITE setForceSubProject DESIGNABLE true) public: - explicit ProjectIntroPage(QWidget *parent = 0); + explicit ProjectIntroPage(QWidget *parent = nullptr); ~ProjectIntroPage() override; QString projectName() const; diff --git a/src/libs/utils/proxyaction.h b/src/libs/utils/proxyaction.h index a5c423098e..5058bb42f3 100644 --- a/src/libs/utils/proxyaction.h +++ b/src/libs/utils/proxyaction.h @@ -43,7 +43,7 @@ public: }; Q_DECLARE_FLAGS(Attributes, Attribute) - explicit ProxyAction(QObject *parent = 0); + explicit ProxyAction(QObject *parent = nullptr); void initialize(QAction *action); diff --git a/src/libs/utils/proxycredentialsdialog.h b/src/libs/utils/proxycredentialsdialog.h index 5e39baf27c..13f380a15c 100644 --- a/src/libs/utils/proxycredentialsdialog.h +++ b/src/libs/utils/proxycredentialsdialog.h @@ -41,7 +41,7 @@ class QTCREATOR_UTILS_EXPORT ProxyCredentialsDialog : public QDialog Q_OBJECT public: - explicit ProxyCredentialsDialog(const QNetworkProxy &proxy, QWidget *parent = 0); + explicit ProxyCredentialsDialog(const QNetworkProxy &proxy, QWidget *parent = nullptr); ~ProxyCredentialsDialog() override; QString userName() const; diff --git a/src/libs/utils/qtcolorbutton.h b/src/libs/utils/qtcolorbutton.h index 12dd82be14..207c9ebe6b 100644 --- a/src/libs/utils/qtcolorbutton.h +++ b/src/libs/utils/qtcolorbutton.h @@ -38,7 +38,7 @@ class QTCREATOR_UTILS_EXPORT QtColorButton : public QToolButton Q_PROPERTY(bool alphaAllowed READ isAlphaAllowed WRITE setAlphaAllowed) Q_PROPERTY(QColor color READ color WRITE setColor) public: - QtColorButton(QWidget *parent = 0); + QtColorButton(QWidget *parent = nullptr); ~QtColorButton() override; bool isBackgroundCheckered() const; diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h index 89b1cc56fc..4ff75a7dae 100644 --- a/src/libs/utils/qtcprocess.h +++ b/src/libs/utils/qtcprocess.h @@ -37,7 +37,7 @@ class QTCREATOR_UTILS_EXPORT QtcProcess : public QProcess Q_OBJECT public: - QtcProcess(QObject *parent = 0); + QtcProcess(QObject *parent = nullptr); void setEnvironment(const Environment &env) { m_environment = env; m_haveEnv = true; } void setCommand(const QString &command, const QString &arguments) @@ -80,19 +80,19 @@ public: //! Prepare argument of a shell command for feeding into QProcess static Arguments prepareArgs(const QString &cmd, SplitError *err, OsType osType = HostOsInfo::hostOs(), - const Environment *env = 0, const QString *pwd = 0); + const Environment *env = nullptr, const QString *pwd = nullptr); //! Prepare a shell command for feeding into QProcess static bool prepareCommand(const QString &command, const QString &arguments, QString *outCmd, Arguments *outArgs, OsType osType = HostOsInfo::hostOs(), - const Environment *env = 0, const QString *pwd = 0); + const Environment *env = nullptr, const QString *pwd = nullptr); //! Quote and append each argument to a shell command static void addArgs(QString *args, const QStringList &inArgs); //! Append already quoted arguments to a shell command static void addArgs(QString *args, const QString &inArgs); //! Split a shell command into separate arguments. ArgIterator is usually a better choice. static QStringList splitArgs(const QString &cmd, OsType osType = HostOsInfo::hostOs(), - bool abortOnMeta = false, SplitError *err = 0, - const Environment *env = 0, const QString *pwd = 0); + bool abortOnMeta = false, SplitError *err = nullptr, + const Environment *env = nullptr, const QString *pwd = nullptr); //! Safely replace the expandos in a shell command static bool expandMacros(QString *cmd, AbstractMacroExpander *mx, OsType osType = HostOsInfo::hostOs()); diff --git a/src/libs/utils/removefiledialog.h b/src/libs/utils/removefiledialog.h index 4543e663f3..4280223314 100644 --- a/src/libs/utils/removefiledialog.h +++ b/src/libs/utils/removefiledialog.h @@ -38,7 +38,7 @@ class QTCREATOR_UTILS_EXPORT RemoveFileDialog : public QDialog Q_OBJECT public: - explicit RemoveFileDialog(const QString &filePath, QWidget *parent = 0); + explicit RemoveFileDialog(const QString &filePath, QWidget *parent = nullptr); ~RemoveFileDialog() override; void setDeleteFileVisible(bool visible); diff --git a/src/libs/utils/runextensions.h b/src/libs/utils/runextensions.h index 30590ade30..4975223463 100644 --- a/src/libs/utils/runextensions.h +++ b/src/libs/utils/runextensions.h @@ -53,7 +53,7 @@ static testCallOperatorNo testCallOperator(...); template<typename T> struct hasCallOperator { - static const bool value = (sizeof(testCallOperator<T>(0)) == sizeof(testCallOperatorYes)); + static const bool value = (sizeof(testCallOperator<T>(nullptr)) == sizeof(testCallOperatorYes)); }; namespace Utils { @@ -379,7 +379,7 @@ private: class QTCREATOR_UTILS_EXPORT RunnableThread : public QThread { public: - explicit RunnableThread(QRunnable *runnable, QObject *parent = 0); + explicit RunnableThread(QRunnable *runnable, QObject *parent = nullptr); protected: void run() override; diff --git a/src/libs/utils/savedaction.h b/src/libs/utils/savedaction.h index 4fb98496b4..45454939f1 100644 --- a/src/libs/utils/savedaction.h +++ b/src/libs/utils/savedaction.h @@ -42,7 +42,7 @@ class QTCREATOR_UTILS_EXPORT SavedAction : public QAction Q_OBJECT public: - SavedAction(QObject *parent = 0); + SavedAction(QObject *parent = nullptr); QVariant value() const; void setValue(const QVariant &value, bool doemit = true); diff --git a/src/libs/utils/statuslabel.h b/src/libs/utils/statuslabel.h index 8a2ffc2232..470040d572 100644 --- a/src/libs/utils/statuslabel.h +++ b/src/libs/utils/statuslabel.h @@ -37,7 +37,7 @@ class QTCREATOR_UTILS_EXPORT StatusLabel : public QLabel { Q_OBJECT public: - explicit StatusLabel(QWidget *parent = 0); + explicit StatusLabel(QWidget *parent = nullptr); public slots: void showStatusMessage(const QString &message, int timeoutMS = 5000); diff --git a/src/libs/utils/styledbar.h b/src/libs/utils/styledbar.h index 7b5d67fd59..972716d9e8 100644 --- a/src/libs/utils/styledbar.h +++ b/src/libs/utils/styledbar.h @@ -35,7 +35,7 @@ class QTCREATOR_UTILS_EXPORT StyledBar : public QWidget { Q_OBJECT public: - StyledBar(QWidget *parent = 0); + StyledBar(QWidget *parent = nullptr); void setSingleRow(bool singleRow); bool isSingleRow() const; @@ -50,7 +50,7 @@ class QTCREATOR_UTILS_EXPORT StyledSeparator : public QWidget { Q_OBJECT public: - StyledSeparator(QWidget *parent = 0); + StyledSeparator(QWidget *parent = nullptr); protected: void paintEvent(QPaintEvent *event) override; }; diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h index bbf21c11f2..b1901207d8 100644 --- a/src/libs/utils/synchronousprocess.h +++ b/src/libs/utils/synchronousprocess.h @@ -138,8 +138,10 @@ public: // detection similar SynchronousProcess' handling (taking effect after no more output // occurs on stderr/stdout as opposed to waitForFinished()). Returns false if a timeout // occurs. Checking of the process' exit state/code still has to be done. - static bool readDataFromProcess(QProcess &p, int timeoutS, - QByteArray *rawStdOut = 0, QByteArray *rawStdErr = 0, + static bool readDataFromProcess(QProcess &p, + int timeoutS, + QByteArray *rawStdOut = nullptr, + QByteArray *rawStdErr = nullptr, bool timeOutMessageBox = false); // Stop a process by first calling terminate() (allowing for signal handling) and // then kill(). diff --git a/src/libs/utils/textfieldcheckbox.h b/src/libs/utils/textfieldcheckbox.h index ad585255ef..3fea4f1ec3 100644 --- a/src/libs/utils/textfieldcheckbox.h +++ b/src/libs/utils/textfieldcheckbox.h @@ -38,7 +38,7 @@ class QTCREATOR_UTILS_EXPORT TextFieldCheckBox : public QCheckBox { Q_PROPERTY(QString falseText READ falseText WRITE setFalseText) Q_OBJECT public: - explicit TextFieldCheckBox(const QString &text, QWidget *parent = 0); + explicit TextFieldCheckBox(const QString &text, QWidget *parent = nullptr); QString text() const; void setText(const QString &s); diff --git a/src/libs/utils/textfieldcombobox.h b/src/libs/utils/textfieldcombobox.h index 937a290cad..a10906bcbc 100644 --- a/src/libs/utils/textfieldcombobox.h +++ b/src/libs/utils/textfieldcombobox.h @@ -36,7 +36,7 @@ class QTCREATOR_UTILS_EXPORT TextFieldComboBox : public QComboBox { Q_PROPERTY(QString indexText READ text WRITE setText) Q_OBJECT public: - explicit TextFieldComboBox(QWidget *parent = 0); + explicit TextFieldComboBox(QWidget *parent = nullptr); QString text() const; void setText(const QString &s); diff --git a/src/libs/utils/textfileformat.h b/src/libs/utils/textfileformat.h index 6cb6c7ede8..ab432a53d6 100644 --- a/src/libs/utils/textfileformat.h +++ b/src/libs/utils/textfileformat.h @@ -67,10 +67,10 @@ public: static ReadResult readFile(const QString &fileName, const QTextCodec *defaultCodec, QStringList *plainText, TextFileFormat *format, QString *errorString, - QByteArray *decodingErrorSample = 0); + QByteArray *decodingErrorSample = nullptr); static ReadResult readFile(const QString &fileName, const QTextCodec *defaultCodec, QString *plainText, TextFileFormat *format, QString *errorString, - QByteArray *decodingErrorSample = 0); + QByteArray *decodingErrorSample = nullptr); static ReadResult readFileUTF8(const QString &fileName, const QTextCodec *defaultCodec, QByteArray *plainText, QString *errorString); diff --git a/src/libs/utils/theme/theme.h b/src/libs/utils/theme/theme.h index da0b78f7a7..62eac0ade7 100644 --- a/src/libs/utils/theme/theme.h +++ b/src/libs/utils/theme/theme.h @@ -48,7 +48,7 @@ class QTCREATOR_UTILS_EXPORT Theme : public QObject Q_ENUMS(WidgetStyle) public: - Theme(const QString &id, QObject *parent = 0); + Theme(const QString &id, QObject *parent = nullptr); ~Theme() override; enum Color { diff --git a/src/libs/utils/tooltip/tooltip.h b/src/libs/utils/tooltip/tooltip.h index c3139723b1..ece289b66b 100644 --- a/src/libs/utils/tooltip/tooltip.h +++ b/src/libs/utils/tooltip/tooltip.h @@ -71,13 +71,13 @@ public: static ToolTip *instance(); - static void show(const QPoint &pos, const QString &content, QWidget *w = 0, + static void show(const QPoint &pos, const QString &content, QWidget *w = nullptr, const QString &helpId = QString(), const QRect &rect = QRect()); - static void show(const QPoint &pos, const QColor &color, QWidget *w = 0, + static void show(const QPoint &pos, const QColor &color, QWidget *w = nullptr, const QString &helpId = QString(), const QRect &rect = QRect()); - static void show(const QPoint &pos, QWidget *content, QWidget *w = 0, + static void show(const QPoint &pos, QWidget *content, QWidget *w = nullptr, const QString &helpId = QString(), const QRect &rect = QRect()); - static void show(const QPoint &pos, QLayout *content, QWidget *w = 0, + static void show(const QPoint &pos, QLayout *content, QWidget *w = nullptr, const QString &helpId = QString(), const QRect &rect = QRect()); static void move(const QPoint &pos, QWidget *w); static void hide(); diff --git a/src/libs/utils/treemodel.h b/src/libs/utils/treemodel.h index 930f6f5e2e..bf20b75c8d 100644 --- a/src/libs/utils/treemodel.h +++ b/src/libs/utils/treemodel.h @@ -170,8 +170,8 @@ class QTCREATOR_UTILS_EXPORT BaseTreeModel : public QAbstractItemModel Q_OBJECT protected: - explicit BaseTreeModel(QObject *parent = 0); - explicit BaseTreeModel(TreeItem *root, QObject *parent = 0); + explicit BaseTreeModel(QObject *parent = nullptr); + explicit BaseTreeModel(TreeItem *root, QObject *parent = nullptr); ~BaseTreeModel() override; void setHeader(const QStringList &displays); @@ -269,8 +269,8 @@ public: using RootItem = typename Internal::SelectType<0, LevelItemTypes...>::Type; using BestItem = typename Internal::BestItemType<LevelItemTypes...>::Type; - explicit TreeModel(QObject *parent = 0) : BaseTreeModel(new RootItem, parent) {} - explicit TreeModel(RootItem *root, QObject *parent = 0) : BaseTreeModel(root, parent) {} + explicit TreeModel(QObject *parent = nullptr) : BaseTreeModel(new RootItem, parent) {} + explicit TreeModel(RootItem *root, QObject *parent = nullptr) : BaseTreeModel(root, parent) {} using BaseTreeModel::canFetchMore; using BaseTreeModel::clear; @@ -307,14 +307,17 @@ public: } template<int Level> - typename Internal::SelectType<Level, LevelItemTypes...>::Type *itemForIndexAtLevel(const QModelIndex &idx) const { - TreeItem *item = BaseTreeModel::itemForIndex(idx); - return item && item->level() == Level ? static_cast<typename Internal::SelectType<Level, LevelItemTypes...>::Type *>(item) : 0; + typename Internal::SelectType<Level, LevelItemTypes...>::Type *itemForIndexAtLevel( + const QModelIndex &idx) const { + TreeItem *item = BaseTreeModel::itemForIndex(idx); + return item && item->level() == Level + ? static_cast<typename Internal::SelectType<Level, LevelItemTypes...>::Type *>(item) + : nullptr; } BestItem *nonRootItemForIndex(const QModelIndex &idx) const { TreeItem *item = BaseTreeModel::itemForIndex(idx); - return item && item->parent() ? static_cast<BestItem *>(item) : 0; + return item && item->parent() ? static_cast<BestItem *>(item) : nullptr; } template <class Predicate> diff --git a/src/libs/utils/treeviewcombobox.h b/src/libs/utils/treeviewcombobox.h index 9377c1ff0c..0bdfc73cbb 100644 --- a/src/libs/utils/treeviewcombobox.h +++ b/src/libs/utils/treeviewcombobox.h @@ -36,7 +36,7 @@ class QTCREATOR_UTILS_EXPORT TreeViewComboBoxView : public QTreeView { Q_OBJECT public: - TreeViewComboBoxView(QWidget *parent = 0); + TreeViewComboBoxView(QWidget *parent = nullptr); void adjustWidth(int width); }; @@ -44,7 +44,7 @@ class QTCREATOR_UTILS_EXPORT TreeViewComboBox : public QComboBox { Q_OBJECT public: - TreeViewComboBox(QWidget *parent = 0); + TreeViewComboBox(QWidget *parent = nullptr); void wheelEvent(QWheelEvent *e) override; void keyPressEvent(QKeyEvent *e) override; diff --git a/src/libs/utils/wizard.h b/src/libs/utils/wizard.h index 88d0641d84..6075527113 100644 --- a/src/libs/utils/wizard.h +++ b/src/libs/utils/wizard.h @@ -43,7 +43,7 @@ class QTCREATOR_UTILS_EXPORT Wizard : public QWizard Q_PROPERTY(bool automaticProgressCreationEnabled READ isAutomaticProgressCreationEnabled WRITE setAutomaticProgressCreationEnabled) public: - explicit Wizard(QWidget *parent = 0, Qt::WindowFlags flags = 0); + explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags flags = nullptr); ~Wizard() override; bool isAutomaticProgressCreationEnabled() const; @@ -93,7 +93,7 @@ class QTCREATOR_UTILS_EXPORT WizardProgress : public QObject Q_OBJECT public: - WizardProgress(QObject *parent = 0); + WizardProgress(QObject *parent = nullptr); ~WizardProgress() override; WizardProgressItem *addItem(const QString &title); diff --git a/src/libs/utils/wizardpage.h b/src/libs/utils/wizardpage.h index 87fac3ba8d..fa8c60b052 100644 --- a/src/libs/utils/wizardpage.h +++ b/src/libs/utils/wizardpage.h @@ -74,7 +74,7 @@ class QTCREATOR_UTILS_EXPORT WizardPage : public QWizardPage Q_OBJECT public: - explicit WizardPage(QWidget *parent = 0); + explicit WizardPage(QWidget *parent = nullptr); virtual void pageWasAdded(); // called when this page was added to a Utils::Wizard @@ -86,7 +86,7 @@ public: } void registerFieldWithName(const QString &name, QWidget *widget, - const char *property = 0, const char *changedSignal = 0); + const char *property = nullptr, const char *changedSignal = nullptr); virtual bool handleReject(); virtual bool handleAccept(); |