diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2018-11-04 20:33:51 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2018-11-08 11:45:35 +0000 |
commit | c7c042498b27c01f385bddf0718d09e13a215b07 (patch) | |
tree | dc63b697ee9cbef521a2c9e5488d4639d3cb71b1 /src/plugins/bineditor | |
parent | b332fc318241a7f25a4e6bbc328d047b19e54a14 (diff) | |
download | qt-creator-c7c042498b27c01f385bddf0718d09e13a215b07.tar.gz |
BinEditor: Modernize
modernize-use-nullptr
modernize-use-override
modernize-use-equals-default
modernize-use-using
Change-Id: I1d1381962b3ffd87cbf761f50d8f073068f9a06f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/bineditor')
-rw-r--r-- | src/plugins/bineditor/bineditorplugin.cpp | 12 | ||||
-rw-r--r-- | src/plugins/bineditor/bineditorplugin.h | 4 | ||||
-rw-r--r-- | src/plugins/bineditor/bineditorservice.h | 4 | ||||
-rw-r--r-- | src/plugins/bineditor/bineditorwidget.h | 38 |
4 files changed, 29 insertions, 29 deletions
diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 58a317d761..7ca01958d0 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -148,7 +148,7 @@ public: } else { result = NotFound; m_contPos = -1; - m_widget->highlightSearchResults(QByteArray(), 0); + m_widget->highlightSearchResults(QByteArray(), nullptr); } } return result; @@ -313,7 +313,7 @@ public: void provideNewRange(quint64 offset) { if (filePath().exists()) - openImpl(0, filePath().toString(), offset); + openImpl(nullptr, filePath().toString(), offset); } public: @@ -404,13 +404,13 @@ private: } void jumpToAddress() { - editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); + editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(nullptr, 16)); updateCursorPosition(editorWidget()->cursorPosition()); } BinEditorWidget *editorWidget() const { - QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return 0); + QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return nullptr); return static_cast<BinEditorWidget *>(m_widget.data()); } @@ -426,7 +426,7 @@ class BinEditorPluginPrivate : public QObject { public: BinEditorPluginPrivate(); - ~BinEditorPluginPrivate(); + ~BinEditorPluginPrivate() override; QAction *m_undoAction = nullptr; QAction *m_redoAction = nullptr; @@ -511,7 +511,7 @@ EditorService *FactoryServiceImpl::createEditorService(const QString &title0, bo IEditor *editor = EditorManager::openEditorWithContents( Core::Constants::K_DEFAULT_BINARY_EDITOR_ID, &title); if (!editor) - return 0; + return nullptr; widget = qobject_cast<BinEditorWidget *>(editor->widget()); widget->setEditor(editor); } else { diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h index 8c893a4637..8db7761c2c 100644 --- a/src/plugins/bineditor/bineditorplugin.h +++ b/src/plugins/bineditor/bineditorplugin.h @@ -39,8 +39,8 @@ class BinEditorPlugin : public ExtensionSystem::IPlugin Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "BinEditor.json") public: - BinEditorPlugin() {} - ~BinEditorPlugin(); + BinEditorPlugin() = default; + ~BinEditorPlugin() override; bool initialize(const QStringList &arguments, QString *errorMessage) final; void extensionsInitialized() final {} diff --git a/src/plugins/bineditor/bineditorservice.h b/src/plugins/bineditor/bineditorservice.h index 5a68907e03..19480816d2 100644 --- a/src/plugins/bineditor/bineditorservice.h +++ b/src/plugins/bineditor/bineditorservice.h @@ -40,7 +40,7 @@ namespace BinEditor { class EditorService { public: - virtual ~EditorService() {} + virtual ~EditorService() = default; virtual QWidget *widget() = 0; virtual Core::IEditor *editor() = 0; @@ -70,7 +70,7 @@ public: class FactoryService { public: - virtual ~FactoryService() {} + virtual ~FactoryService() = default; // Create a BinEditor widget. Embed into a Core::IEditor iff wantsEditor == true. virtual EditorService *createEditorService(const QString &title, bool wantsEditor) = 0; diff --git a/src/plugins/bineditor/bineditorwidget.h b/src/plugins/bineditor/bineditorwidget.h index ce02c93793..c44dbb4c8c 100644 --- a/src/plugins/bineditor/bineditorwidget.h +++ b/src/plugins/bineditor/bineditorwidget.h @@ -62,8 +62,8 @@ class BinEditorWidget : public QAbstractScrollArea Q_PROPERTY(bool newWindowRequestAllowed READ newWindowRequestAllowed WRITE setNewWindowRequestAllowed DESIGNABLE false) public: - BinEditorWidget(QWidget *parent = 0); - ~BinEditorWidget(); + BinEditorWidget(QWidget *parent = nullptr); + ~BinEditorWidget() override; EditorService *editorService() const; @@ -98,7 +98,7 @@ public: bool isReadOnly() const; int find(const QByteArray &pattern, qint64 from = 0, - QTextDocument::FindFlags findFlags = 0); + QTextDocument::FindFlags findFlags = nullptr); void selectAll(); void clear(); @@ -112,7 +112,7 @@ public: int selectionStart() const { return qMin(m_anchorPosition, m_cursorPosition); } int selectionEnd() const { return qMax(m_anchorPosition, m_cursorPosition); } - bool event(QEvent*); + bool event(QEvent*) override; bool isUndoAvailable() const { return m_undoStack.size(); } bool isRedoAvailable() const { return m_redoStack.size(); } @@ -125,7 +125,7 @@ public: void setFontSettings(const TextEditor::FontSettings &fs); void highlightSearchResults(const QByteArray &pattern, - QTextDocument::FindFlags findFlags = 0); + QTextDocument::FindFlags findFlags = nullptr); void copy(bool raw = false); void setMarkup(const QList<Markup> &markup); void setNewWindowRequestAllowed(bool c); @@ -137,24 +137,24 @@ signals: void cursorPositionChanged(int position); private: - void scrollContentsBy(int dx, int dy); - void paintEvent(QPaintEvent *e); - void resizeEvent(QResizeEvent *); - void changeEvent(QEvent *); - void wheelEvent(QWheelEvent *e); - void mousePressEvent(QMouseEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *e); - void keyPressEvent(QKeyEvent *e); - void focusInEvent(QFocusEvent *); - void focusOutEvent(QFocusEvent *); - void timerEvent(QTimerEvent *); - void contextMenuEvent(QContextMenuEvent *event); + void scrollContentsBy(int dx, int dy) override; + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *) override; + void changeEvent(QEvent *) override; + void wheelEvent(QWheelEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void mouseMoveEvent(QMouseEvent *e) override; + void mouseReleaseEvent(QMouseEvent *e) override; + void keyPressEvent(QKeyEvent *e) override; + void focusInEvent(QFocusEvent *) override; + void focusOutEvent(QFocusEvent *) override; + void timerEvent(QTimerEvent *) override; + void contextMenuEvent(QContextMenuEvent *event) override; friend class BinEditorWidgetPrivate; BinEditorWidgetPrivate *d; - typedef QMap<qint64, QByteArray> BlockMap; + using BlockMap = QMap<qint64, QByteArray>; BlockMap m_data; BlockMap m_oldData; int m_blockSize; |