diff --git a/addons/backtracebrowser/btparser.h b/addons/backtracebrowser/btparser.h --- a/addons/backtracebrowser/btparser.h +++ b/addons/backtracebrowser/btparser.h @@ -35,21 +35,17 @@ /** * Default constructor => invalid element */ - BtInfo() - : step(-1) - , line(-1) - , type(Invalid) { - } + BtInfo() = default; public: QString original; QString filename; QString function; QString address; - int step; - int line; + int step = -1; + int line = -1; - Type type; + Type type = Invalid; }; namespace KateBtParser diff --git a/addons/filebrowser/katefilebrowserconfig.h b/addons/filebrowser/katefilebrowserconfig.h --- a/addons/filebrowser/katefilebrowserconfig.h +++ b/addons/filebrowser/katefilebrowserconfig.h @@ -55,7 +55,7 @@ KateFileBrowser *fileBrowser; KActionSelector *acSel; - bool m_changed; + bool m_changed = false; }; #endif //KATE_FILEBROWSER_CONFIG_H diff --git a/addons/filebrowser/katefilebrowserconfig.cpp b/addons/filebrowser/katefilebrowserconfig.cpp --- a/addons/filebrowser/katefilebrowserconfig.cpp +++ b/addons/filebrowser/katefilebrowserconfig.cpp @@ -67,8 +67,7 @@ //BEGIN KateFileBrowserConfigPage KateFileBrowserConfigPage::KateFileBrowserConfigPage( QWidget *parent, KateFileBrowser *kfb ) : KTextEditor::ConfigPage( parent ), - fileBrowser( kfb ), - m_changed( false ) + fileBrowser( kfb ) { QVBoxLayout *lo = new QVBoxLayout( this ); int spacing = QApplication::style()->pixelMetric(QStyle::PM_DefaultLayoutSpacing); diff --git a/addons/filetree/autotests/filetree_model_test.cpp b/addons/filetree/autotests/filetree_model_test.cpp --- a/addons/filetree/autotests/filetree_model_test.cpp +++ b/addons/filetree/autotests/filetree_model_test.cpp @@ -29,7 +29,7 @@ class ResultNode { public: - ResultNode() : name(), dir(true), children() {} // root node + ResultNode() = default; // root node ResultNode(const ResultNode &other) : name(other.name), dir(other.dir), children(other.children) {} ResultNode(const char *_name, const bool _dir = false) : ResultNode(QString::fromLatin1(_name), _dir) {} ResultNode(const QString &_name, const bool _dir = false) : name(_name), dir(_dir), children() {} @@ -83,7 +83,7 @@ } QString name; - bool dir; + bool dir = true; QList children; }; diff --git a/addons/filetree/katefiletreeconfigpage.h b/addons/filetree/katefiletreeconfigpage.h --- a/addons/filetree/katefiletreeconfigpage.h +++ b/addons/filetree/katefiletreeconfigpage.h @@ -59,7 +59,7 @@ class QCheckBox *cbShowFullPath; KateFileTreePlugin *m_plug; - bool m_changed; + bool m_changed = false; }; #endif /* KATE_FILETREE_CONFIGPAGE_H */ diff --git a/addons/filetree/katefiletreeconfigpage.cpp b/addons/filetree/katefiletreeconfigpage.cpp --- a/addons/filetree/katefiletreeconfigpage.cpp +++ b/addons/filetree/katefiletreeconfigpage.cpp @@ -50,8 +50,7 @@ KateFileTreeConfigPage::KateFileTreeConfigPage(QWidget *parent, KateFileTreePlugin *fl) : KTextEditor::ConfigPage(parent), - m_plug(fl), - m_changed(false) + m_plug(fl) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/addons/filetree/katefiletreemodel.cpp b/addons/filetree/katefiletreemodel.cpp --- a/addons/filetree/katefiletreemodel.cpp +++ b/addons/filetree/katefiletreemodel.cpp @@ -842,10 +842,9 @@ class EditViewCount { public: - EditViewCount(): edit(0), view(0) - {} - int edit; - int view; + EditViewCount() = default; + int edit = 0; + int view = 0; }; void KateFileTreeModel::updateBackgrounds(bool force) diff --git a/addons/gdbplugin/localsview.h b/addons/gdbplugin/localsview.h --- a/addons/gdbplugin/localsview.h +++ b/addons/gdbplugin/localsview.h @@ -47,7 +47,7 @@ private: void createWrappedItem(QTreeWidgetItem *parent, const QString &name, const QString &value); void createWrappedItem(QTreeWidget *parent, const QString &name, const QString &value); - bool m_allAdded; + bool m_allAdded = true; QString m_local; }; diff --git a/addons/gdbplugin/localsview.cpp b/addons/gdbplugin/localsview.cpp --- a/addons/gdbplugin/localsview.cpp +++ b/addons/gdbplugin/localsview.cpp @@ -24,7 +24,7 @@ LocalsView::LocalsView(QWidget *parent) -: QTreeWidget(parent), m_allAdded(true) +: QTreeWidget(parent) { QStringList headers; headers << i18n("Symbol"); diff --git a/addons/kate-ctags/kate_ctags_plugin.h b/addons/kate-ctags/kate_ctags_plugin.h --- a/addons/kate-ctags/kate_ctags_plugin.h +++ b/addons/kate-ctags/kate_ctags_plugin.h @@ -44,11 +44,11 @@ QObject *createView(KTextEditor::MainWindow *mainWindow) override; - int configPages() const override { return 1; }; + int configPages() const override { return 1; } KTextEditor::ConfigPage *configPage (int number = 0, QWidget *parent = nullptr) override; void readConfig(); - KateCTagsView *m_view; + KateCTagsView *m_view = nullptr; }; //******************************************************************/ diff --git a/addons/kate-ctags/kate_ctags_plugin.cpp b/addons/kate-ctags/kate_ctags_plugin.cpp --- a/addons/kate-ctags/kate_ctags_plugin.cpp +++ b/addons/kate-ctags/kate_ctags_plugin.cpp @@ -42,7 +42,7 @@ /******************************************************************/ KateCTagsPlugin::KateCTagsPlugin(QObject* parent, const QList&): -KTextEditor::Plugin (parent), m_view(nullptr) +KTextEditor::Plugin (parent) { // FIXME KF5 //KGlobal::locale()->insertCatalog("kate-ctags-plugin"); diff --git a/addons/katesql/sqlmanager.h b/addons/katesql/sqlmanager.h --- a/addons/katesql/sqlmanager.h +++ b/addons/katesql/sqlmanager.h @@ -65,7 +65,7 @@ private: ConnectionModel *m_model; - KWallet::Wallet *m_wallet; + KWallet::Wallet *m_wallet = nullptr; }; #endif // SQLMANAGER_H diff --git a/addons/katesql/sqlmanager.cpp b/addons/katesql/sqlmanager.cpp --- a/addons/katesql/sqlmanager.cpp +++ b/addons/katesql/sqlmanager.cpp @@ -34,7 +34,6 @@ SQLManager::SQLManager(QObject *parent) : QObject(parent) , m_model(new ConnectionModel(this)) -, m_wallet(nullptr) { } diff --git a/addons/lspclient/lspclientservermanager.cpp b/addons/lspclient/lspclientservermanager.cpp --- a/addons/lspclient/lspclientservermanager.cpp +++ b/addons/lspclient/lspclientservermanager.cpp @@ -170,8 +170,7 @@ RevisionGuard(KTextEditor::Document *doc = nullptr) : m_doc(doc), - m_movingInterface(qobject_cast(doc)), - m_revision(-1) + m_movingInterface(qobject_cast(doc)) { if (m_movingInterface) { m_revision = m_movingInterface->revision(); diff --git a/addons/project/kateprojectcodeanalysistool.h b/addons/project/kateprojectcodeanalysistool.h --- a/addons/project/kateprojectcodeanalysistool.h +++ b/addons/project/kateprojectcodeanalysistool.h @@ -38,7 +38,7 @@ /** * Current project */ - KateProject *m_project; + KateProject *m_project = nullptr; public: virtual ~KateProjectCodeAnalysisTool(); diff --git a/addons/project/kateprojectcodeanalysistool.cpp b/addons/project/kateprojectcodeanalysistool.cpp --- a/addons/project/kateprojectcodeanalysistool.cpp +++ b/addons/project/kateprojectcodeanalysistool.cpp @@ -22,7 +22,6 @@ KateProjectCodeAnalysisTool::KateProjectCodeAnalysisTool(QObject *parent) : QObject(parent) - , m_project(nullptr) { } diff --git a/addons/project/kateprojectconfigpage.h b/addons/project/kateprojectconfigpage.h --- a/addons/project/kateprojectconfigpage.h +++ b/addons/project/kateprojectconfigpage.h @@ -49,7 +49,7 @@ QCheckBox *m_cbAutoSubversion; QCheckBox *m_cbAutoMercurial; KateProjectPlugin *m_plugin; - bool m_changed; + bool m_changed = false; }; #endif /* KATE_PROJECT_CONFIGPAGE_H */ diff --git a/addons/project/kateprojectconfigpage.cpp b/addons/project/kateprojectconfigpage.cpp --- a/addons/project/kateprojectconfigpage.cpp +++ b/addons/project/kateprojectconfigpage.cpp @@ -28,7 +28,6 @@ KateProjectConfigPage::KateProjectConfigPage(QWidget *parent, KateProjectPlugin *plugin) : KTextEditor::ConfigPage(parent) , m_plugin(plugin) - , m_changed(false) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/addons/rustcompletion/kterustcompletion.h b/addons/rustcompletion/kterustcompletion.h --- a/addons/rustcompletion/kterustcompletion.h +++ b/addons/rustcompletion/kterustcompletion.h @@ -34,14 +34,14 @@ } struct CompletionMatch { - CompletionMatch() : type(KTextEditor::CodeCompletionModel::NoProperty), depth(0), line(-1), col(-1) {} + CompletionMatch() = default; QString text; QIcon icon; - KTextEditor::CodeCompletionModel::CompletionProperty type; - int depth; + KTextEditor::CodeCompletionModel::CompletionProperty type = KTextEditor::CodeCompletionModel::NoProperty; + int depth = 0; QUrl url; - int line; - int col; + int line = -1; + int col = -1; }; class KTERustCompletion : public KTextEditor::CodeCompletionModel, public KTextEditor::CodeCompletionModelControllerInterface diff --git a/addons/rustcompletion/kterustcompletionconfigpage.h b/addons/rustcompletion/kterustcompletionconfigpage.h --- a/addons/rustcompletion/kterustcompletionconfigpage.h +++ b/addons/rustcompletion/kterustcompletionconfigpage.h @@ -52,7 +52,7 @@ QLineEdit *m_racerCmd; KUrlRequester *m_rustSrcPath; - bool m_changed; + bool m_changed = false; KTERustCompletionPlugin *m_plugin; }; diff --git a/addons/rustcompletion/kterustcompletionconfigpage.cpp b/addons/rustcompletion/kterustcompletionconfigpage.cpp --- a/addons/rustcompletion/kterustcompletionconfigpage.cpp +++ b/addons/rustcompletion/kterustcompletionconfigpage.cpp @@ -29,7 +29,6 @@ KTERustCompletionConfigPage::KTERustCompletionConfigPage(QWidget *parent, KTERustCompletionPlugin *plugin) : KTextEditor::ConfigPage(parent) - , m_changed(false) , m_plugin(plugin) { QVBoxLayout *layout = new QVBoxLayout(this); diff --git a/addons/rustcompletion/kterustcompletionplugin.h b/addons/rustcompletion/kterustcompletionplugin.h --- a/addons/rustcompletion/kterustcompletionplugin.h +++ b/addons/rustcompletion/kterustcompletionplugin.h @@ -63,9 +63,9 @@ QString m_racerCmd; QUrl m_rustSrcPath; - KDirWatch *m_rustSrcWatch; + KDirWatch *m_rustSrcWatch{nullptr}; - bool m_configOk; + bool m_configOk{false}; }; #endif diff --git a/addons/rustcompletion/kterustcompletionplugin.cpp b/addons/rustcompletion/kterustcompletionplugin.cpp --- a/addons/rustcompletion/kterustcompletionplugin.cpp +++ b/addons/rustcompletion/kterustcompletionplugin.cpp @@ -32,9 +32,7 @@ KTERustCompletionPlugin::KTERustCompletionPlugin(QObject *parent, const QList &) : KTextEditor::Plugin(parent), - m_completion(this), - m_rustSrcWatch(nullptr), - m_configOk(false) + m_completion(this) { readConfig(); } diff --git a/addons/search/SearchDiskFiles.h b/addons/search/SearchDiskFiles.h --- a/addons/search/SearchDiskFiles.h +++ b/addons/search/SearchDiskFiles.h @@ -60,8 +60,8 @@ private: QRegularExpression m_regExp; QStringList m_files; - bool m_cancelSearch; - int m_matchCount; + bool m_cancelSearch = true; + int m_matchCount = 0; QTime m_statusTime; }; diff --git a/addons/search/SearchDiskFiles.cpp b/addons/search/SearchDiskFiles.cpp --- a/addons/search/SearchDiskFiles.cpp +++ b/addons/search/SearchDiskFiles.cpp @@ -26,8 +26,6 @@ SearchDiskFiles::SearchDiskFiles(QObject *parent) : QThread(parent) -,m_cancelSearch(true) -,m_matchCount(0) {} SearchDiskFiles::~SearchDiskFiles() diff --git a/addons/search/plugin_search.h b/addons/search/plugin_search.h --- a/addons/search/plugin_search.h +++ b/addons/search/plugin_search.h @@ -52,12 +52,12 @@ Q_OBJECT public: Results(QWidget *parent = nullptr); - int matches; + int matches = 0; QRegularExpression regExp; - bool useRegExp; + bool useRegExp = false; bool matchCase; QString replaceStr; - int searchPlaceIndex; + int searchPlaceIndex = 0; QString treeRootText; }; @@ -87,7 +87,7 @@ QObject *createView(KTextEditor::MainWindow *mainWindow) override; private: - KateSearchCommand* m_searchCommand; + KateSearchCommand* m_searchCommand = nullptr; }; diff --git a/addons/search/plugin_search.cpp b/addons/search/plugin_search.cpp --- a/addons/search/plugin_search.cpp +++ b/addons/search/plugin_search.cpp @@ -110,7 +110,7 @@ } }; -Results::Results(QWidget *parent): QWidget(parent), matches(0), useRegExp(false), searchPlaceIndex(0) +Results::Results(QWidget *parent): QWidget(parent) { setupUi(this); @@ -121,8 +121,7 @@ K_PLUGIN_FACTORY_WITH_JSON (KatePluginSearchFactory, "katesearch.json", registerPlugin();) KatePluginSearch::KatePluginSearch(QObject* parent, const QList&) - : KTextEditor::Plugin (parent), - m_searchCommand(nullptr) + : KTextEditor::Plugin (parent) { m_searchCommand = new KateSearchCommand(this); } diff --git a/addons/search/search_open_files.h b/addons/search/search_open_files.h --- a/addons/search/search_open_files.h +++ b/addons/search/search_open_files.h @@ -58,9 +58,9 @@ private: QList m_docList; - int m_nextIndex; + int m_nextIndex = -1; QRegularExpression m_regExp; - bool m_cancelSearch; + bool m_cancelSearch = true; QString m_fullDoc; QVector m_lineStart; QTime m_statusTime; diff --git a/addons/search/search_open_files.cpp b/addons/search/search_open_files.cpp --- a/addons/search/search_open_files.cpp +++ b/addons/search/search_open_files.cpp @@ -22,7 +22,7 @@ #include -SearchOpenFiles::SearchOpenFiles(QObject *parent) : QObject(parent), m_nextIndex(-1), m_cancelSearch(true) +SearchOpenFiles::SearchOpenFiles(QObject *parent) : QObject(parent) { connect(this, &SearchOpenFiles::searchNextFile, this, &SearchOpenFiles::doSearchNextFile, Qt::QueuedConnection); } diff --git a/addons/snippets/snippet.h b/addons/snippets/snippet.h --- a/addons/snippets/snippet.h +++ b/addons/snippets/snippet.h @@ -69,7 +69,7 @@ /// the actual snippet contents aka \code\endcode QString m_snippet; /// the insertion action for this snippet. - QAction* m_action; + QAction* m_action = nullptr; }; Q_DECLARE_METATYPE ( Snippet* ) diff --git a/addons/snippets/snippet.cpp b/addons/snippets/snippet.cpp --- a/addons/snippets/snippet.cpp +++ b/addons/snippets/snippet.cpp @@ -34,7 +34,7 @@ #include Snippet::Snippet() - : QStandardItem(i18n("")), m_action(nullptr) + : QStandardItem(i18n("")) { setIcon(QIcon::fromTheme(QStringLiteral("text-plain"))); } diff --git a/addons/textfilter/plugin_katetextfilter.h b/addons/textfilter/plugin_katetextfilter.h --- a/addons/textfilter/plugin_katetextfilter.h +++ b/addons/textfilter/plugin_katetextfilter.h @@ -48,10 +48,10 @@ QString m_strFilterOutput; QString m_stderrOutput; QString m_last_command; - KProcess * m_pFilterProcess; + KProcess * m_pFilterProcess = nullptr; QStringList completionList; - bool copyResult; - bool mergeOutput; + bool copyResult = false; + bool mergeOutput = false; public Q_SLOTS: void slotEditFilter (); void slotFilterReceivedStdout(); diff --git a/addons/textfilter/plugin_katetextfilter.cpp b/addons/textfilter/plugin_katetextfilter.cpp --- a/addons/textfilter/plugin_katetextfilter.cpp +++ b/addons/textfilter/plugin_katetextfilter.cpp @@ -44,9 +44,6 @@ PluginKateTextFilter::PluginKateTextFilter(QObject *parent, const QList &): KTextEditor::Plugin(parent) - , m_pFilterProcess(Q_NULLPTR) - , copyResult(false) - , mergeOutput(false) { // register command new PluginKateTextFilterCommand(this); diff --git a/kate/katedocmanager.h b/kate/katedocmanager.h --- a/kate/katedocmanager.h +++ b/kate/katedocmanager.h @@ -42,18 +42,13 @@ enum CustomRoles {RestoreOpeningFailedRole }; public: - KateDocumentInfo() - : modifiedOnDisc(false) - , modifiedOnDiscReason(KTextEditor::ModificationInterface::OnDiskUnmodified) - , openedByUser(false) - , openSuccess(true) - {} - - bool modifiedOnDisc; - KTextEditor::ModificationInterface::ModifiedOnDiskReason modifiedOnDiscReason; - - bool openedByUser; - bool openSuccess; + KateDocumentInfo() = default; + + bool modifiedOnDisc = false; + KTextEditor::ModificationInterface::ModifiedOnDiskReason modifiedOnDiscReason = KTextEditor::ModificationInterface::OnDiskUnmodified; + + bool openedByUser = false; + bool openSuccess = true; }; class KateDocManager : public QObject diff --git a/kate/katemainwindow.h b/kate/katemainwindow.h --- a/kate/katemainwindow.h +++ b/kate/katemainwindow.h @@ -554,7 +554,7 @@ class BarState { public: - BarState(): m_bar(nullptr), m_state(false) {} + BarState() = default; BarState(QWidget *bar): m_bar(bar), m_state(false) {} ~BarState() {} QWidget *bar() { @@ -567,8 +567,8 @@ m_state = state; } private: - QWidget *m_bar; - bool m_state; + QWidget *m_bar = nullptr; + bool m_state = false; }; QHash m_bottomViewBarMapping; diff --git a/kate/katemdi.h b/kate/katemdi.h --- a/kate/katemdi.h +++ b/kate/katemdi.h @@ -432,13 +432,13 @@ /** * sidebars state. */ - bool m_sidebarsVisible; + bool m_sidebarsVisible = true; /** * config object for session restore, only valid between * start and finish restore calls */ - KConfigBase *m_restoreConfig; + KConfigBase *m_restoreConfig = nullptr; /** * restore group diff --git a/kate/katemdi.cpp b/kate/katemdi.cpp --- a/kate/katemdi.cpp +++ b/kate/katemdi.cpp @@ -716,8 +716,6 @@ MainWindow::MainWindow(QWidget *parentWidget) : KParts::MainWindow(parentWidget, Qt::Window) - , m_sidebarsVisible(true) - , m_restoreConfig(nullptr) , m_guiClient(new GUIClient(this)) { // init the internal widgets diff --git a/kate/kateviewmanager.h b/kate/kateviewmanager.h --- a/kate/kateviewmanager.h +++ b/kate/kateviewmanager.h @@ -300,28 +300,23 @@ /** * Default constructor */ - ViewData() - : active(false) - , lruAge(0) - , activityResource(Q_NULLPTR) - { - } + ViewData() = default; /** * view active? */ - bool active; + bool active = false; /** * lru age of the view * important: smallest age ==> latest used view */ - qint64 lruAge; + qint64 lruAge = 0; /** * activity resource for the view */ - KActivities::ResourceInstance *activityResource; + KActivities::ResourceInstance *activityResource = nullptr; }; /** diff --git a/kwrite/kwrite.h b/kwrite/kwrite.h --- a/kwrite/kwrite.h +++ b/kwrite/kwrite.h @@ -121,14 +121,14 @@ void saveGlobalProperties(KConfig *) override; private: - KTextEditor::View *m_view; + KTextEditor::View *m_view = nullptr; - KRecentFilesAction *m_recentFiles; - KToggleAction *m_paShowPath; - KToggleAction *m_paShowMenuBar; - KToggleAction *m_paShowStatusBar; + KRecentFilesAction *m_recentFiles = nullptr; + KToggleAction *m_paShowPath = nullptr; + KToggleAction *m_paShowMenuBar = nullptr; + KToggleAction *m_paShowStatusBar = nullptr; QAction *m_closeAction; - KActivities::ResourceInstance *m_activityResource; + KActivities::ResourceInstance *m_activityResource = nullptr; KWriteApplication *m_app; KTextEditor::MainWindow m_mainWindow; diff --git a/kwrite/kwrite.cpp b/kwrite/kwrite.cpp --- a/kwrite/kwrite.cpp +++ b/kwrite/kwrite.cpp @@ -59,13 +59,7 @@ #include KWrite::KWrite(KTextEditor::Document *doc, KWriteApplication *app) - : m_view(nullptr) - , m_recentFiles(nullptr) - , m_paShowPath(nullptr) - , m_paShowMenuBar(nullptr) - , m_paShowStatusBar(nullptr) - , m_activityResource(nullptr) - , m_app(app) + : m_app(app) , m_mainWindow(this) { if (!doc) {