File indexing completed on 2024-05-12 04:43:05
0001 /*************************************************************************** 0002 * Copyright (C) 2018 by Emmanuel Lepage Vallee * 0003 * Author : Emmanuel Lepage Vallee <emmanuel.lepage@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 3 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0017 **************************************************************************/ 0018 #ifndef KQUICKITEMVIEWS_SELECTION_P_H 0019 #define KQUICKITEMVIEWS_SELECTION_P_H 0020 0021 // Qt 0022 #include <QtCore/QRectF> 0023 #include <QtCore/QItemSelectionModel> 0024 0025 #include <private/indexmetadata_p.h> 0026 class SelectionAdapter; 0027 0028 namespace StateTracker { 0029 0030 /** 0031 * WORK IN PROGRESS 0032 * 0033 * Keep track of the selection status. 0034 * 0035 * This support both currentIndex and multi-selection modes and supports 0036 * multiple selection models on the same more. 0037 */ 0038 struct Selection 0039 { 0040 enum class State { 0041 NONE , /*!< No selection model hold a selection on this item */ 0042 CURRENT_INDEX , /*!< A single selection model sets it as currentIndex */ 0043 MULTIPLE , /*!< A single selection model mutli-select the item */ 0044 MIXED_CURRENT_INDEX, /*!< Multiple sel. model select this item, at least 1 as current index */ 0045 MIXED_MULTIPLE , /*!< Multiple selection models multi-select this index */ 0046 }; 0047 0048 bool performAction(QItemSelectionModel::SelectionFlag f, SelectionAdapter *ad); 0049 0050 State state() const; 0051 0052 private: 0053 typedef void(Geometry::*StateF)(); 0054 0055 /*static const State m_fStateMap [5][7]; 0056 static const StateF m_fStateMachine[5][7];*/ 0057 0058 // Actions 0059 //TODO 0060 0061 State m_State {State::NONE}; 0062 }; 0063 0064 } 0065 0066 #endif