D28854: [KRichTextWidget] Add support for headings

Igor Poboiko noreply at phabricator.kde.org
Thu Apr 16 14:07:57 BST 2020


poboiko marked 3 inline comments as done.
poboiko added a comment.


  In D28854#649189 <https://phabricator.kde.org/D28854#649189>, @abstractdevelop wrote:
  
  > Hey, thanks for this @poboiko  I used to have to implement this myself, so this will be very useful in my app, O20.Word. ;)
  
  
  Sure, you're welcome! I like doing useful stuff :)

INLINE COMMENTS

> dfaure wrote in krichtextedit.cpp:346
> If boundedLevel is 6, the size adjustement will be -1?
> Does this mean a heading that's smaller than normal text?

Yes, that's true. I agree it's a bit confusing, but that's the case with HTML too, which I had in mind (see screenshot, it's Chrome)
F8241667: scr1.png <https://phabricator.kde.org/F8241667>

For markdown, it seems like there are only 5 levels, 5th having the same size as normal text (6th level gets ignored, that's Okular)
F8241670: scr2.png <https://phabricator.kde.org/F8241670>

I guess we probably can follow the Markdown way and bound it with 5, just to avoid confusion.

> dfaure wrote in krichtextedit.cpp:375
> This seems to duplicate what happened with selectCursor already. Why are two cursors necessary to change the style of one paragraph?

I used `selectCursor` to select a line (block) under cursor and then change the style of the selection with `mergeCharFormat` .

`cursor` is for actual users cursor, which also has to change the style, so newly typed text will have the same style and heading level too (I use `mergeBlockCharFormat` for that reason - if I use `mergeCharFormat` here, the cursor will remain big after I press `Enter` after a title. However, it will change its size to the smaller one immediately after I start typing). But I don't want to mess with users selection, that's why I'm keeping both.

REPOSITORY
  R310 KTextWidgets

REVISION DETAIL
  https://phabricator.kde.org/D28854

To: poboiko, #frameworks, mlaurent, ahmadsamir, dfaure
Cc: abstractdevelop, kde-frameworks-devel, LeGast00n, cblack, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200416/86a83f12/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list