diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2023-07-09 17:36:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-09 17:36:03 +0200 |
| commit | ef94aee28464039672b277243a0181ae93550d6c (patch) | |
| tree | 0575a68af5f154e9d6d0738edbaefb16a11d6f5c /src/copyeventfilter.cpp | |
| parent | 7d6cb8528d20e36a4cee822263865ee2f7f32481 (diff) | |
| parent | 3de050e9c03e553f7ae3f780f6bd080a30ae123e (diff) | |
Merge pull request #1839 from Holt59/ci/initial-gh-action-for-build
Clang-Format + Github Workflow
Diffstat (limited to 'src/copyeventfilter.cpp')
| -rw-r--r-- | src/copyeventfilter.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/copyeventfilter.cpp b/src/copyeventfilter.cpp index bd61e04d..cee574c3 100644 --- a/src/copyeventfilter.cpp +++ b/src/copyeventfilter.cpp @@ -4,18 +4,16 @@ #include <QGuiApplication> #include <QKeyEvent> -CopyEventFilter::CopyEventFilter(QAbstractItemView* view, int column, int role) : - CopyEventFilter(view, [=](auto& index) { return index.sibling(index.row(), column).data(role).toString(); }) -{ - -} +CopyEventFilter::CopyEventFilter(QAbstractItemView* view, int column, int role) + : CopyEventFilter(view, [=](auto& index) { + return index.sibling(index.row(), column).data(role).toString(); + }) +{} -CopyEventFilter::CopyEventFilter( - QAbstractItemView* view, std::function<QString(const QModelIndex&)> format) : - QObject(view), m_view(view), m_format(format) -{ - -} +CopyEventFilter::CopyEventFilter(QAbstractItemView* view, + std::function<QString(const QModelIndex&)> format) + : QObject(view), m_view(view), m_format(format) +{} void CopyEventFilter::copySelection() const { @@ -25,9 +23,10 @@ void CopyEventFilter::copySelection() const // sort to reflect the visual order QModelIndexList selectedRows = m_view->selectionModel()->selectedRows(); - std::sort(selectedRows.begin(), selectedRows.end(), [=](const auto& lidx, const auto& ridx) { - return m_view->visualRect(lidx).top() < m_view->visualRect(ridx).top(); - }); + std::sort(selectedRows.begin(), selectedRows.end(), + [=](const auto& lidx, const auto& ridx) { + return m_view->visualRect(lidx).top() < m_view->visualRect(ridx).top(); + }); QStringList rows; for (auto& idx : selectedRows) { @@ -41,8 +40,7 @@ bool CopyEventFilter::eventFilter(QObject* sender, QEvent* event) { if (sender == m_view && event->type() == QEvent::KeyPress) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); - if (keyEvent->modifiers() == Qt::ControlModifier - && keyEvent->key() == Qt::Key_C) { + if (keyEvent->modifiers() == Qt::ControlModifier && keyEvent->key() == Qt::Key_C) { copySelection(); return true; } |
