View Issue Details

IDProjectCategoryView StatusLast Update
0037894Lazarus CCRWidgetsetpublic2021-01-24 09:54
ReporterDavid Assigned To 
Status newResolutionopen 
PlatformLinuxOSU18.04 (Qt5.9) 
Summary0037894: RichMemo method GetStyleRange fails on Qt5
DescriptionUnder Qt5 the GetStyleRange method determines that every single char is a style 'block'.

In qt5richmemo.pas, 0000260 class function TQtWSCustomRichMemo.GetStyleRange() appears to be missing a line, one that populates the rng array. The code uses an undocumented function QTextBlock_textFormatsCount(), implemented as cpp code in libQt5Pas and right next to that function is QTextBlock_textFormatsRanges() that looks like its associated and does in fact populate an array with appropriate data.

So, still guessing, I added a line using that latter function and GetStyleRange now works as expected.

Patch enclosed.
TagsNo tags attached.
Attached Files



2020-10-09 06:18


RM_Qt5_GetStyleRange.patch (514 bytes)   
--- qt5/qt5richmemo.pas	2020-10-09 14:30:38.748966866 +1100
+++ new/qt5richmemo.pas	2020-10-09 14:57:43.447733669 +1100
@@ -296,6 +296,8 @@
     cnt := QTextBlock_textFormatsCount(qblck);
     SetLength(rng, cnt);
     if cnt>0 then begin
+      // populate rng with start and length data, implemented in libQt5Pas
+      QTextBlock_textFormatsRanges(qblck, PTextRangeArray(rng), cnt); // DRB
       blckofs := QTextBlock_position(qblck);
       textStart := textStart - blckofs;
       for i:=0 to cnt-1 do begin
RM_Qt5_GetStyleRange.patch (514 bytes)   

Issue History

Date Modified Username Field Change
2020-10-09 06:18 David New Issue
2020-10-09 06:18 David File Added: RM_Qt5_GetStyleRange.patch