[Interest] [Solved] QPlainTextEdit and zoom-in / zoom-out

Wilhelm wilhelm.meier at fh-kl.de
Mon Jan 28 17:09:00 CET 2013


Am 28.01.2013 14:42, schrieb Koehne Kai:
>
>
>> -----Original Message-----
>> Subject: [Interest] QPlainTextEdit and zoom-in / zoom-out
>>
>> Hi all,
>>
>> is there a way to implement a text zoom-in/-out for a QPlainTextEdit (like
>> QTextEdit e.g.).
>>
>> The only way I managed to change the QPlainTextEdit font was to set the
>> default font for the whole application.
>>
>> Any hints?
>
> Did you try to set a different QTextCursor via http://qt-project.org/doc/qt-4.8/qplaintextedit.html#setTextCursor ? You should be able to set a font via http://qt-project.org/doc/qt-4.8/qtextcursor.html#setBlockCharFormat.

Well, it was embarrassingly simple:

     QFont f = document()->defaultFont();
     mTextPointSize *= mZoomFactor;
     f.setPointSize(mTextPointSize);
     document()->setDefaultFont(f);


>
> Regards
>
> Kai
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>


-- 
Wilhelm




More information about the Interest mailing list