diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-05-10 20:20:00 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2019-05-24 15:37:04 +0200 |
commit | 2c8fa9700cb1eb5f1587bec46b7060ec93c6b1d2 (patch) | |
tree | 9a7743c8818999c65193583d92ed10cd1fc3794d /src/widgets/widgets/qwidgettextcontrol_p_p.h | |
parent | 12e0c7cbe0be22c288413080a1d1bd3beafb3008 (diff) |
Support clicking to toggle checkboxes in QTextEdit
Add QAbstractTextDocumentLayout::markerAt(pos) for hit testing.
(Qt Quick TextEdit needs it too.) Finds out whether the position
corresponds to a marker on a paragraph. I.e. it finds checkboxes in
GitHub-flavored markdown. This enables editor classes to toggle
checkboxes by clicking them.
Use it in QTextEdit to add the checkbox toggling feature. Also show the
"pointing finger" cursor when hovering a toggleable checkbox.
Change-Id: I036c967ab45e14c836272eac2cc7c7d652543c89
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'src/widgets/widgets/qwidgettextcontrol_p_p.h')
-rw-r--r-- | src/widgets/widgets/qwidgettextcontrol_p_p.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h index 6ccdfafe2b..c77a31bedf 100644 --- a/src/widgets/widgets/qwidgettextcontrol_p_p.h +++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h @@ -55,6 +55,7 @@ #include "QtGui/qtextdocumentfragment.h" #include "QtGui/qtextcursor.h" #include "QtGui/qtextformat.h" +#include "QtGui/qtextobject.h" #if QT_CONFIG(menu) #include "QtWidgets/qmenu.h" #endif @@ -227,6 +228,7 @@ public: QString highlightedAnchor; // Anchor below cursor QString anchorOnMousePress; + QTextBlock blockWithMarkerUnderMouse; bool hadSelectionOnMousePress; bool ignoreUnusedNavigationEvents; |