Speech to text: always select full sequence when clicking on a no speech section

parent aeb264d3
Pipeline #52979 passed with stage
in 10 minutes and 37 seconds
......@@ -524,10 +524,17 @@ void VideoTextEdit::mouseReleaseEvent(QMouseEvent *e)
// Selection already ends with a space
return;
}
cursor.setPosition(start);
cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
cursor.setPosition(end, QTextCursor::KeepAnchor);
cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
QTextBlock bk = cursor.block();
if (bk.text().simplified() == i18n("No speech")) {
// This is a silence block, select all
cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
} else {
cursor.setPosition(start);
cursor.movePosition(QTextCursor::StartOfWord, QTextCursor::MoveAnchor);
cursor.setPosition(end, QTextCursor::KeepAnchor);
cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
}
pos = cursor.position();
if (!cursor.atBlockEnd() && document()->characterAt(pos - 1) != QLatin1Char(' ')) {
// Remove trailing space
......@@ -540,7 +547,7 @@ void VideoTextEdit::mouseReleaseEvent(QMouseEvent *e)
repaintLines();
}
} else {
qDebug()<<"==== NO LEF TCLICK!";
qDebug()<<"==== NO LEFT CLICK!";
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment