mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 14:23:35 -07:00
Revert "GUI: Fix shift-click selection on macOS"
This reverts commit edb7755fa4
.
This commit is contained in:
parent
edb7755fa4
commit
cc11f9b067
2 changed files with 1 additions and 42 deletions
|
@ -1446,38 +1446,3 @@ void TransferListWidget::wheelEvent(QWheelEvent *event)
|
|||
|
||||
QTreeView::wheelEvent(event); // event delegated to base class
|
||||
}
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
void TransferListWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
const QModelIndex clickedIndex = indexAt(event->pos());
|
||||
if (!clickedIndex.isValid())
|
||||
{
|
||||
QTreeView::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
const bool shiftPressed = modifiers.testFlag(Qt::ShiftModifier);
|
||||
const bool cmdPressed = modifiers.testFlag(Qt::ControlModifier); // Command key on macOS
|
||||
|
||||
if (shiftPressed && m_lastClickedIndex.isValid())
|
||||
{
|
||||
// Handle shift-click range selection
|
||||
const QItemSelection selection(m_lastClickedIndex, clickedIndex);
|
||||
if (cmdPressed)
|
||||
selectionModel()->select(selection, QItemSelectionModel::Select | QItemSelectionModel::Rows);
|
||||
else
|
||||
selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
selectionModel()->setCurrentIndex(clickedIndex, QItemSelectionModel::NoUpdate);
|
||||
event->accept();
|
||||
return;
|
||||
}
|
||||
|
||||
// For non-shift clicks, update the last clicked index
|
||||
if (!(modifiers & (Qt::AltModifier | Qt::MetaModifier))) // Ignore if Alt/Meta is pressed
|
||||
m_lastClickedIndex = clickedIndex;
|
||||
|
||||
QTreeView::mousePressEvent(event);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -118,14 +118,11 @@ private slots:
|
|||
void askNewCategoryForSelection();
|
||||
void saveSettings();
|
||||
|
||||
protected:
|
||||
private:
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QModelIndex mapToSource(const QModelIndex &index) const;
|
||||
QModelIndexList mapToSource(const QModelIndexList &indexes) const;
|
||||
QModelIndex mapFromSource(const QModelIndex &index) const;
|
||||
|
@ -142,7 +139,4 @@ private:
|
|||
|
||||
TransferListModel *m_listModel = nullptr;
|
||||
TransferListSortModel *m_sortFilterModel = nullptr;
|
||||
#ifdef Q_OS_MACOS
|
||||
QPersistentModelIndex m_lastClickedIndex; // For handling shift-click selection on macOS
|
||||
#endif
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue