forked from qt-creator/qt-creator
Editor: fix selecting multiple block selections with mouse
Change-Id: I5b46adbf38358d1396ee7120558648b1375e4047 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -50,6 +50,12 @@ void MultiTextCursor::addCursor(const QTextCursor &cursor)
|
||||
mergeCursors();
|
||||
}
|
||||
|
||||
void MultiTextCursor::addCursors(const QList<QTextCursor> &cursors)
|
||||
{
|
||||
m_cursors.append(cursors);
|
||||
mergeCursors();
|
||||
}
|
||||
|
||||
void MultiTextCursor::setCursors(const QList<QTextCursor> &cursors)
|
||||
{
|
||||
m_cursors = cursors;
|
||||
|
@@ -57,6 +57,7 @@ public:
|
||||
/// the \param cursor that is appended by added by \brief addCursor
|
||||
/// will be interpreted as the new main cursor
|
||||
void addCursor(const QTextCursor &cursor);
|
||||
void addCursors(const QList<QTextCursor> &cursors);
|
||||
/// convenience function that removes the old main cursor and appends
|
||||
/// \param cursor as the new main cursor
|
||||
void replaceMainCursor(const QTextCursor &cursor);
|
||||
|
@@ -5335,7 +5335,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
anchorCursor.blockNumber(),
|
||||
anchorColumn};
|
||||
|
||||
cursor.setCursors(d->generateCursorsForBlockSelection(blockSelection));
|
||||
cursor.addCursors(d->generateCursorsForBlockSelection(blockSelection));
|
||||
if (!cursor.isNull())
|
||||
setMultiTextCursor(cursor);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user