[PyQt] QScintilla problems.

Barry Scott barry at barrys-emacs.org
Wed Aug 21 17:23:32 BST 2019



> On 20 Aug 2019, at 18:49, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 
> On 20/08/2019 15:05, Colin McPhail wrote:
>>> On 18 Aug 2019, at 19:30, Barry Scott <barry at barrys-emacs.org> wrote:
>>> The attached code shows two problems with QScintilla.
>>> 1. SCI_STYLEGETFONT does not return the font.
>>> 2. Changing the size to 24pt makes line spacing be 24pt but the text is drawn in 11pt.
>>> (1) looks likes a bug.
>>> (2) may be that I do not understand something about how to drive the API.
>>> What makes Scintilla use the changed settings.
>>> (3) Changing the font does not seem to work either.
>>> What am I misunderstanding?
>>> Barry
>> I'm not a QScintilla expert but I imagine most people use the
>> convenience methods of QScintilla objects such as setFont() and
>> setText(). I've attached a version of your example code that uses
>> those methods.
> 
> Yes - the main purpose of the low-level API is to support the needs of the high-level API. It should only need to be used if there is some feature of Scintilla that hasn't got a higher level abstraction.

Using setFont() has got my code working again. Original code is 3 years old and only broke recently.

The reason I was using the low level API is that the high level API does not support my
use case, as far as I can tell.

I'm using Qscintilla to make a side-by-side diff tool. I colour text to make it easy to see
inserted, deleted and modified text. This I do by using SCI_STYLESETFORE and
SCI_STYLESETBACK for 4 style numbers.

I use STYLE_DEFAULT, STYLE_LASTPREDEFINED+1, STYLE_LASTPREDEFINED+2
and STYLE_LASTPREDEFINED+3.

I'm also using INDIC and folding via the low level API.

BTW the PyPi description page has a bad link to the docs of
http://pyqt.sourceforge.net/Docs/QScintilla2/ <http://pyqt.sourceforge.net/Docs/QScintilla2/> I guess it should be
https://www.riverbankcomputing.com/static/Docs/QScintilla/ <https://www.riverbankcomputing.com/static/Docs/QScintilla/>


Barry



> 
> Phil
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190821/eb16afd6/attachment.html>


More information about the PyQt mailing list