digiKam
Loading...
Searching...
No Matches
tableview_selection_model_syncer.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 2013-02-18
7 * Description : Sync QItemSelectionModel of ItemFilterModel and TableViewModel
8 *
9 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
10 * SPDX-FileCopyrightText: 2013 by Michael G. Hansen <mike at mghansen dot de>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QItemSelectionModel>
21#include <QObject>
22
23namespace Digikam
24{
25
26class TableViewShared;
27
28class TableViewSelectionModelSyncer : public QObject
29{
30 Q_OBJECT
31
32public:
33
34 explicit TableViewSelectionModelSyncer(TableViewShared* const sharedObject, QObject* const parent = nullptr);
36
37 QModelIndex toSource(const QModelIndex& targetIndex) const;
38 QModelIndex toTarget(const QModelIndex& sourceIndex) const;
39 QItemSelection itemSelectionToSource(const QItemSelection& selection) const;
40 QItemSelection itemSelectionToTarget(const QItemSelection& selection) const;
41 int targetModelColumnCount() const;
42 QItemSelection targetIndexToRowItemSelection(const QModelIndex& targetIndex) const;
43
44private Q_SLOTS:
45
46 void slotSourceModelReset();
47 void slotSourceCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
48/*
49 void slotSourceCurrentColumnChanged(const QModelIndex& current, const QModelIndex& previous);
50 void slotSourceCurrentRowChanged(const QModelIndex& current, const QModelIndex& previous);
51*/
52 void slotSourceSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
53 void slotTargetCurrentChanged(const QModelIndex& current, const QModelIndex& previous);
54/*
55 void slotTargetCurrentColumnChanged(const QModelIndex& current, const QModelIndex& previous);
56 void slotTargetCurrentRowChanged(const QModelIndex& current, const QModelIndex& previous);
57*/
58 void slotTargetSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
59 void slotTargetColumnsInserted(const QModelIndex& parent, int start, int end);
60 void slotTargetModelRowsInserted(const QModelIndex& parent, int start, int end);
61 void slotTargetModelReset();
62 void slotDoInitialSync();
63
64public Q_SLOTS:
65
66 void slotSetActive(const bool isActive);
67
68private:
69
70 class Private;
71 const QScopedPointer<Private> d;
72
73 TableViewShared* const s = nullptr;
74};
75
76} // namespace Digikam
Definition tableview_selection_model_syncer.h:29
~TableViewSelectionModelSyncer() override
Definition tableview_selection_model_syncer.cpp:79
void slotSetActive(const bool isActive)
Definition tableview_selection_model_syncer.cpp:302
QModelIndex toSource(const QModelIndex &targetIndex) const
Definition tableview_selection_model_syncer.cpp:83
int targetModelColumnCount() const
Definition tableview_selection_model_syncer.cpp:93
QItemSelection itemSelectionToTarget(const QItemSelection &selection) const
Definition tableview_selection_model_syncer.cpp:178
QItemSelection itemSelectionToSource(const QItemSelection &selection) const
Definition tableview_selection_model_syncer.cpp:154
QModelIndex toTarget(const QModelIndex &sourceIndex) const
Definition tableview_selection_model_syncer.cpp:88
QItemSelection targetIndexToRowItemSelection(const QModelIndex &targetIndex) const
Definition tableview_selection_model_syncer.cpp:98
Definition tableview_shared.h:35
Definition datefolderview.cpp:34