mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Store the QStrings by value instead of by pointer
This commit is contained in:
parent
f41a541249
commit
8411d71741
14
word.cpp
14
word.cpp
|
@ -3,26 +3,22 @@
|
||||||
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->image = image;
|
||||||
this->text = NULL;
|
|
||||||
m_isImage = true;
|
m_isImage = true;
|
||||||
m_type = type;
|
m_type = type;
|
||||||
m_copyText = new QString(copytext);
|
m_copyText = copytext;
|
||||||
m_tooltip = new QString(tooltip);
|
m_tooltip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
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->image = NULL;
|
||||||
this->text = new QString(text);
|
this->text = text;
|
||||||
m_isImage = false;
|
m_isImage = false;
|
||||||
m_type = type;
|
m_type = type;
|
||||||
m_copyText = new QString(copytext);
|
m_copyText = copytext;
|
||||||
m_tooltip = new QString(tooltip);
|
m_tooltip = tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
Word::~Word()
|
Word::~Word()
|
||||||
{
|
{
|
||||||
delete text;
|
|
||||||
delete m_copyText;
|
|
||||||
delete m_tooltip;
|
|
||||||
}
|
}
|
||||||
|
|
12
word.h
12
word.h
|
@ -50,7 +50,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
QString& getText() {
|
QString& getText() {
|
||||||
return *text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width() {
|
int width() {
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
QString& copyText() {
|
QString& copyText() {
|
||||||
return *m_copyText;
|
return m_copyText;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasTrailingSpace() {
|
bool hasTrailingSpace() {
|
||||||
|
@ -94,17 +94,17 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
QString& tooltip() {
|
QString& tooltip() {
|
||||||
return *m_tooltip;
|
return m_tooltip;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LazyLoadedImage* image;
|
LazyLoadedImage* image;
|
||||||
QString* text;
|
QString text;
|
||||||
bool m_isImage;
|
bool m_isImage;
|
||||||
|
|
||||||
Type m_type;
|
Type m_type;
|
||||||
QString* m_copyText;
|
QString m_copyText;
|
||||||
QString* m_tooltip;
|
QString m_tooltip;
|
||||||
int m_x;
|
int m_x;
|
||||||
int m_y;
|
int m_y;
|
||||||
int m_width;
|
int m_width;
|
||||||
|
|
Loading…
Reference in a new issue