Utils: Modernize further

Many issues, mostly in headers, were not addressed in
e38410b76c

modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default

Change-Id: I320a51726db881e582b898948d53735ebb06887a
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2018-07-23 10:45:40 +02:00
parent 00c926b6b4
commit f6943a712a
53 changed files with 117 additions and 173 deletions

View File

@@ -229,7 +229,7 @@ protected:
Container *container; Container *container;
public: public:
typedef Container container_type; using container_type = Container;
explicit SetInsertIterator (Container &x) explicit SetInsertIterator (Container &x)
: container(&x) {} : container(&x) {}
SetInsertIterator<Container> &operator=(const typename Container::value_type &value) SetInsertIterator<Container> &operator=(const typename Container::value_type &value)
@@ -253,7 +253,7 @@ template <class Container>
Container *container; Container *container;
public: public:
typedef Container container_type; using container_type = Container;
explicit MapInsertIterator (Container &x) explicit MapInsertIterator (Container &x)
: container(&x) {} : container(&x) {}
MapInsertIterator<Container> &operator=(const std::pair<const typename Container::key_type, typename Container::mapped_type> &value) MapInsertIterator<Container> &operator=(const std::pair<const typename Container::key_type, typename Container::mapped_type> &value)

View File

@@ -33,8 +33,8 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT FormattedText { class QTCREATOR_UTILS_EXPORT FormattedText {
public: public:
FormattedText() { } FormattedText() = default;
FormattedText(const FormattedText &other) : text(other.text), format(other.format) { } FormattedText(const FormattedText &other) = default;
FormattedText(const QString &txt, const QTextCharFormat &fmt = QTextCharFormat()) : FormattedText(const QString &txt, const QTextCharFormat &fmt = QTextCharFormat()) :
text(txt), format(fmt) text(txt), format(fmt)
{ } { }

View File

@@ -45,7 +45,7 @@ signals:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
protected: protected:
virtual bool winEvent(MSG *message, long *result); virtual bool winEvent(MSG *message, long *result);
virtual bool event(QEvent *event); bool event(QEvent *event) override;
#endif #endif
private: private:

View File

@@ -110,7 +110,7 @@ template <class T> T *checkEventType(QEvent *ev)
class QTCREATOR_UTILS_EXPORT ItemViewEvent class QTCREATOR_UTILS_EXPORT ItemViewEvent
{ {
public: public:
ItemViewEvent() {} ItemViewEvent() = default;
ItemViewEvent(QEvent *ev, QAbstractItemView *view); ItemViewEvent(QEvent *ev, QAbstractItemView *view);
template <class T> T *as() const { template <class T> T *as() const {

View File

@@ -49,26 +49,25 @@ public:
Copy Copy
}; };
EditOp(): type(Unset), pos1(0), pos2(0), length1(0), length2(0) {} EditOp() = default;
EditOp(Type t): type(t), pos1(0), pos2(0), length1(0), length2(0) {} EditOp(Type t): type(t) {}
Type type; Type type = Unset;
int pos1; int pos1 = 0;
int pos2; int pos2 = 0;
int length1; int length1 = 0;
int length2; int length2 = 0;
QString text; QString text;
}; };
struct Range { struct Range {
Range() Range() = default;
: start(0), end(0) {}
Range(int start, int end) Range(int start, int end)
: start(start), end(end) {} : start(start), end(end) {}
int start; int start = 0;
int end; int end = 0;
}; };
public: public:

View File

@@ -48,32 +48,32 @@ struct ConsoleProcessPrivate {
ConsoleProcessPrivate(); ConsoleProcessPrivate();
static QString m_defaultConsoleProcess; static QString m_defaultConsoleProcess;
ConsoleProcess::Mode m_mode; ConsoleProcess::Mode m_mode = ConsoleProcess::Run;
QString m_workingDir; QString m_workingDir;
Environment m_environment; Environment m_environment;
qint64 m_appPid; qint64 m_appPid = 0;
int m_appCode; int m_appCode;
QString m_executable; QString m_executable;
QProcess::ExitStatus m_appStatus; QProcess::ExitStatus m_appStatus;
QLocalServer m_stubServer; QLocalServer m_stubServer;
QLocalSocket *m_stubSocket; QLocalSocket *m_stubSocket = nullptr;
QTemporaryFile *m_tempFile; QTemporaryFile *m_tempFile = nullptr;
QProcess::ProcessError m_error; QProcess::ProcessError m_error = QProcess::UnknownError;
QString m_errorString; QString m_errorString;
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
QProcess m_process; QProcess m_process;
QByteArray m_stubServerDir; QByteArray m_stubServerDir;
QSettings *m_settings; QSettings *m_settings = nullptr;
bool m_stubConnected; bool m_stubConnected = false;
qint64 m_stubPid; qint64 m_stubPid = 0;
QTimer *m_stubConnectTimer; QTimer *m_stubConnectTimer = nullptr;
#else #else
qint64 m_appMainThreadId; qint64 m_appMainThreadId = 0;
PROCESS_INFORMATION *m_pid; PROCESS_INFORMATION *m_pid = nullptr;
HANDLE m_hInferior; HANDLE m_hInferior = NULL;
QWinEventNotifier *inferiorFinishedNotifier; QWinEventNotifier *inferiorFinishedNotifier = nullptr;
QWinEventNotifier *processFinishedNotifier; QWinEventNotifier *processFinishedNotifier = nullptr;
#endif #endif
}; };

View File

@@ -43,18 +43,7 @@
namespace Utils { namespace Utils {
ConsoleProcessPrivate::ConsoleProcessPrivate() : ConsoleProcessPrivate::ConsoleProcessPrivate() = default;
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)
{
}
ConsoleProcess::ConsoleProcess(QObject *parent) : ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent), d(new ConsoleProcessPrivate) QObject(parent), d(new ConsoleProcessPrivate)

View File

@@ -36,19 +36,7 @@
namespace Utils { namespace Utils {
ConsoleProcessPrivate::ConsoleProcessPrivate() : ConsoleProcessPrivate::ConsoleProcessPrivate() = default;
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)
{
}
ConsoleProcess::ConsoleProcess(QObject *parent) : ConsoleProcess::ConsoleProcess(QObject *parent) :
QObject(parent), d(new ConsoleProcessPrivate) QObject(parent), d(new ConsoleProcessPrivate)

View File

@@ -114,7 +114,6 @@ QSize AnnotatedItemDelegate::sizeHint(const QStyleOptionViewItem &option,
PathChooserDelegate::PathChooserDelegate(QObject *parent) PathChooserDelegate::PathChooserDelegate(QObject *parent)
: QStyledItemDelegate(parent) : QStyledItemDelegate(parent)
, m_kind(Utils::PathChooser::ExistingDirectory)
{ {
} }
@@ -133,7 +132,7 @@ QWidget *PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionVi
Q_UNUSED(option); Q_UNUSED(option);
Q_UNUSED(index); Q_UNUSED(index);
Utils::PathChooser *editor = new Utils::PathChooser(parent); auto editor = new Utils::PathChooser(parent);
editor->setHistoryCompleter(m_historyKey); editor->setHistoryCompleter(m_historyKey);
editor->setAutoFillBackground(true); // To hide the text beneath the editor widget 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 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) if (!pathChooser)
return; return;

View File

@@ -76,7 +76,7 @@ public:
void setHistoryCompleter(const QString &key); void setHistoryCompleter(const QString &key);
private: private:
PathChooser::Kind m_kind; PathChooser::Kind m_kind = PathChooser::ExistingDirectory;
QString m_filter; QString m_filter;
QString m_historyKey; QString m_historyKey;
}; };

View File

@@ -51,7 +51,7 @@ public:
int column; int column;
}; };
// returns true if the event should be accepted // 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()); DropSupport(QWidget *parentWidget, const DropFilterFunction &filterFunction = DropFilterFunction());

View File

@@ -137,7 +137,7 @@ public:
class QTCREATOR_UTILS_EXPORT ElfData class QTCREATOR_UTILS_EXPORT ElfData
{ {
public: public:
ElfData() : symbolsType(UnknownSymbols) {} ElfData() = default;
int indexOf(const QByteArray &name) const; int indexOf(const QByteArray &name) const;
public: public:
@@ -148,7 +148,7 @@ public:
quint64 entryPoint; quint64 entryPoint;
QByteArray debugLink; QByteArray debugLink;
QByteArray buildId; QByteArray buildId;
DebugSymbolsType symbolsType; DebugSymbolsType symbolsType = UnknownSymbols;
QVector<ElfSectionHeader> sectionHeaders; QVector<ElfSectionHeader> sectionHeaders;
QVector<ElfProgramHeader> programHeaders; QVector<ElfProgramHeader> programHeaders;
}; };

View File

@@ -82,7 +82,7 @@ QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug debug, const EnvironmentItem &i)
class QTCREATOR_UTILS_EXPORT Environment class QTCREATOR_UTILS_EXPORT Environment
{ {
public: 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(OsType osType = HostOsInfo::hostOs()) : m_osType(osType) {}
explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs()); explicit Environment(const QStringList &env, OsType osType = HostOsInfo::hostOs());

View File

@@ -121,7 +121,7 @@ public:
// Validation // Validation
// line edit, (out)errorMessage -> valid? // line edit, (out)errorMessage -> valid?
typedef std::function<bool(FancyLineEdit *, QString *)> ValidationFunction; using ValidationFunction = std::function<bool(FancyLineEdit *, QString *)>;
enum State { Invalid, DisplayingPlaceholderText, Valid }; enum State { Invalid, DisplayingPlaceholderText, Valid };
State state() const; State state() const;

View File

@@ -65,26 +65,26 @@ public:
class Item class Item
{ {
public: public:
Item() : encoding(nullptr) { } Item() = default;
Item(const QString &path, QTextCodec *codec) Item(const QString &path, QTextCodec *codec)
: filePath(path), encoding(codec) : filePath(path), encoding(codec)
{} {}
QString filePath; QString filePath;
QTextCodec *encoding; QTextCodec *encoding = nullptr;
}; };
typedef Item value_type; using value_type = Item;
class const_iterator class const_iterator
{ {
public: public:
typedef std::forward_iterator_tag iterator_category; using iterator_category = std::forward_iterator_tag;
typedef Item value_type; using value_type = Item;
typedef std::ptrdiff_t difference_type; using difference_type = std::ptrdiff_t;
typedef const value_type *pointer; using pointer = const value_type*;
typedef const value_type &reference; using reference = const value_type&;
const_iterator() : m_parent(nullptr), m_index(-1) { } const_iterator() = default;
const_iterator(const FileIterator *parent, int id) const_iterator(const FileIterator *parent, int id)
: m_parent(parent), m_index(id) : m_parent(parent), m_index(id)
{} {}
@@ -100,11 +100,11 @@ public:
} }
bool operator!=(const const_iterator &other) const { return !operator==(other); } bool operator!=(const const_iterator &other) const { return !operator==(other); }
const FileIterator *m_parent; const FileIterator *m_parent = nullptr;
int m_index; // -1 == end int m_index = -1; // -1 == end
}; };
virtual ~FileIterator() {} virtual ~FileIterator() = default;
const_iterator begin() const; const_iterator begin() const;
const_iterator end() const; const_iterator end() const;
@@ -169,7 +169,7 @@ private:
class QTCREATOR_UTILS_EXPORT FileSearchResult class QTCREATOR_UTILS_EXPORT FileSearchResult
{ {
public: public:
FileSearchResult() {} FileSearchResult() = default;
FileSearchResult(const QString &fileName, int lineNumber, const QString &matchingLine, FileSearchResult(const QString &fileName, int lineNumber, const QString &matchingLine,
int matchStart, int matchLength, int matchStart, int matchLength,
const QStringList &regexpCapturedTexts) const QStringList &regexpCapturedTexts)
@@ -189,7 +189,7 @@ public:
QStringList regexpCapturedTexts; QStringList regexpCapturedTexts;
}; };
typedef QList<FileSearchResult> FileSearchResultList; using FileSearchResultList = QList<FileSearchResult>;
QTCREATOR_UTILS_EXPORT QFuture<FileSearchResultList> findInFiles(const QString &searchTerm, FileIterator *files, QTCREATOR_UTILS_EXPORT QFuture<FileSearchResultList> findInFiles(const QString &searchTerm, FileIterator *files,
QTextDocument::FindFlags flags, const QMap<QString, QString> &fileToContentsMap = QMap<QString, QString>()); QTextDocument::FindFlags flags, const QMap<QString, QString> &fileToContentsMap = QMap<QString, QString>());

View File

@@ -395,10 +395,7 @@ bool FileReader::fetch(const QString &fileName, QIODevice::OpenMode mode, QWidge
} }
#endif // QT_GUI_LIB #endif // QT_GUI_LIB
FileSaverBase::FileSaverBase() FileSaverBase::FileSaverBase() = default;
: m_hasError(false)
{
}
FileSaverBase::~FileSaverBase() = default; FileSaverBase::~FileSaverBase() = default;
@@ -526,7 +523,6 @@ bool FileSaver::finalize()
} }
TempFileSaver::TempFileSaver(const QString &templ) TempFileSaver::TempFileSaver(const QString &templ)
: m_autoRemove(true)
{ {
m_file.reset(new QTemporaryFile{}); m_file.reset(new QTemporaryFile{});
auto tempFile = static_cast<QTemporaryFile *>(m_file.get()); auto tempFile = static_cast<QTemporaryFile *>(m_file.get());

View File

@@ -206,7 +206,7 @@ protected:
std::unique_ptr<QFile> m_file; std::unique_ptr<QFile> m_file;
QString m_fileName; QString m_fileName;
QString m_errorString; QString m_errorString;
bool m_hasError; bool m_hasError = false;
private: private:
Q_DISABLE_COPY(FileSaverBase) Q_DISABLE_COPY(FileSaverBase)
@@ -236,7 +236,7 @@ public:
void setAutoRemove(bool on) { m_autoRemove = on; } void setAutoRemove(bool on) { m_autoRemove = on; }
private: private:
bool m_autoRemove; bool m_autoRemove = true;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -58,7 +58,6 @@ namespace Utils {
*/ */
FixedSizeClickLabel::FixedSizeClickLabel(QWidget *parent) FixedSizeClickLabel::FixedSizeClickLabel(QWidget *parent)
: QLabel(parent) : QLabel(parent)
, m_pressed(false)
{ {
} }

View File

@@ -54,7 +54,7 @@ signals:
private: private:
QString m_maxText; QString m_maxText;
bool m_pressed; bool m_pressed = false;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -38,10 +38,7 @@ namespace {
} }
} }
HtmlDocExtractor::HtmlDocExtractor() : HtmlDocExtractor::HtmlDocExtractor() = default;
m_formatContents(true),
m_mode(FirstParagraph)
{}
void HtmlDocExtractor::setMode(Mode mode) void HtmlDocExtractor::setMode(Mode mode)
{ m_mode = mode; } { m_mode = mode; }

View File

@@ -81,8 +81,8 @@ private:
static void replaceTablesForSimpleLines(QString *html); static void replaceTablesForSimpleLines(QString *html);
static void replaceListsForSimpleLines(QString *html); static void replaceListsForSimpleLines(QString *html);
bool m_formatContents; bool m_formatContents = true;
Mode m_mode; Mode m_mode = FirstParagraph;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -38,7 +38,7 @@ QT_FORWARD_DECLARE_CLASS(QString)
namespace Utils { 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 // Returns a recolored icon with shadow and custom disabled state for a
// series of grayscalemask|Theme::Color mask pairs // series of grayscalemask|Theme::Color mask pairs

View File

@@ -51,7 +51,7 @@ public:
inline void *allocate(size_t size) inline void *allocate(size_t size)
{ {
char *obj = new char[size]; auto obj = new char[size];
_objs.append(obj); _objs.append(obj);
return obj; return obj;
} }

View File

@@ -35,9 +35,7 @@ namespace Utils {
struct Link struct Link
{ {
Link(const QString &fileName = QString(), int line = 0, int column = 0) Link(const QString &fileName = QString(), int line = 0, int column = 0)
: linkTextStart(-1) : targetFileName(fileName)
, linkTextEnd(-1)
, targetFileName(fileName)
, targetLine(line) , targetLine(line)
, targetColumn(column) , targetColumn(column)
{} {}
@@ -51,8 +49,8 @@ struct Link
bool operator==(const Link &other) const bool operator==(const Link &other) const
{ return linkTextStart == other.linkTextStart && linkTextEnd == other.linkTextEnd; } { return linkTextStart == other.linkTextStart && linkTextEnd == other.linkTextEnd; }
int linkTextStart; int linkTextStart = 1;
int linkTextEnd; int linkTextEnd = -1;
QString targetFileName; QString targetFileName;
int targetLine; int targetLine;

View File

@@ -38,8 +38,8 @@ namespace Utils {
namespace Internal { class MacroExpanderPrivate; } namespace Internal { class MacroExpanderPrivate; }
class MacroExpander; class MacroExpander;
typedef std::function<MacroExpander *()> MacroExpanderProvider; using MacroExpanderProvider = std::function<MacroExpander *()>;
typedef QVector<MacroExpanderProvider> MacroExpanderProviders; using MacroExpanderProviders = QVector<MacroExpanderProvider>;
class QTCREATOR_UTILS_EXPORT MacroExpander class QTCREATOR_UTILS_EXPORT MacroExpander
{ {
@@ -59,10 +59,10 @@ public:
QString expandProcessArgs(const QString &argsWithVariables) const; QString expandProcessArgs(const QString &argsWithVariables) const;
typedef std::function<QString(QString)> PrefixFunction; using PrefixFunction = std::function<QString(QString)>;
typedef std::function<bool(QString, QString *)> ResolverFunction; using ResolverFunction = std::function<bool(QString, QString *)>;
typedef std::function<QString()> StringFunction; using StringFunction = std::function<QString()>;
typedef std::function<int()> IntFunction; using IntFunction = std::function<int()>;
void registerPrefix(const QByteArray &prefix, void registerPrefix(const QByteArray &prefix,
const QString &description, const PrefixFunction &value); const QString &description, const PrefixFunction &value);

View File

@@ -30,7 +30,7 @@
using namespace Utils; using namespace Utils;
OverrideCursor::OverrideCursor(const QCursor &cursor) OverrideCursor::OverrideCursor(const QCursor &cursor)
: m_set(true), m_cursor(cursor) : m_cursor(cursor)
{ {
QApplication::setOverrideCursor(cursor); QApplication::setOverrideCursor(cursor);
} }

View File

@@ -39,7 +39,7 @@ public:
void set(); void set();
void reset(); void reset();
private: private:
bool m_set; bool m_set = true;
QCursor m_cursor; QCursor m_cursor;
}; };

View File

@@ -38,7 +38,7 @@ namespace Utils {
class QTCREATOR_UTILS_EXPORT Port class QTCREATOR_UTILS_EXPORT Port
{ {
public: public:
Port() : m_port(-1) {} Port() = default;
explicit Port(quint16 port) : m_port(port) {} explicit Port(quint16 port) : m_port(port) {}
explicit Port(int port) : explicit Port(int port) :
m_port((port < 0 || port > std::numeric_limits<quint16>::max()) ? -1 : 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); } QString toString() const { return QString::number(m_port); }
private: private:
int m_port; int m_port = -1;
}; };
inline bool operator<(const Port &p1, const Port &p2) { return p1.number() < p2.number(); } inline bool operator<(const Port &p1, const Port &p2) { return p1.number() < p2.number(); }

View File

@@ -28,11 +28,7 @@
using namespace Utils; using namespace Utils;
ProxyAction::ProxyAction(QObject *parent) : ProxyAction::ProxyAction(QObject *parent) :
QAction(parent), QAction(parent)
m_action(nullptr),
m_attributes(nullptr),
m_showShortcut(false),
m_block(false)
{ {
connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence); connect(this, &QAction::changed, this, &ProxyAction::updateToolTipWithKeySequence);
updateState(); updateState();

View File

@@ -68,11 +68,11 @@ private:
void connectAction(); void connectAction();
void update(QAction *action, bool initialize); void update(QAction *action, bool initialize);
QPointer<QAction> m_action; QPointer<QAction> m_action = nullptr;
Attributes m_attributes; Attributes m_attributes = {};
bool m_showShortcut; bool m_showShortcut = false;
QString m_toolTip; QString m_toolTip;
bool m_block; bool m_block = false;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -668,9 +668,7 @@ bool QtcProcess::prepareCommand(const QString &command, const QString &arguments
} }
QtcProcess::QtcProcess(QObject *parent) QtcProcess::QtcProcess(QObject *parent)
: QProcess(parent), : QProcess(parent)
m_haveEnv(false),
m_useCtrlCStub(false)
{ {
static int qProcessExitStatusMeta = qRegisterMetaType<QProcess::ExitStatus>(); static int qProcessExitStatusMeta = qRegisterMetaType<QProcess::ExitStatus>();
static int qProcessProcessErrorMeta = qRegisterMetaType<QProcess::ProcessError>(); static int qProcessProcessErrorMeta = qRegisterMetaType<QProcess::ProcessError>();

View File

@@ -106,7 +106,7 @@ public:
class QTCREATOR_UTILS_EXPORT ArgIterator { class QTCREATOR_UTILS_EXPORT ArgIterator {
public: public:
ArgIterator(QString *str, OsType osType = HostOsInfo::hostOs()) 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. //! Get the next argument. Returns false on encountering end of first command.
bool next(); bool next();
@@ -121,7 +121,8 @@ public:
void appendArg(const QString &str); void appendArg(const QString &str);
private: private:
QString *m_str, m_value; QString *m_str, m_value;
int m_pos, m_prev; int m_pos = 0;
int m_prev = -1;
bool m_simple; bool m_simple;
OsType m_osType; OsType m_osType;
}; };
@@ -143,8 +144,8 @@ private:
QString m_command; QString m_command;
QString m_arguments; QString m_arguments;
Environment m_environment; Environment m_environment;
bool m_haveEnv; bool m_haveEnv = false;
bool m_useCtrlCStub; bool m_useCtrlCStub = false;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -56,7 +56,6 @@ namespace Utils {
SavedAction::SavedAction(QObject *parent) SavedAction::SavedAction(QObject *parent)
: QAction(parent) : QAction(parent)
{ {
m_widget = nullptr;
connect(this, &QAction::triggered, this, &SavedAction::actionTriggered); connect(this, &QAction::triggered, this, &SavedAction::actionTriggered);
} }

View File

@@ -83,14 +83,14 @@ private:
QString m_settingsKey; QString m_settingsKey;
QString m_settingsGroup; QString m_settingsGroup;
QString m_dialogText; QString m_dialogText;
QWidget *m_widget; QWidget *m_widget = nullptr;
}; };
class QTCREATOR_UTILS_EXPORT SavedActionSet class QTCREATOR_UTILS_EXPORT SavedActionSet
{ {
public: public:
SavedActionSet() {} SavedActionSet() = default;
~SavedActionSet() {} ~SavedActionSet() = default;
void insert(SavedAction *action, QWidget *widget); void insert(SavedAction *action, QWidget *widget);
void apply(QSettings *settings); void apply(QSettings *settings);

View File

@@ -39,7 +39,7 @@ namespace Utils {
QFile::Permissions SaveFile::m_umask = nullptr; QFile::Permissions SaveFile::m_umask = nullptr;
SaveFile::SaveFile(const QString &filename) : SaveFile::SaveFile(const QString &filename) :
m_finalFileName(filename), m_finalized(true) m_finalFileName(filename)
{ {
} }

View File

@@ -51,7 +51,7 @@ public:
private: private:
const QString m_finalFileName; const QString m_finalFileName;
std::unique_ptr<QTemporaryFile> m_tempFile; std::unique_ptr<QTemporaryFile> m_tempFile;
bool m_finalized; bool m_finalized = true;
static QFile::Permissions m_umask; static QFile::Permissions m_umask;
}; };

View File

@@ -49,6 +49,6 @@ public:
} }
}; };
typedef ScopedSwap<bool> ScopedBoolSwap; using ScopedBoolSwap = ScopedSwap<bool>;
} // Utils namespace } // Utils namespace

View File

@@ -78,7 +78,7 @@ public:
virtual ~SettingsAccessor() = default; virtual ~SettingsAccessor() = default;
enum ProceedInfo { Continue, DiscardAndContinue }; enum ProceedInfo { Continue, DiscardAndContinue };
typedef QHash<QMessageBox::StandardButton, ProceedInfo> ButtonMap; using ButtonMap = QHash<QMessageBox::StandardButton, ProceedInfo>;
class Issue { class Issue {
public: public:
enum class Type { ERROR, WARNING }; enum class Type { ERROR, WARNING };
@@ -224,7 +224,7 @@ public:
virtual QVariantMap upgrade(const QVariantMap &data) = 0; virtual QVariantMap upgrade(const QVariantMap &data) = 0;
protected: protected:
typedef QPair<QLatin1String,QLatin1String> Change; using Change = QPair<QLatin1String,QLatin1String>;
QVariantMap renameKeys(const QList<Change> &changes, QVariantMap map) const; QVariantMap renameKeys(const QList<Change> &changes, QVariantMap map) const;
private: private:

View File

@@ -46,8 +46,8 @@ class QTCREATOR_UTILS_EXPORT SettingsSelector : public QWidget
Q_OBJECT Q_OBJECT
public: public:
explicit SettingsSelector(QWidget *parent = 0); explicit SettingsSelector(QWidget *parent = nullptr);
~SettingsSelector(); ~SettingsSelector() override;
void setConfigurationModel(QAbstractItemModel *model); void setConfigurationModel(QAbstractItemModel *model);
QAbstractItemModel *configurationModel() const; QAbstractItemModel *configurationModel() const;

View File

@@ -503,7 +503,6 @@ void ShellCommand::setOutputProxyFactory(const std::function<OutputProxy *()> &f
} }
ProgressParser::ProgressParser() : ProgressParser::ProgressParser() :
m_future(nullptr),
m_futureMutex(new QMutex) m_futureMutex(new QMutex)
{ } { }

View File

@@ -63,7 +63,7 @@ private:
void setFuture(QFutureInterface<void> *future); void setFuture(QFutureInterface<void> *future);
QFutureInterface<void> *m_future; QFutureInterface<void> *m_future;
QMutex *m_futureMutex; QMutex *m_futureMutex = nullptr;
friend class ShellCommand; friend class ShellCommand;
}; };

View File

@@ -35,7 +35,7 @@
namespace Utils { 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 // A manual size let's us shrink below minimum text width which is what
// we want in [fake] status bars. // we want in [fake] status bars.

View File

@@ -47,7 +47,7 @@ private:
void slotTimeout(); void slotTimeout();
void stopTimer(); void stopTimer();
QTimer *m_timer; QTimer *m_timer = nullptr;
QString m_lastPermanentStatusMessage; QString m_lastPermanentStatusMessage;
}; };

View File

@@ -84,7 +84,7 @@ namespace Utils {
// A special QProcess derivative allowing for terminal control. // A special QProcess derivative allowing for terminal control.
class TerminalControllingProcess : public QProcess { class TerminalControllingProcess : public QProcess {
public: public:
TerminalControllingProcess() : m_flags(0) {} TerminalControllingProcess() = default;
unsigned flags() const { return m_flags; } unsigned flags() const { return m_flags; }
void setFlags(unsigned tc) { m_flags = tc; } void setFlags(unsigned tc) { m_flags = tc; }
@@ -93,7 +93,7 @@ protected:
void setupChildProcess() override; void setupChildProcess() override;
private: private:
unsigned m_flags; unsigned m_flags = 0;
}; };
void TerminalControllingProcess::setupChildProcess() void TerminalControllingProcess::setupChildProcess()

View File

@@ -68,10 +68,7 @@ QDebug operator<<(QDebug d, const TextFileFormat &format)
as strings or string lists and to write out files. as strings or string lists and to write out files.
*/ */
TextFileFormat::TextFileFormat() : TextFileFormat::TextFileFormat() = default;
lineTerminationMode(NativeLineTerminator), hasUtf8Bom(false), codec(nullptr)
{
}
/*! /*!
Detects the format of text data. Detects the format of text data.

View File

@@ -78,9 +78,9 @@ public:
static QByteArray decodingErrorSample(const QByteArray &data); static QByteArray decodingErrorSample(const QByteArray &data);
LineTerminationMode lineTerminationMode; LineTerminationMode lineTerminationMode = NativeLineTerminator;
bool hasUtf8Bom; bool hasUtf8Bom = false;
const QTextCodec *codec; const QTextCodec *codec = nullptr;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -605,10 +605,7 @@ namespace Utils {
// //
// TreeItem // TreeItem
// //
TreeItem::TreeItem() TreeItem::TreeItem() = default;
: m_parent(nullptr), m_model(nullptr)
{
}
TreeItem::~TreeItem() TreeItem::~TreeItem()
{ {

View File

@@ -99,8 +99,8 @@ private:
void removeItemAt(int pos); void removeItemAt(int pos);
void propagateModel(BaseTreeModel *m); void propagateModel(BaseTreeModel *m);
TreeItem *m_parent; // Not owned. TreeItem *m_parent = nullptr; // Not owned.
BaseTreeModel *m_model; // Not owned. BaseTreeModel *m_model = nullptr; // Not owned.
QVector<TreeItem *> m_children; // Owned. QVector<TreeItem *> m_children; // Owned.
friend class BaseTreeModel; friend class BaseTreeModel;
}; };

View File

@@ -44,7 +44,7 @@ void TreeViewComboBoxView::adjustWidth(int width)
TreeViewComboBox::TreeViewComboBox(QWidget *parent) TreeViewComboBox::TreeViewComboBox(QWidget *parent)
: QComboBox(parent), m_skipNextHide(false) : QComboBox(parent)
{ {
m_view = new TreeViewComboBoxView; m_view = new TreeViewComboBoxView;
m_view->setHeaderHidden(true); m_view->setHeaderHidden(true);

View File

@@ -61,6 +61,6 @@ private:
QModelIndex lastIndex(const QModelIndex &index); QModelIndex lastIndex(const QModelIndex &index);
TreeViewComboBoxView *m_view; TreeViewComboBoxView *m_view;
bool m_skipNextHide; bool m_skipNextHide = false;
}; };
} }

View File

@@ -32,14 +32,11 @@ using namespace Utils;
CommentDefinition CommentDefinition::CppStyle = CommentDefinition("//", "/*", "*/"); CommentDefinition CommentDefinition::CppStyle = CommentDefinition("//", "/*", "*/");
CommentDefinition CommentDefinition::HashStyle = CommentDefinition("#"); CommentDefinition CommentDefinition::HashStyle = CommentDefinition("#");
CommentDefinition::CommentDefinition() : CommentDefinition::CommentDefinition() = default;
isAfterWhiteSpaces(false)
{}
CommentDefinition::CommentDefinition(const QString &single, const QString &multiStart, CommentDefinition::CommentDefinition(const QString &single, const QString &multiStart,
const QString &multiEnd) const QString &multiEnd)
: isAfterWhiteSpaces(false), : singleLine(single),
singleLine(single),
multiLineStart(multiStart), multiLineStart(multiStart),
multiLineEnd(multiEnd) multiLineEnd(multiEnd)
{ {

View File

@@ -50,7 +50,7 @@ public:
bool hasMultiLineStyle() const; bool hasMultiLineStyle() const;
public: public:
bool isAfterWhiteSpaces; bool isAfterWhiteSpaces = false;
QString singleLine; QString singleLine;
QString multiLineStart; QString multiLineStart;
QString multiLineEnd; QString multiLineEnd;

View File

@@ -565,12 +565,7 @@ class WizardProgressPrivate
Q_DECLARE_PUBLIC(WizardProgress) Q_DECLARE_PUBLIC(WizardProgress)
public: public:
WizardProgressPrivate() WizardProgressPrivate() = default;
:
m_currentItem(nullptr),
m_startItem(nullptr)
{
}
bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const; bool isNextItem(WizardProgressItem *item, WizardProgressItem *nextItem) const;
// if multiple paths are possible the empty list is returned // if multiple paths are possible the empty list is returned
@@ -585,8 +580,8 @@ public:
QList<WizardProgressItem *> m_visitedItems; QList<WizardProgressItem *> m_visitedItems;
QList<WizardProgressItem *> m_reachableItems; QList<WizardProgressItem *> m_reachableItems;
WizardProgressItem *m_currentItem; WizardProgressItem *m_currentItem = nullptr;
WizardProgressItem *m_startItem; WizardProgressItem *m_startItem = nullptr;
}; };
class WizardProgressItemPrivate class WizardProgressItemPrivate