[Interest] [Development] QTextEdit - Line Spacing

Allan Sandfeld Jensen kde at carewolf.com
Sun Nov 11 16:19:18 CET 2018


On Sonntag, 11. November 2018 16:13:12 CET coroberti . wrote:
> On Sun, Nov 11, 2018 at 5:06 PM Allan Sandfeld Jensen <kde at carewolf.com> 
wrote:
> > On Sonntag, 11. November 2018 14:11:52 CET coroberti . wrote:
> > > Hi,
> > > It seems that arranging line spacing for text in QTextEdit (like 1.5,
> > > 2, 3 lines) is not an easy coding.
> > > 
> > > Any code samples, directions, howtos would be very much appreciated.
> > 
> > There is probably a way to get to the default or root QTextBlockFormat and
> > set lineHeight on it, but I couldn't spot the logical way from QTextEdit
> > either; but you can always just do it in CSS and set the CSS as the
> > default style- sheet on the document the QTextEdit is showing. Remember a
> > QTextEdit is basically showing HTML, so you can do it like you would in
> > HTML.
> > 
> > 'Allan
> 
> Hi Allan,
> Thanks, but It seems that only this HTML/CSS subset is supported:
> 
> http://doc.qt.io/qt-5/richtext-html-subset.html
> 
Right, line-height isn't mentioned there, but considering the C++ side of the 
CSS implementation (QTextBlockFormat) has it, it might just have left out. I 
would give it a shot.

'Allan






More information about the Interest mailing list