* * *

Author Topic: Fedora Richmemo and QT5  (Read 1265 times)

OH1KH

  • New member
  • *
  • Posts: 17
Fedora Richmemo and QT5
« on: March 25, 2018, 03:04:47 pm »
Hi !

I found from lazarus-ccr-svn-6262 a richmemo that had QT5 included.
I tried to use it with my program that works ok with gtk2 widgetset. When compiled with QT5 widgetset I have no errors at compile time and no errors at runtime.

It is just so that I do not get any text any more with QT5 widgetset. Sampe code that was along richmemo that had QT5 folder works ok. (richmemo-qt5/samples/testsimple)
It is how ever different from my code that is direct copy from richmemo wiki's one:

"If you need mixed coloring then this is an example that will add a new line with several different colored words (tested on Windows):"
It works with gtk2, but not with QT5 widgetset.

Could someone else confirm this. I'm always suspecting errors in my Laz-setups.
--
Saku

zeljko

  • Hero Member
  • *****
  • Posts: 974
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Fedora Richmemo and QT5
« Reply #1 on: March 25, 2018, 03:49:53 pm »
Does it work with Qt4 widgetset ?

OH1KH

  • New member
  • *
  • Posts: 17
Re: Fedora Richmemo and QT5
« Reply #2 on: March 27, 2018, 08:17:09 am »
I have only QT5 and do not want to downgrade
--
Saku

Thaddy

  • Hero Member
  • *****
  • Posts: 6342
Re: Fedora Richmemo and QT5
« Reply #3 on: March 27, 2018, 10:01:35 am »
QT5 support is fairly recent. (And I don't use it) But if you have a small project that reproduces it, you can file a bugreport.
I am enjoining wine, not whine....

OH1KH

  • New member
  • *
  • Posts: 17
Re: Fedora Richmemo and QT5
« Reply #4 on: March 27, 2018, 04:28:10 pm »
It seems that SelStart and SelLength can be set but when text is assigned to SelText its causes:

QTextCursor::setPosition: Position '11' out of range

Tried with different order of those 3 , but SelText assign causes the error.


Code: Pascal  [Select]
  1.  procedure AddColorStr(s: string; const col: TColor = clBlack; const NewLine: boolean = true);
  2.       begin
  3.         with WsjtxMemo do
  4.         begin
  5.           if NewLine then
  6.           begin
  7.             writeln('---------------------print NL-----------------');
  8.             Lines.Add('');
  9.             Lines.Delete(Lines.Count - 1); // avoid double line spacing
  10.           end;
  11.           writeln('---------------------print text-----------------');
  12.           writeln('textlen',Length(s));
  13.           SelStart := length(Text);
  14.           writeln('selstart ',SelStart);
  15.           SelLength := length(s);
  16.           writeln('sellen ',SelLength);
  17.           SelText   := s;
  18.           writeln('seltext ',s);
  19.           SetRangeColor(SelStart, SelLength, col);
  20.         end;
  21.       end;            
  22.  

I wonder why there is not a function that you could add one char (or string) to existing text without CR+NL.
And if that exist why just change first FontParameters  to desired color and then just add wanted char(s) to end of the existing text (that then appeared with new selected color)
Why this coloring has to go via add text, select it, color it like in wiki's example.

--
Saku

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus