Details
-
Task
-
Resolution: Fixed
-
P3: Somewhat important
-
5.15.2
-
None
-
fed79b873 (dev), 4c3f57613 (6.5)
Description
QTextEdit and QPlainText do not correctly emit cursorPositionChanged() signal when user selects the whole text (with Ctrl+A) and probably also when selecting text programatically with selectAll().
Run the following snippet and press Ctrl+A. The whole text will be selected and the cursor will be moved to the end of the text. But nothing will be written to console despite the fact that it should write that the cursor position was changed to the position at the end of the text. In contrast when selecting the text with Ctrl+Shift+End, the text cursor position change is correctly emitted and reported.
#include <QApplication> #include <QDebug> #include <QTextEdit> int main(int argc, char *argv[]) { QApplication a(argc, argv); QTextEdit edit; edit.setText("asdhasjkd\nasjkdh ajksdhasjk\nasdhasjkhd asd ashdkjash\n"); edit.show(); QObject::connect(&edit, &QTextEdit::cursorPositionChanged, [&edit]{ qDebug() << "cursor changed" << edit.textCursor().position(); }); return a.exec(); }