use the m_ prefix on all variables stored in a class

This is a flavour thing btw, but if you do it with some variables you
should do it with all of them. This helps avoid variable name clashes
too that often happens in constructors
This commit is contained in:
Rasmus Karlsson 2017-01-05 16:54:34 +01:00
parent dc26c86268
commit 00ff1e72e2
2 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@
Word::Word(LazyLoadedImage* image, Type type, const QString& copytext, const QString& tooltip) Word::Word(LazyLoadedImage* image, Type type, const QString& copytext, const QString& tooltip)
{ {
this->image = image; this->m_image = image;
m_isImage = true; m_isImage = true;
m_type = type; m_type = type;
m_copyText = copytext; m_copyText = copytext;
@ -11,8 +11,8 @@ Word::Word(LazyLoadedImage* image, Type type, const QString& copytext, const QSt
Word::Word(const QString& text, Type type, const QString& copytext, const QString& tooltip) Word::Word(const QString& text, Type type, const QString& copytext, const QString& tooltip)
{ {
this->image = NULL; this->m_image = NULL;
this->text = text; this->m_text = text;
m_isImage = false; m_isImage = false;
m_type = type; m_type = type;
m_copyText = copytext; m_copyText = copytext;

12
word.h
View file

@ -40,17 +40,17 @@ public:
BadgeBits = 0x400000, BadgeBits = 0x400000,
}; };
explicit Word(LazyLoadedImage* image, Type type, const QString& copytext, const QString& tooltip = ""); explicit Word(LazyLoadedImage* m_image, Type type, const QString& copytext, const QString& tooltip = "");
explicit Word(const QString& text, Type type, const QString& copytext, const QString& tooltip = ""); explicit Word(const QString& m_text, Type type, const QString& copytext, const QString& tooltip = "");
~Word(); ~Word();
LazyLoadedImage& getImage() { LazyLoadedImage& getImage() {
return *image; return *m_image;
} }
const QString& getText() { const QString& getText() {
return text; return m_text;
} }
int width() { int width() {
@ -98,8 +98,8 @@ public:
} }
private: private:
LazyLoadedImage* image; LazyLoadedImage* m_image;
QString text; QString m_text;
bool m_isImage; bool m_isImage;
Type m_type; Type m_type;