diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2022-05-17 11:47:01 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2023-07-09 17:20:40 +0200 |
| commit | d13f6bb870cdda71257f665367be8ef9fca86255 (patch) | |
| tree | 52e214718478f1e52856572f5aa1a2ac58537f9f /src/copyeventfilter.cpp | |
| parent | 86bb01ba9eac879d3685c439ac9da0028bc4bc80 (diff) | |
Apply clang-format.
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; } |
