Revert "GUI: Fix shift-click selection on macOS"

This reverts commit edb7755fa4.
This commit is contained in:
Luke Memet 2025-02-15 11:34:28 -05:00
commit cc11f9b067
2 changed files with 1 additions and 42 deletions

View file

@ -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

View file

@ -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
};