@@ -3172,7 +3172,7 @@ void ListWidget::mousePressEvent(QMouseEvent *e) {
31723172 }
31733173 _mouseActive = true ;
31743174 registerReadMetricsActivity ();
3175- mouseActionStart (e->globalPos (), e->button ());
3175+ mouseActionStart (e->globalPos (), e->button (), e-> modifiers () );
31763176}
31773177
31783178void ListWidget::onTouchScrollTimer () {
@@ -3650,7 +3650,8 @@ void ListWidget::clearDragSelection() {
36503650
36513651void ListWidget::mouseActionStart (
36523652 const QPoint &globalPosition,
3653- Qt::MouseButton button) {
3653+ Qt::MouseButton button,
3654+ Qt::KeyboardModifiers modifiers) {
36543655 mouseActionUpdate (globalPosition);
36553656 if (button != Qt::LeftButton) {
36563657 return ;
@@ -3713,7 +3714,23 @@ void ListWidget::mouseActionStart(
37133714 }
37143715 if (_mouseSelectType != TextSelectType::Paragraphs) {
37153716 _mouseTextSymbol = dragState.symbol ;
3716- if (isPressInSelectedText (dragState)) {
3717+ const auto canShiftExtend = (modifiers & Qt::ShiftModifier)
3718+ && (dragState.cursor == CursorState::Text)
3719+ && (_selectedTextItem == pressElement->data ())
3720+ && (_selectedTextRange != FullSelection)
3721+ && (_selectedTextRange.from != _selectedTextRange.to );
3722+ if (canShiftExtend) {
3723+ auto symbol = _mouseTextSymbol;
3724+ if (dragState.afterSymbol ) ++symbol;
3725+ const auto extended = ExtendTextSelectionTo (
3726+ _selectedTextRange,
3727+ symbol);
3728+ _mouseTextSymbol = (extended.from == symbol)
3729+ ? extended.to
3730+ : extended.from ;
3731+ setTextSelection (pressElement, extended);
3732+ _mouseAction = MouseAction::Selecting;
3733+ } else if (isPressInSelectedText (dragState)) {
37173734 _mouseAction = MouseAction::PrepareDrag; // start text drag
37183735 } else if (!_pressWasInactive) {
37193736 if (requiredToStartDragging (pressElement)
0 commit comments