From 55722ac5a47d90b21095faaa86d2f0acfc62b480 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 26 Jul 2022 23:57:26 +0300 Subject: [PATCH] BinEditor: Use inline member initialization Change-Id: If70532c94b5a446dbb6595d635f4c03b69a5d65c Reviewed-by: Orgad Shaneh --- src/plugins/bineditor/bineditorwidget.cpp | 15 ------- src/plugins/bineditor/bineditorwidget.h | 52 +++++++++++------------ 2 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index 2b7a021dbd2..018ed54fb38 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -141,22 +141,7 @@ private: BinEditorWidget::BinEditorWidget(QWidget *parent) : QAbstractScrollArea(parent), d(new BinEditorWidgetPrivate(this)) { - m_bytesPerLine = 16; - m_ieditor = nullptr; - m_baseAddr = 0; - m_blockSize = 4096; - m_size = 0; - m_addressBytes = 4; init(); - m_unmodifiedState = 0; - m_readOnly = false; - m_hexCursor = true; - m_cursorPosition = 0; - m_anchorPosition = 0; - m_lowNibble = false; - m_cursorVisible = false; - m_caseSensitiveSearch = false; - m_canRequestNewWindow = false; setFocusPolicy(Qt::WheelFocus); setFrameStyle(QFrame::Plain); diff --git a/src/plugins/bineditor/bineditorwidget.h b/src/plugins/bineditor/bineditorwidget.h index 6a894454421..df92e64e275 100644 --- a/src/plugins/bineditor/bineditorwidget.h +++ b/src/plugins/bineditor/bineditorwidget.h @@ -155,12 +155,12 @@ private: using BlockMap = QMap; BlockMap m_data; BlockMap m_oldData; - int m_blockSize; + int m_blockSize = 4096; BlockMap m_modifiedData; mutable QSet m_requests; QByteArray m_emptyBlock; QByteArray m_lowerBlock; - qint64 m_size; + qint64 m_size = 0; int dataIndexOf(const QByteArray &pattern, qint64 from, bool caseSensitive = true) const; int dataLastIndexOf(const QByteArray &pattern, qint64 from, bool caseSensitive = true) const; @@ -180,32 +180,32 @@ private: void asDouble(qint64 offset, double &value, bool old) const; QString toolTip(const QHelpEvent *helpEvent) const; - int m_bytesPerLine; - int m_unmodifiedState; - int m_readOnly; - int m_margin; - int m_descent; - int m_ascent; - int m_lineHeight; - int m_charWidth; - int m_labelWidth; - int m_textWidth; - int m_columnWidth; - qint64 m_numLines; - qint64 m_numVisibleLines; + int m_bytesPerLine = 16; + int m_unmodifiedState = 0; + int m_readOnly = false; + int m_margin = 0; + int m_descent = 0; + int m_ascent = 0; + int m_lineHeight = 0; + int m_charWidth = 0; + int m_labelWidth = 0; + int m_textWidth = 0; + int m_columnWidth = 0; + qint64 m_numLines = 0; + qint64 m_numVisibleLines = 0; - quint64 m_baseAddr; + quint64 m_baseAddr = 0; - bool m_cursorVisible; - qint64 m_cursorPosition; - qint64 m_anchorPosition; - bool m_hexCursor; - bool m_lowNibble; - bool m_isMonospacedFont; + qint64 m_cursorPosition = 0; + qint64 m_anchorPosition = 0; + bool m_cursorVisible = false; + bool m_hexCursor = true; + bool m_lowNibble = false; + bool m_isMonospacedFont = true; + bool m_caseSensitiveSearch = false; QByteArray m_searchPattern; QByteArray m_searchPatternHex; - bool m_caseSensitiveSearch; QBasicTimer m_cursorBlinkTimer; @@ -236,10 +236,10 @@ private: QStack m_undoStack, m_redoStack; QBasicTimer m_autoScrollTimer; - Core::IEditor *m_ieditor; + Core::IEditor *m_ieditor = nullptr; QString m_addressString; - int m_addressBytes; - bool m_canRequestNewWindow; + int m_addressBytes = 4; + bool m_canRequestNewWindow = false; QList m_markup; };