D28854: [KRichTextWidget] Add support for headings
Igor Poboiko
noreply at phabricator.kde.org
Wed Apr 15 13:09:29 BST 2020
poboiko created this revision.
poboiko added reviewers: Frameworks, mlaurent, ahmadsamir, dfaure.
Herald added a project: Frameworks.
poboiko requested review of this revision.
REVISION SUMMARY
This patch adds support of different headings (essentially, HTML h1..h6 tags).
Those might be pretty useful when formatting a rich text (I'm having KJots - note taking app - in mind)
`QTextBlockFormat` supports `headingLevel` since Qt 5.12; however, as stated in the documentation,
`setHeadingLevel` does not adjust style (font size, etc), so we have to take care of it on our own.
It also adds a `KSelectAction` to choose between different headings.
There are few behavior nuances:
1. If user presses `Enter` at the end of heading line, cursor should switch to `basic text`
2. If user presses `Enter` in the middle of the heading, line just breaks into two headings
3. If user presses `Backspace` at the beginning of a line after the heading, the line is merged with the previous one (and thus becomes heading itself)
4. The same with `Delete` at the end of heading line: the next line should become heading too.
TEST PLAN
See the video of `KRichTextEditor` from `KXmlGui` (I had to add `format_heading_level` to rc-file).
REPOSITORY
R310 KTextWidgets
BRANCH
textwidget-heading (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D28854
AFFECTED FILES
src/widgets/krichtextedit.cpp
src/widgets/krichtextedit.h
src/widgets/krichtextwidget.cpp
src/widgets/krichtextwidget.h
To: poboiko, #frameworks, mlaurent, ahmadsamir, dfaure
Cc: 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/20200415/9965bbe5/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list