Store the QStrings by value instead of by pointer

This commit is contained in:
Rasmus Karlsson
2017-01-05 16:53:13 +01:00
parent f41a541249
commit 8411d71741
2 changed files with 11 additions and 15 deletions
+5 -9
View File
@@ -3,26 +3,22 @@
Word::Word(LazyLoadedImage* image, Type type, const QString& copytext, const QString& tooltip)
{
this->image = image;
this->text = NULL;
m_isImage = true;
m_type = type;
m_copyText = new QString(copytext);
m_tooltip = new QString(tooltip);
m_copyText = copytext;
m_tooltip = tooltip;
}
Word::Word(const QString& text, Type type, const QString& copytext, const QString& tooltip)
{
this->image = NULL;
this->text = new QString(text);
this->text = text;
m_isImage = false;
m_type = type;
m_copyText = new QString(copytext);
m_tooltip = new QString(tooltip);
m_copyText = copytext;
m_tooltip = tooltip;
}
Word::~Word()
{
delete text;
delete m_copyText;
delete m_tooltip;
}