Warning, file /graphics/krita/libs/ui/input/config/kis_action_shortcuts_model.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * This file is part of the KDE project 0003 * SPDX-FileCopyrightText: 2013 Arjen Hiemstra <ahiemstra@heimr.nl> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef KISACTIONSHORTCUTSMODEL_H 0009 #define KISACTIONSHORTCUTSMODEL_H 0010 0011 #include <QAbstractListModel> 0012 0013 class KisAbstractInputAction; 0014 class KisInputProfile; 0015 0016 /** 0017 * \brief A QAbstractListModel subclass that lists shortcuts associated with an action from a profile. 0018 * 0019 * This class lists all shortcuts from the set profile that correspond to a specific action. This is 0020 * used to allow editing of shortcuts from the ui. 0021 * 0022 * It defines the following columns: 0023 * - Type: The type of shortcut, can be one of Key Combination, Mouse Button, Mouse Wheel, Gesture 0024 * - Input: What input is used to activate the shortcut. Depends on the type. 0025 * - Action: What mode of the action will be activated by the shortcut. 0026 * 0027 * \note Before this model will provide any data you should call setAction and setProfile. 0028 * \note This model is editable and provides an implementation of removeRows. 0029 */ 0030 class KisActionShortcutsModel : public QAbstractListModel 0031 { 0032 Q_OBJECT 0033 public: 0034 /** 0035 * Constructor. 0036 */ 0037 explicit KisActionShortcutsModel(QObject *parent = 0); 0038 /** 0039 * Destructor. 0040 */ 0041 ~KisActionShortcutsModel() override; 0042 0043 /** 0044 * Reimplemented from QAbstractItemModel::data() 0045 */ 0046 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0047 /** 0048 * Reimplemented from QAbstractItemModel::rowCount() 0049 */ 0050 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0051 /** 0052 * Reimplemented from QAbstractItemModel::columnCount() 0053 */ 0054 int columnCount(const QModelIndex &) const override; 0055 /** 0056 * Reimplemented from QAbstractItemModel::headerData() 0057 */ 0058 QVariant headerData(int section, Qt::Orientation orientation, int role = 0059 Qt::DisplayRole) const override; 0060 /** 0061 * Reimplemented from QAbstractItemModel::flags() 0062 */ 0063 Qt::ItemFlags flags(const QModelIndex &index) const override; 0064 /** 0065 * Reimplemented from QAbstractItemModel::setData() 0066 */ 0067 bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; 0068 0069 /** 0070 * Reimplemented from QAbstractItemModel::removeRows. 0071 * 0072 * Removes `count` rows starting at `row`. 0073 * 0074 * \note The associated shortcuts will also be removed from the profile and completely 0075 * deleted. 0076 */ 0077 bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override; 0078 0079 /** 0080 * \return The action used as data constraint for this model. 0081 */ 0082 KisAbstractInputAction *action() const; 0083 /** 0084 * \return The profile used as data source for this model. 0085 */ 0086 KisInputProfile *profile() const; 0087 0088 bool canRemoveRow(int row) const; 0089 0090 public Q_SLOTS: 0091 /** 0092 * Set the action used as data constraint for this model. 0093 * 0094 * \param action The action to use. 0095 */ 0096 void setAction(KisAbstractInputAction *action); 0097 /** 0098 * Set the profile used as data source for this model. 0099 * 0100 * \param profile The profile to get the data from. 0101 */ 0102 void setProfile(KisInputProfile *profile); 0103 0104 private Q_SLOTS: 0105 void currentProfileChanged(); 0106 0107 private: 0108 class Private; 0109 Private *const d; 0110 }; 0111 0112 #endif // KISACTIONSHORTCUTSMODEL_H