Fix CppCheck in RsButtonOnText

/retroshare-gui/src/gui/common/RsButtonOnText.cpp:13: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textEdit'
is not initialized in the constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:13: warning:
Cppcheck(uninitMemberVar): Member variable
'RSButtonOnText::_textEditViewPort' is not initialized in the
constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:13: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textCursor'
is not initialized in the constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:21: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textEdit'
is not initialized in the constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:21: warning:
Cppcheck(uninitMemberVar): Member variable
'RSButtonOnText::_textEditViewPort' is not initialized in the
constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:21: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textCursor'
is not initialized in the constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:32: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textEdit'
is not initialized in the constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:32: warning:
Cppcheck(uninitMemberVar): Member variable
'RSButtonOnText::_textEditViewPort' is not initialized in the
constructor.
/retroshare-gui/src/gui/common/RsButtonOnText.cpp:32: warning:
Cppcheck(uninitMemberVar): Member variable 'RSButtonOnText::_textCursor'
is not initialized in the constructor.
This commit is contained in:
Phenom 2017-08-13 19:59:49 +02:00 committed by csoler
parent 214e382a0a
commit ee7e950f5f
2 changed files with 11 additions and 23 deletions

View File

@ -11,67 +11,55 @@
#include <iostream> #include <iostream>
RSButtonOnText::RSButtonOnText(QWidget *parent) RSButtonOnText::RSButtonOnText(QWidget *parent)
: QPushButton(parent) : QPushButton(parent), _textEdit(NULL), _textEditViewPort(NULL), _textCursor(NULL)
, _lenght(-1), _mouseOver(false), _pressed(false)
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1;
_mouseOver = false;
_pressed = false;
} }
RSButtonOnText::RSButtonOnText(const QString &text, QWidget *parent) RSButtonOnText::RSButtonOnText(const QString &text, QWidget *parent)
: QPushButton(parent) : QPushButton(parent), _textEdit(NULL), _textEditViewPort(NULL), _textCursor(NULL)
, _lenght(-1), _mouseOver(false), _pressed(false)
//: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11 //: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1;
_mouseOver = false;
_pressed = false;
setText(text); setText(text);
} }
RSButtonOnText::RSButtonOnText(const QIcon& icon, const QString &text, QWidget *parent) RSButtonOnText::RSButtonOnText(const QIcon& icon, const QString &text, QWidget *parent)
: QPushButton(parent) : QPushButton(parent), _textEdit(NULL), _textEditViewPort(NULL), _textCursor(NULL)
, _lenght(-1), _mouseOver(false), _pressed(false)
//: RSButtonOnText(text, parent)//delegating constructors only available with -std=c++11 or -std=gnu++11 //: RSButtonOnText(text, parent)//delegating constructors only available with -std=c++11 or -std=gnu++11
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1;
_mouseOver = false;
_pressed = false;
setIcon(icon); setIcon(icon);
setText(text); setText(text);
} }
RSButtonOnText::RSButtonOnText(QTextEdit *textEdit, QWidget *parent) RSButtonOnText::RSButtonOnText(QTextEdit *textEdit, QWidget *parent)
: QPushButton(parent) : QPushButton(parent)
, _lenght(-1), _mouseOver(false), _pressed(false)
//: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11 //: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1; appendToText(textEdit);
_mouseOver = false;
_pressed = false;
appendToText(textEdit);
} }
RSButtonOnText::RSButtonOnText(const QString &text, QTextEdit *textEdit, QWidget *parent) RSButtonOnText::RSButtonOnText(const QString &text, QTextEdit *textEdit, QWidget *parent)
: QPushButton(parent) : QPushButton(parent)
, _lenght(-1), _mouseOver(false), _pressed(false)
//: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11 //: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1;
_mouseOver = false;
_pressed = false;
setText(text); setText(text);
appendToText(textEdit); appendToText(textEdit);
} }
RSButtonOnText::RSButtonOnText(const QIcon& icon, const QString &text, QTextEdit *textEdit, QWidget *parent) RSButtonOnText::RSButtonOnText(const QIcon& icon, const QString &text, QTextEdit *textEdit, QWidget *parent)
: QPushButton(parent) : QPushButton(parent)
, _lenght(-1), _mouseOver(false), _pressed(false)
//: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11 //: RSButtonOnText(parent)//delegating constructors only available with -std=c++11 or -std=gnu++11
{ {
_uuid = QUuid::createUuid().toString(); _uuid = QUuid::createUuid().toString();
_lenght = -1;
_mouseOver = false;
_pressed = false;
setIcon(icon); setIcon(icon);
setText(text); setText(text);
appendToText(textEdit); appendToText(textEdit);

View File

@ -35,10 +35,10 @@ private:
bool isEventForThis(QObject *obj, QEvent *event, QPoint &point); bool isEventForThis(QObject *obj, QEvent *event, QPoint &point);
QString _uuid; QString _uuid;
int _lenght;//Because cursor end position move durring editing
QTextEdit* _textEdit; QTextEdit* _textEdit;
QWidget* _textEditViewPort; QWidget* _textEditViewPort;
QTextCursor* _textCursor; QTextCursor* _textCursor;
int _lenght;//Because cursor end position move durring editing
bool _mouseOver; bool _mouseOver;
bool _pressed; bool _pressed;