diff options
Diffstat (limited to 'src')
53 files changed, 118 insertions, 174 deletions
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 4a0d18e945..42dd638fbf 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -229,7 +229,7 @@ protected: Container *container; public: - typedef Container container_type; + using container_type = Container; explicit SetInsertIterator (Container &x) : container(&x) {} SetInsertIterator<Container> &operator=(const typename Container::value_type &value) @@ -253,7 +253,7 @@ template <class Container> Container *container; public: - typedef Container container_type; + using container_type = Container; explicit MapInsertIterator (Container &x) : container(&x) {} MapInsertIterator<Container> &operator=(const std::pair<const typename Container::key_type, typename Container::mapped_type> &value) diff --git a/src/libs/utils/ansiescapecodehandler.h b/src/libs/utils/ansiescapecodehandler.h index 0451297621..b2e848f845 100644 --- a/src/libs/utils/ansiescapecodehandler.h +++ b/src/libs/utils/ansiescapecodehandler.h @@ -33,8 +33,8 @@ namespace Utils { class QTCREATOR_UTILS_EXPORT FormattedText { public: - FormattedText() { } - FormattedText(const FormattedText &other) : text(other.text), format(other.format) { } + FormattedText() = default; + FormattedText(const FormattedText &other) = default; FormattedText(const QString &txt, const QTextCharFormat &fmt = QTextCharFormat()) : text(txt), format(fmt) { } diff --git a/src/libs/utils/appmainwindow.h b/src/libs/utils/appmainwindow.h index c93695550d..916772a5d1 100644 --- a/src/libs/utils/appmainwindow.h +++ b/src/libs/utils/appmainwindow.h @@ -45,7 +45,7 @@ signals: #ifdef Q_OS_WIN protected: virtual bool winEvent(MSG *message, long *result); - virtual bool event(QEvent *event); + bool event(QEvent *event) override; #endif private: diff --git a/src/libs/utils/basetreeview.h b/src/libs/utils/basetreeview.h index 653d9fb22b..923c69b042 100644 --- a/src/libs/utils/basetreeview.h +++ b/src/libs/utils/basetreeview.h @@ -110,7 +110,7 @@ template <class T> T *checkEventType(QEvent *ev) class QTCREATOR_UTILS_EXPORT ItemViewEvent { public: - ItemViewEvent() {} + ItemViewEvent() = default; ItemViewEvent(QEvent *ev, QAbstractItemView *view); template <class T> T *as() const { diff --git a/src/libs/utils/changeset.h b/src/libs/utils/changeset.h index d445237b44..4b63cfb727 100644 --- a/src/libs/utils/changeset.h +++ b/src/libs/utils/changeset.h @@ -49,26 +49,25 @@ public: Copy }; - EditOp(): type(Unset), pos1(0), pos2(0), length1(0), length2(0) {} - EditOp(Type t): type(t), pos1(0), pos2(0), length1(0), length2(0) {} - - Type type; - int pos1; - int pos2; - int length1; - int length2; + EditOp() = default; + EditOp(Type t): type(t) {} + + Type type = Unset; + int pos1 = 0; + int pos2 = 0; + int length1 = 0; + int length2 = 0; QString text; }; struct Range { - Range() - : start(0), end(0) {} + Range() = default; Range(int start, int end) : start(start), end(end) {} - int start; - int end; + int start = 0; + int end = 0; }; public: diff --git a/src/libs/utils/consoleprocess_p.h b/src/libs/utils/consoleprocess_p.h index 8fa610a709..5d8d193493 100644 --- a/src/libs/utils/consoleprocess_p.h +++ b/src/libs/utils/consoleprocess_p.h @@ -48,32 +48,32 @@ struct ConsoleProcessPrivate { ConsoleProcessPrivate(); static QString m_defaultConsoleProcess; - ConsoleProcess::Mode m_mode; + ConsoleProcess::Mode m_mode = ConsoleProcess::Run; QString m_workingDir; Environment m_environment; - qint64 m_appPid; + qint64 m_appPid = 0; int m_appCode; QString m_executable; QProcess::ExitStatus m_appStatus; QLocalServer m_stubServer; - QLocalSocket *m_stubSocket; - QTemporaryFile *m_tempFile; - QProcess::ProcessError m_error; + QLocalSocket *m_stubSocket = nullptr; + QTemporaryFile *m_tempFile = nullptr; + QProcess::ProcessError m_error = QProcess::UnknownError; QString m_errorString; #ifdef Q_OS_UNIX QProcess m_process; QByteArray m_stubServerDir; - QSettings *m_settings; - bool m_stubConnected; - qint64 m_stubPid; - QTimer *m_stubConnectTimer; + QSettings *m_settings = nullptr; + bool m_stubConnected = false; + qint64 m_stubPid = 0; + QTimer *m_stubConnectTimer = nullptr; #else - qint64 m_appMainThreadId; - PROCESS_INFORMATION *m_pid; - HANDLE m_hInferior; - QWinEventNotifier *inferiorFinishedNotifier; - QWinEventNotifier *processFinishedNotifier; + qint64 m_appMainThreadId = 0; + PROCESS_INFORMATION *m_pid = nullptr; + HANDLE m_hInferior = NULL; + QWinEventNotifier *inferiorFinishedNotifier = nullptr; + QWinEventNotifier *processFinishedNotifier = nullptr; #endif }; diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 223f8ebdab..be07027f6e 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -43,18 +43,7 @@ namespace Utils { -ConsoleProcessPrivate::ConsoleProcessPrivate() : - m_mode(ConsoleProcess::Run), - m_appPid(0), - m_stubSocket(0), - m_tempFile(0), - m_error(QProcess::UnknownError), - m_settings(0), - m_stubConnected(false), - m_stubPid(0), - m_stubConnectTimer(0) -{ -} +ConsoleProcessPrivate::ConsoleProcessPrivate() = default; ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), d(new ConsoleProcessPrivate) diff --git a/src/libs/utils/consoleprocess_win.cpp b/src/libs/utils/consoleprocess_win.cpp index 27ef6cc4d7..344642542e 100644 --- a/src/libs/utils/consoleprocess_win.cpp +++ b/src/libs/utils/consoleprocess_win.cpp @@ -36,19 +36,7 @@ namespace Utils { -ConsoleProcessPrivate::ConsoleProcessPrivate() : - m_mode(ConsoleProcess::Run), - m_appPid(0), - m_stubSocket(nullptr), - m_tempFile(nullptr), - m_error(QProcess::UnknownError), - m_appMainThreadId(0), - m_pid(nullptr), - m_hInferior(NULL), - inferiorFinishedNotifier(nullptr), - processFinishedNotifier(nullptr) -{ -} +ConsoleProcessPrivate::ConsoleProcessPrivate() = default; ConsoleProcess::ConsoleProcess(QObject *parent) : QObject(parent), d(new ConsoleProcessPrivate) diff --git a/src/libs/utils/delegates.cpp b/src/libs/utils/delegates.cpp index bbc1a42265..6b6ab7279e 100644 --- a/src/libs/utils/delegates.cpp +++ b/src/libs/utils/delegates.cpp @@ -114,7 +114,6 @@ QSize AnnotatedItemDelegate::sizeHint(const QStyleOptionViewItem &option, PathChooserDelegate::PathChooserDelegate(QObject *parent) : QStyledItemDelegate(parent) - , m_kind(Utils::PathChooser::ExistingDirectory) { } @@ -133,7 +132,7 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi Q_UNUSED(option); Q_UNUSED(index); - Utils::PathChooser *editor = new Utils::PathChooser(parent); + auto editor = new Utils::PathChooser(parent); editor->setHistoryCompleter(m_historyKey); editor->setAutoFillBackground(true); // To hide the text beneath the editor widget @@ -157,7 +156,7 @@ void PathChooserDelegate::setEditorData(QWidget *editor, const QModelIndex &inde void PathChooserDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const { - Utils::PathChooser *pathChooser = qobject_cast<Utils::PathChooser *>(editor); + auto pathChooser = qobject_cast<Utils::PathChooser *>(editor); if (!pathChooser) return; diff --git a/src/libs/utils/delegates.h b/src/libs/utils/delegates.h index 7deab7a372..cb9809a36f 100644 --- a/src/libs/utils/delegates.h +++ b/src/libs/utils/delegates.h @@ -76,7 +76,7 @@ public: void setHistoryCompleter(const QString &key); private: - PathChooser::Kind m_kind; + PathChooser::Kind m_kind = PathChooser::ExistingDirectory; QString m_filter; QString m_historyKey; }; diff --git a/src/libs/utils/dropsupport.h b/src/libs/utils/dropsupport.h index a423a36046..daff8f7537 100644 --- a/src/libs/utils/dropsupport.h +++ b/src/libs/utils/dropsupport.h @@ -51,7 +51,7 @@ public: int column; }; // returns true if the event should be accepted - typedef std::function<bool(QDropEvent*,DropSupport*)> DropFilterFunction; + using DropFilterFunction = std::function<bool(QDropEvent*, DropSupport*)>; DropSupport(QWidget *parentWidget, const DropFilterFunction &filterFunction = DropFilterFunction()); diff --git a/src/libs/utils/elfreader.h b/src/libs/utils/elfreader.h index d1c1dc2286..cc82e71d01 100644 --- a/src/libs/utils/elfreader.h +++ b/src/libs/utils/elfreader.h @@ -137,7 +137,7 @@ public: class QTCREATOR_UTILS_EXPORT ElfData { public: - ElfData() : symbolsType(UnknownSymbols) {} + ElfData() = default; int indexOf(const QByteArray &name) const; public: @@ -148,7 +148,7 @@ public: quint64 entryPoint; QByteArray debugLink; QByteArray buildId; - DebugSymbolsType symbolsType; + DebugSymbolsType symbolsType = UnknownSymbols; QVector<ElfSectionHeader> sectionHeaders; QVector<ElfProgramHeader> programHeaders; }; diff --git a/src/libs/utils/environment.h b/src/libs/utils/environment.h index ea2dab2420..4803dda2a5 100644 --- a/src/libs/utils/environment.h +++ b/src/libs/utils/environment.h @@ -82,7 +82,7 @@ QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const EnvironmentItem &i) class QTCREATOR_UTILS_EXPORT Environment { public: - typedef QMap<QString, QString>::const_iterator const_iterator; + using const_iterator = QMap<QString, QString>::const_iterator; explicit Environment(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {} explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs()); diff --git a/src/libs/utils/fancylineedit.h b/src/libs/utils/fancylineedit.h index 8ba5c14532..e9753e269c 100644 --- a/src/libs/utils/fancylineedit.h +++ b/src/libs/utils/fancylineedit.h @@ -121,7 +121,7 @@ public: // Validation // line edit, (out)errorMessage -> valid? - typedef std::function<bool(FancyLineEdit *, QString *)> ValidationFunction; + using ValidationFunction = std::function<bool(FancyLineEdit *, QString *)>; enum State { Invalid, DisplayingPlaceholderText, Valid }; State state() const; diff --git a/src/libs/utils/filesearch.h b/src/libs/utils/filesearch.h index a25949e220..cddb637184 100644 --- a/src/libs/utils/filesearch.h +++ b/src/libs/utils/filesearch.h @@ -65,26 +65,26 @@ public: class Item { public: - Item() : encoding(nullptr) { } + Item() = default; Item(const QString &path, QTextCodec *codec) : filePath(path), encoding(codec) {} QString filePath; - QTextCodec *encoding; + QTextCodec *encoding = nullptr; }; - typedef Item value_type; + using value_type = Item; class const_iterator { public: - typedef std::forward_iterator_tag iterator_category; - typedef Item value_type; - typedef std::ptrdiff_t difference_type; - typedef const value_type *pointer; - typedef const value_type &reference; + using iterator_category = std::forward_iterator_tag; + using value_type = Item; + using difference_type = std::ptrdiff_t; + using pointer = const value_type*; + using reference = const value_type&; - const_iterator() : m_parent(nullptr), m_index(-1) { } + const_iterator() = default; const_iterator(const FileIterator *parent, int id) : m_parent(parent), m_index(id) {} @@ -100,11 +100,11 @@ public: } bool operator!=(const const_iterator &other) const { return !operator==(other); } - const FileIterator *m_parent; - int m_index; // -1 == end + const FileIterator *m_parent = nullptr; + int m_index = -1; // -1 == end }; - virtual ~FileIterator() {} + virtual ~FileIterator() = default; const_iterator begin() const; const_iterator end() const; @@ -169,7 +169,7 @@ private: class QTCREATOR_UTILS_EXPORT FileSearchResult { public: - FileSearchResult() {} + FileSearchResult() = default; FileSearchResult(const QString &fileName, int lineNumber, const QString &matchingLine, int matchStart, int matchLength, const QStringList ®expCapturedTexts) @@ -189,7 +189,7 @@ public: QStringList regexpCapturedTexts; }; -typedef QList<FileSearchResult> FileSearchResultList; +using FileSearchResultList = QList<FileSearchResult>; QTCREATOR_UTILS_EXPORT QFuture<FileSearchResultList> findInFiles(const QString &searchTerm, FileIterator *files, QTextDocument::FindFlags flags, const QMap<QString, QString> &fileToContentsMap = QMap<QString, QString>()); diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index ccf1b50b0a..48d8787100 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -395,10 +395,7 @@ bool FileReader::fetch(const QString &fileName, QIODevice::OpenMode mode, QWidge } #endif // QT_GUI_LIB -FileSaverBase::FileSaverBase() - : m_hasError(false) -{ -} +FileSaverBase::FileSaverBase() = default; FileSaverBase::~FileSaverBase() = default; @@ -526,7 +523,6 @@ bool FileSaver::finalize() } TempFileSaver::TempFileSaver(const QString &templ) - : m_autoRemove(true) { m_file.reset(new QTemporaryFile{}); auto tempFile = static_cast<QTemporaryFile *>(m_file.get()); diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h index 011069e118..f6b0032f61 100644 --- a/src/libs/utils/fileutils.h +++ b/src/libs/utils/fileutils.h @@ -206,7 +206,7 @@ protected: std::unique_ptr<QFile> m_file; QString m_fileName; QString m_errorString; - bool m_hasError; + bool m_hasError = false; private: Q_DISABLE_COPY(FileSaverBase) @@ -236,7 +236,7 @@ public: void setAutoRemove(bool on) { m_autoRemove = on; } private: - bool m_autoRemove; + bool m_autoRemove = true; }; } // namespace Utils diff --git a/src/libs/utils/fixedsizeclicklabel.cpp b/src/libs/utils/fixedsizeclicklabel.cpp index a648fd66e3..2e1ab89ef6 100644 --- a/src/libs/utils/fixedsizeclicklabel.cpp +++ b/src/libs/utils/fixedsizeclicklabel.cpp @@ -58,7 +58,6 @@ namespace Utils { */ FixedSizeClickLabel::FixedSizeClickLabel(QWidget *parent) : QLabel(parent) - , m_pressed(false) { } diff --git a/src/libs/utils/fixedsizeclicklabel.h b/src/libs/utils/fixedsizeclicklabel.h index eb89de7ab9..93cf27cc9f 100644 --- a/src/libs/utils/fixedsizeclicklabel.h +++ b/src/libs/utils/fixedsizeclicklabel.h @@ -54,7 +54,7 @@ signals: private: QString m_maxText; - bool m_pressed; + bool m_pressed = false; }; } // namespace Utils diff --git a/src/libs/utils/htmldocextractor.cpp b/src/libs/utils/htmldocextractor.cpp index e58accf8ef..ac3246d281 100644 --- a/src/libs/utils/htmldocextractor.cpp +++ b/src/libs/utils/htmldocextractor.cpp @@ -38,10 +38,7 @@ namespace { } } -HtmlDocExtractor::HtmlDocExtractor() : - m_formatContents(true), - m_mode(FirstParagraph) -{} +HtmlDocExtractor::HtmlDocExtractor() = default; void HtmlDocExtractor::setMode(Mode mode) { m_mode = mode; } diff --git a/src/libs/utils/htmldocextractor.h b/src/libs/utils/htmldocextractor.h index f7c82f54a1..d4ede7d4ee 100644 --- a/src/libs/utils/htmldocextractor.h +++ b/src/libs/utils/htmldocextractor.h @@ -81,8 +81,8 @@ private: static void replaceTablesForSimpleLines(QString *html); static void replaceListsForSimpleLines(QString *html); - bool m_formatContents; - Mode m_mode; + bool m_formatContents = true; + Mode m_mode = FirstParagraph; }; } // namespace Utils diff --git a/src/libs/utils/icon.h b/src/libs/utils/icon.h index 5de0896653..67c39ac4ee 100644 --- a/src/libs/utils/icon.h +++ b/src/libs/utils/icon.h @@ -38,7 +38,7 @@ QT_FORWARD_DECLARE_CLASS(QString) namespace Utils { -typedef QPair<QString, Theme::Color> IconMaskAndColor; +using IconMaskAndColor = QPair<QString, Theme::Color>; // Returns a recolored icon with shadow and custom disabled state for a // series of grayscalemask|Theme::Color mask pairs diff --git a/src/libs/utils/json.h b/src/libs/utils/json.h index df7881a55e..1179a0c967 100644 --- a/src/libs/utils/json.h +++ b/src/libs/utils/json.h @@ -51,7 +51,7 @@ public: inline void *allocate(size_t size) { - char *obj = new char[size]; + auto obj = new char[size]; _objs.append(obj); return obj; } diff --git a/src/libs/utils/link.h b/src/libs/utils/link.h index d6df02c076..6a87048eee 100644 --- a/src/libs/utils/link.h +++ b/src/libs/utils/link.h @@ -35,9 +35,7 @@ namespace Utils { struct Link { Link(const QString &fileName = QString(), int line = 0, int column = 0) - : linkTextStart(-1) - , linkTextEnd(-1) - , targetFileName(fileName) + : targetFileName(fileName) , targetLine(line) , targetColumn(column) {} @@ -51,8 +49,8 @@ struct Link bool operator==(const Link &other) const { return linkTextStart == other.linkTextStart && linkTextEnd == other.linkTextEnd; } - int linkTextStart; - int linkTextEnd; + int linkTextStart = 1; + int linkTextEnd = -1; QString targetFileName; int targetLine; diff --git a/src/libs/utils/macroexpander.h b/src/libs/utils/macroexpander.h index ff96eb1089..f17ae86b8c 100644 --- a/src/libs/utils/macroexpander.h +++ b/src/libs/utils/macroexpander.h @@ -38,8 +38,8 @@ namespace Utils { namespace Internal { class MacroExpanderPrivate; } class MacroExpander; -typedef std::function<MacroExpander *()> MacroExpanderProvider; -typedef QVector<MacroExpanderProvider> MacroExpanderProviders; +using MacroExpanderProvider = std::function<MacroExpander *()>; +using MacroExpanderProviders = QVector<MacroExpanderProvider>; class QTCREATOR_UTILS_EXPORT MacroExpander { @@ -59,10 +59,10 @@ public: QString expandProcessArgs(const QString &argsWithVariables) const; - typedef std::function<QString(QString)> PrefixFunction; - typedef std::function<bool(QString, QString *)> ResolverFunction; - typedef std::function<QString()> StringFunction; - typedef std::function<int()> IntFunction; + using PrefixFunction = std::function<QString(QString)>; + using ResolverFunction = std::function<bool(QString, QString *)>; + using StringFunction = std::function<QString()>; + using IntFunction = std::function<int()>; void registerPrefix(const QByteArray &prefix, const QString &description, const PrefixFunction &value); diff --git a/src/libs/utils/overridecursor.cpp b/src/libs/utils/overridecursor.cpp index 4c9093917f..7868289725 100644 --- a/src/libs/utils/overridecursor.cpp +++ b/src/libs/utils/overridecursor.cpp @@ -30,7 +30,7 @@ using namespace Utils; OverrideCursor::OverrideCursor(const QCursor &cursor) - : m_set(true), m_cursor(cursor) + : m_cursor(cursor) { QApplication::setOverrideCursor(cursor); } diff --git a/src/libs/utils/overridecursor.h b/src/libs/utils/overridecursor.h index 5ca2bb5800..00ce021fe2 100644 --- a/src/libs/utils/overridecursor.h +++ b/src/libs/utils/overridecursor.h @@ -39,7 +39,7 @@ public: void set(); void reset(); private: - bool m_set; + bool m_set = true; QCursor m_cursor; }; diff --git a/src/libs/utils/port.h b/src/libs/utils/port.h index 0ed62d0a9b..56d0b646dc 100644 --- a/src/libs/utils/port.h +++ b/src/libs/utils/port.h @@ -38,7 +38,7 @@ namespace Utils { class QTCREATOR_UTILS_EXPORT Port { public: - Port() : m_port(-1) {} + Port() = default; explicit Port(quint16 port) : m_port(port) {} explicit Port(int port) : m_port((port < 0 || port > std::numeric_limits<quint16>::max()) ? -1 : port) @@ -56,7 +56,7 @@ public: QString toString() const { return QString::number(m_port); } private: - int m_port; + int m_port = -1; }; inline bool operator<(const Port &p1, const Port &p2) { return p1.number() < p2.number(); } diff --git a/src/libs/utils/proxyaction.cpp b/src/libs/utils/proxyaction.cpp index 3bfbfa399c..67917e71b1 100644 --- a/src/libs/utils/proxyaction.cpp +++ b/src/libs/utils/proxyaction.cpp @@ -28,11 +28,7 @@ using namespace Utils; ProxyAction::ProxyAction(QObject *parent) : - QAction(parent), - m_action(nullptr), - m_attributes(nullptr), - m_showShortcut(false), - m_block(false) + QAction(parent) { connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence); updateState(); diff --git a/src/libs/utils/proxyaction.h b/src/libs/utils/proxyaction.h index 5058bb42f3..6f5671cea7 100644 --- a/src/libs/utils/proxyaction.h +++ b/src/libs/utils/proxyaction.h @@ -68,11 +68,11 @@ private: void connectAction(); void update(QAction *action, bool initialize); - QPointer<QAction> m_action; - Attributes m_attributes; - bool m_showShortcut; + QPointer<QAction> m_action = nullptr; + Attributes m_attributes = {}; + bool m_showShortcut = false; QString m_toolTip; - bool m_block; + bool m_block = false; }; } // namespace Utils diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index eb9cf9f647..dd4fe16f49 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -668,9 +668,7 @@ bool QtcProcess::prepareCommand(const QString &command, const QString &arguments } QtcProcess::QtcProcess(QObject *parent) - : QProcess(parent), - m_haveEnv(false), - m_useCtrlCStub(false) + : QProcess(parent) { static int qProcessExitStatusMeta = qRegisterMetaType<QProcess::ExitStatus>(); static int qProcessProcessErrorMeta = qRegisterMetaType<QProcess::ProcessError>(); diff --git a/src/libs/utils/qtcprocess.h b/src/libs/utils/qtcprocess.h index 4ff75a7dae..44c5786661 100644 --- a/src/libs/utils/qtcprocess.h +++ b/src/libs/utils/qtcprocess.h @@ -106,7 +106,7 @@ public: class QTCREATOR_UTILS_EXPORT ArgIterator { public: ArgIterator(QString *str, OsType osType = HostOsInfo::hostOs()) - : m_str(str), m_pos(0), m_prev(-1), m_osType(osType) + : m_str(str), m_osType(osType) {} //! Get the next argument. Returns false on encountering end of first command. bool next(); @@ -121,7 +121,8 @@ public: void appendArg(const QString &str); private: QString *m_str, m_value; - int m_pos, m_prev; + int m_pos = 0; + int m_prev = -1; bool m_simple; OsType m_osType; }; @@ -143,8 +144,8 @@ private: QString m_command; QString m_arguments; Environment m_environment; - bool m_haveEnv; - bool m_useCtrlCStub; + bool m_haveEnv = false; + bool m_useCtrlCStub = false; }; } // namespace Utils diff --git a/src/libs/utils/savedaction.cpp b/src/libs/utils/savedaction.cpp index a1b3aac0e3..0000e54d31 100644 --- a/src/libs/utils/savedaction.cpp +++ b/src/libs/utils/savedaction.cpp @@ -56,7 +56,6 @@ namespace Utils { SavedAction::SavedAction(QObject *parent) : QAction(parent) { - m_widget = nullptr; connect(this, &QAction::triggered, this, &SavedAction::actionTriggered); } diff --git a/src/libs/utils/savedaction.h b/src/libs/utils/savedaction.h index 45454939f1..5f90de65ed 100644 --- a/src/libs/utils/savedaction.h +++ b/src/libs/utils/savedaction.h @@ -83,14 +83,14 @@ private: QString m_settingsKey; QString m_settingsGroup; QString m_dialogText; - QWidget *m_widget; + QWidget *m_widget = nullptr; }; class QTCREATOR_UTILS_EXPORT SavedActionSet { public: - SavedActionSet() {} - ~SavedActionSet() {} + SavedActionSet() = default; + ~SavedActionSet() = default; void insert(SavedAction *action, QWidget *widget); void apply(QSettings *settings); diff --git a/src/libs/utils/savefile.cpp b/src/libs/utils/savefile.cpp index 6413a823ce..36b515568e 100644 --- a/src/libs/utils/savefile.cpp +++ b/src/libs/utils/savefile.cpp @@ -39,7 +39,7 @@ namespace Utils { QFile::Permissions SaveFile::m_umask = nullptr; SaveFile::SaveFile(const QString &filename) : - m_finalFileName(filename), m_finalized(true) + m_finalFileName(filename) { } diff --git a/src/libs/utils/savefile.h b/src/libs/utils/savefile.h index 56d60aacc9..799b30c9ca 100644 --- a/src/libs/utils/savefile.h +++ b/src/libs/utils/savefile.h @@ -51,7 +51,7 @@ public: private: const QString m_finalFileName; std::unique_ptr<QTemporaryFile> m_tempFile; - bool m_finalized; + bool m_finalized = true; static QFile::Permissions m_umask; }; diff --git a/src/libs/utils/scopedswap.h b/src/libs/utils/scopedswap.h index 4cc129bd21..46384448bc 100644 --- a/src/libs/utils/scopedswap.h +++ b/src/libs/utils/scopedswap.h @@ -49,6 +49,6 @@ public: } }; -typedef ScopedSwap<bool> ScopedBoolSwap; +using ScopedBoolSwap = ScopedSwap<bool>; } // Utils namespace diff --git a/src/libs/utils/settingsaccessor.h b/src/libs/utils/settingsaccessor.h index e431086553..10675cbf4c 100644 --- a/src/libs/utils/settingsaccessor.h +++ b/src/libs/utils/settingsaccessor.h @@ -78,7 +78,7 @@ public: virtual ~SettingsAccessor() = default; enum ProceedInfo { Continue, DiscardAndContinue }; - typedef QHash<QMessageBox::StandardButton, ProceedInfo> ButtonMap; + using ButtonMap = QHash<QMessageBox::StandardButton, ProceedInfo>; class Issue { public: enum class Type { ERROR, WARNING }; @@ -224,7 +224,7 @@ public: virtual QVariantMap upgrade(const QVariantMap &data) = 0; protected: - typedef QPair<QLatin1String,QLatin1String> Change; + using Change = QPair<QLatin1String,QLatin1String>; QVariantMap renameKeys(const QList<Change> &changes, QVariantMap map) const; private: diff --git a/src/libs/utils/settingsselector.h b/src/libs/utils/settingsselector.h index 7c5220afad..16d98e40c7 100644 --- a/src/libs/utils/settingsselector.h +++ b/src/libs/utils/settingsselector.h @@ -46,8 +46,8 @@ class QTCREATOR_UTILS_EXPORT SettingsSelector : public QWidget Q_OBJECT public: - explicit SettingsSelector(QWidget *parent = 0); - ~SettingsSelector(); + explicit SettingsSelector(QWidget *parent = nullptr); + ~SettingsSelector() override; void setConfigurationModel(QAbstractItemModel *model); QAbstractItemModel *configurationModel() const; diff --git a/src/libs/utils/shellcommand.cpp b/src/libs/utils/shellcommand.cpp index d44b5bd982..92d97dc65b 100644 --- a/src/libs/utils/shellcommand.cpp +++ b/src/libs/utils/shellcommand.cpp @@ -503,7 +503,6 @@ void ShellCommand::setOutputProxyFactory(const std::function<OutputProxy *()> &f } ProgressParser::ProgressParser() : - m_future(nullptr), m_futureMutex(new QMutex) { } diff --git a/src/libs/utils/shellcommand.h b/src/libs/utils/shellcommand.h index 3f933ee114..9bd5c04a41 100644 --- a/src/libs/utils/shellcommand.h +++ b/src/libs/utils/shellcommand.h @@ -63,7 +63,7 @@ private: void setFuture(QFutureInterface<void> *future); QFutureInterface<void> *m_future; - QMutex *m_futureMutex; + QMutex *m_futureMutex = nullptr; friend class ShellCommand; }; diff --git a/src/libs/utils/statuslabel.cpp b/src/libs/utils/statuslabel.cpp index c9b6317fdf..ff4a63843d 100644 --- a/src/libs/utils/statuslabel.cpp +++ b/src/libs/utils/statuslabel.cpp @@ -35,7 +35,7 @@ namespace Utils { -StatusLabel::StatusLabel(QWidget *parent) : QLabel(parent), m_timer(nullptr) +StatusLabel::StatusLabel(QWidget *parent) : QLabel(parent) { // A manual size let's us shrink below minimum text width which is what // we want in [fake] status bars. diff --git a/src/libs/utils/statuslabel.h b/src/libs/utils/statuslabel.h index 470040d572..054330b085 100644 --- a/src/libs/utils/statuslabel.h +++ b/src/libs/utils/statuslabel.h @@ -47,7 +47,7 @@ private: void slotTimeout(); void stopTimer(); - QTimer *m_timer; + QTimer *m_timer = nullptr; QString m_lastPermanentStatusMessage; }; diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index 6f1f90d082..0f8d4ea825 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -84,7 +84,7 @@ namespace Utils { // A special QProcess derivative allowing for terminal control. class TerminalControllingProcess : public QProcess { public: - TerminalControllingProcess() : m_flags(0) {} + TerminalControllingProcess() = default; unsigned flags() const { return m_flags; } void setFlags(unsigned tc) { m_flags = tc; } @@ -93,7 +93,7 @@ protected: void setupChildProcess() override; private: - unsigned m_flags; + unsigned m_flags = 0; }; void TerminalControllingProcess::setupChildProcess() diff --git a/src/libs/utils/textfileformat.cpp b/src/libs/utils/textfileformat.cpp index 4dc281d8a3..afd4e62e83 100644 --- a/src/libs/utils/textfileformat.cpp +++ b/src/libs/utils/textfileformat.cpp @@ -68,10 +68,7 @@ QDebug operator<<(QDebug d, const TextFileFormat &format) as strings or string lists and to write out files. */ -TextFileFormat::TextFileFormat() : - lineTerminationMode(NativeLineTerminator), hasUtf8Bom(false), codec(nullptr) -{ -} +TextFileFormat::TextFileFormat() = default; /*! Detects the format of text data. diff --git a/src/libs/utils/textfileformat.h b/src/libs/utils/textfileformat.h index ab432a53d6..9ac452a6e5 100644 --- a/src/libs/utils/textfileformat.h +++ b/src/libs/utils/textfileformat.h @@ -78,9 +78,9 @@ public: static QByteArray decodingErrorSample(const QByteArray &data); - LineTerminationMode lineTerminationMode; - bool hasUtf8Bom; - const QTextCodec *codec; + LineTerminationMode lineTerminationMode = NativeLineTerminator; + bool hasUtf8Bom = false; + const QTextCodec *codec = nullptr; }; } // namespace Utils diff --git a/src/libs/utils/treemodel.cpp b/src/libs/utils/treemodel.cpp index f5ed3b251d..0d587dddbc 100644 --- a/src/libs/utils/treemodel.cpp +++ b/src/libs/utils/treemodel.cpp @@ -605,10 +605,7 @@ namespace Utils { // // TreeItem // -TreeItem::TreeItem() - : m_parent(nullptr), m_model(nullptr) -{ -} +TreeItem::TreeItem() = default; TreeItem::~TreeItem() { diff --git a/src/libs/utils/treemodel.h b/src/libs/utils/treemodel.h index bf20b75c8d..92f501ff4a 100644 --- a/src/libs/utils/treemodel.h +++ b/src/libs/utils/treemodel.h @@ -99,8 +99,8 @@ private: void removeItemAt(int pos); void propagateModel(BaseTreeModel *m); - TreeItem *m_parent; // Not owned. - BaseTreeModel *m_model; // Not owned. + TreeItem *m_parent = nullptr; // Not owned. + BaseTreeModel *m_model = nullptr; // Not owned. QVector<TreeItem *> m_children; // Owned. friend class BaseTreeModel; }; diff --git a/src/libs/utils/treeviewcombobox.cpp b/src/libs/utils/treeviewcombobox.cpp index 4f20bab537..36a62d3694 100644 --- a/src/libs/utils/treeviewcombobox.cpp +++ b/src/libs/utils/treeviewcombobox.cpp @@ -44,7 +44,7 @@ void TreeViewComboBoxView::adjustWidth(int width) TreeViewComboBox::TreeViewComboBox(QWidget *parent) - : QComboBox(parent), m_skipNextHide(false) + : QComboBox(parent) { m_view = new TreeViewComboBoxView; m_view->setHeaderHidden(true); diff --git a/src/libs/utils/treeviewcombobox.h b/src/libs/utils/treeviewcombobox.h index 0bdfc73cbb..08ab5d7226 100644 --- a/src/libs/utils/treeviewcombobox.h +++ b/src/libs/utils/treeviewcombobox.h @@ -61,6 +61,6 @@ private: QModelIndex lastIndex(const QModelIndex &index); TreeViewComboBoxView *m_view; - bool m_skipNextHide; + bool m_skipNextHide = false; }; } diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp index 852bea627a..6771f3f4ea 100644 --- a/src/libs/utils/uncommentselection.cpp +++ b/src/libs/utils/uncommentselection.cpp @@ -32,14 +32,11 @@ using namespace Utils; CommentDefinition CommentDefinition::CppStyle = CommentDefinition("//", "/*", "*/"); CommentDefinition CommentDefinition::HashStyle = CommentDefinition("#"); -CommentDefinition::CommentDefinition() : - isAfterWhiteSpaces(false) -{} +CommentDefinition::CommentDefinition() = default; CommentDefinition::CommentDefinition(const QString &single, const QString &multiStart, const QString &multiEnd) - : isAfterWhiteSpaces(false), - singleLine(single), + : singleLine(single), multiLineStart(multiStart), multiLineEnd(multiEnd) { diff --git a/src/libs/utils/uncommentselection.h b/src/libs/utils/uncommentselection.h index dbc47bbc64..b61fce48c9 100644 --- a/src/libs/utils/uncommentselection.h +++ b/src/libs/utils/uncommentselection.h @@ -50,7 +50,7 @@ public: bool hasMultiLineStyle() const; public: - bool isAfterWhiteSpaces; + bool isAfterWhiteSpaces = false; QString singleLine; QString multiLineStart; QString multiLineEnd; diff --git a/src/libs/utils/wizard.cpp b/src/libs/utils/wizard.cpp index 4d83a381e5..a1c0e2fb68 100644 --- a/src/libs/utils/wizard.cpp +++ b/src/libs/utils/wizard.cpp @@ -565,12 +565,7 @@ class WizardProgressPrivate Q_DECLARE_PUBLIC(WizardProgress) public: - WizardProgressPrivate() - : - m_currentItem(nullptr), - m_startItem(nullptr) - { - } + WizardProgressPrivate() = default; bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const; // if multiple paths are possible the empty list is returned @@ -585,8 +580,8 @@ public: QList<WizardProgressItem *> m_visitedItems; QList<WizardProgressItem *> m_reachableItems; - WizardProgressItem *m_currentItem; - WizardProgressItem *m_startItem; + WizardProgressItem *m_currentItem = nullptr; + WizardProgressItem *m_startItem = nullptr; }; class WizardProgressItemPrivate |