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

View File

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