Justifying with tab spaces in the text
-
Hey,
I'm creating a text editor and I am implementing the text alignments. All works fine except when justifying text with some tabs in it, for instance :
"this is a a tab space"
My code is quite simple :
void setJustifyText(bool jusitfy) { QTextBlockFormat format; format.setAlignment(justify ? Qt::AlignmentFlag::AlignJustify : Qt::AlignmentFlag::AlignAbsolute); cursor.mergeBlockFormat(format); }
And the error I get from Microsoft Visual Studio is :
Debug Error!
Program Qt\5.12.5\mscvc2017\bin\Qt5Cored.dll
Module: 5.12.5
File: text\qtextlayout.cpp
Line:1780ASSERT: "(pos == end && glyphPosition == current.num_glyphs) || logClusters[pos] == glyphPosition" in file text\qtextlayout.cpp, line 1780
Thanks for any help! I tried finding something in relation to this problem already on forums, but I didn't really find any proper solution to my problem.
-
Hey,
I'm creating a text editor and I am implementing the text alignments. All works fine except when justifying text with some tabs in it, for instance :
"this is a a tab space"
My code is quite simple :
void setJustifyText(bool jusitfy) { QTextBlockFormat format; format.setAlignment(justify ? Qt::AlignmentFlag::AlignJustify : Qt::AlignmentFlag::AlignAbsolute); cursor.mergeBlockFormat(format); }
And the error I get from Microsoft Visual Studio is :
Debug Error!
Program Qt\5.12.5\mscvc2017\bin\Qt5Cored.dll
Module: 5.12.5
File: text\qtextlayout.cpp
Line:1780ASSERT: "(pos == end && glyphPosition == current.num_glyphs) || logClusters[pos] == glyphPosition" in file text\qtextlayout.cpp, line 1780
Thanks for any help! I tried finding something in relation to this problem already on forums, but I didn't really find any proper solution to my problem.