Commit 5a48a4aa authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix crash due to new text algorithm

When there are two entities with the same key, do not only check for
are but also for text to be matching
parent a5c80e1c
...@@ -225,8 +225,15 @@ public: ...@@ -225,8 +225,15 @@ public:
: m_region_text(list) ,m_area(area) : m_region_text(list) ,m_area(area)
{ {
} }
inline QString string() const
{
QString res;
foreach(TinyTextEntity *te, m_region_text)
res += te->text();
return res;
}
// We assume text will be set only once at the time of object creation
inline TextList text() const inline TextList text() const
{ {
return m_region_text; return m_region_text;
...@@ -1896,13 +1903,12 @@ void TextPagePrivate::breakWordIntoCharacters(const QMap<int, RegionText> &word_ ...@@ -1896,13 +1903,12 @@ void TextPagePrivate::breakWordIntoCharacters(const QMap<int, RegionText> &word_
while( it != word_chars_map.end() && it.key() == key ) while( it != word_chars_map.end() && it.key() == key )
{ {
word_text = it.value(); word_text = it.value();
it++;
list = word_text.text(); list = word_text.text();
const QRect regionRect = word_text.area();
if(word_text.area() == rect && ent->text() == word_text.string())
if(regionRect.left() == rect.left() && regionRect.top() == rect.top())
break; break;
++it;
} }
} }
tmp.append(list); tmp.append(list);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment