Krita Source Code Documentation
Loading...
Searching...
No Matches
KisShortcutsDialog_p.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2 SPDX-FileCopyrightText: 2006, 2007 Andreas Hartmetz (ahartmetz@gmail.com)
3 SPDX-FileCopyrightText: 2008 Michael Jansen <kde@michael-jansen.biz>
4 SPDX-FileCopyrightText: 2008 Alexander Dymo <adymo@kdevelop.org>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#ifndef KISSHORTCUTSDIALOG_P_H
10#define KISSHORTCUTSDIALOG_P_H
11
12#include "KisShortcutsEditor.h"
13#include "kkeysequencewidget.h"
14#include "KisShortcutsDialog.h"
15
16#include <kextendableitemdelegate.h>
17#include <klocalizedstring.h>
18#include <kmessagebox.h>
19
20#include <QKeySequence>
21#include <QMetaType>
22#include <QModelIndex>
23#include <QList>
24#include <QCollator>
25#include <QHBoxLayout>
26
27class QLabel;
28class QTreeWidget;
29class QTreeWidgetItem;
30class QRadioButton;
31class QAction;
33class QPushButton;
34class QComboBox;
37class QAction;
38
39
46
47// XXX: Hmm
53
54
64
65// Return the first item of the list, if it exists
66QKeySequence primarySequence(const QList<QKeySequence> &sequences);
67
68// Return the second item of the list, if it exists
69QKeySequence alternateSequence(const QList<QKeySequence> &sequences);
70
71
72
86
87
104class KisShortcutsEditorDelegate : public KExtendableItemDelegate
105{
106 Q_OBJECT
107public:
108 KisShortcutsEditorDelegate(QTreeWidget *parent, bool allowLetterShortcuts);
109 //reimplemented to have some extra height
110 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
111
118 void setCheckActionCollections(const QList<KisKActionCollection *> checkActionCollections);
119 bool eventFilter(QObject *, QEvent *) override;
120private:
121 mutable QPersistentModelIndex m_editingIndex;
123 QWidget *m_editor;
124
127
128
129Q_SIGNALS:
130 void shortcutChanged(QVariant, const QModelIndex &);
131
132public Q_SLOTS:
133 void hiddenBySearchLine(QTreeWidgetItem *, bool);
134
135private Q_SLOTS:
136 void itemActivated(QModelIndex index);
137
142 void itemCollapsed(QModelIndex index);
143
148 void stealShortcut(const QKeySequence &seq, QAction *action);
149
150 void keySequenceChanged(const QKeySequence &);
151
152};
153
154
165class ShortcutEditWidget : public QWidget
166{
167 Q_OBJECT
168public:
169 ShortcutEditWidget(QWidget *viewport, const QKeySequence &defaultSeq, const QKeySequence &activeSeq,
170 bool allowLetterShortcuts);
171
173 void setCheckActionCollections(const QList<KisKActionCollection *> checkActionCollections);
174
176
177 KisKKeySequenceWidget::ShortcutTypes checkForConflictsAgainst() const;
178 void setCheckForConflictsAgainst(KisKKeySequenceWidget::ShortcutTypes);
180
182
183 bool multiKeyShortcutsAllowed() const;
186
188 void setComponentName(const QString componentName);
189
190 void setAction(QObject *action);
191 void paintEvent(QPaintEvent *pe) override;
192
193
194Q_SIGNALS:
196 void keySequenceChanged(const QKeySequence &);
197
199 void stealShortcut(const QKeySequence &seq, QAction *action);
200
201
202public Q_SLOTS:
204 void setKeySequence(const QKeySequence &activeSeq);
205
206private Q_SLOTS:
207 void defaultToggled(bool);
208 void setCustom(const QKeySequence &);
209
210
211
212private:
215 QRadioButton *m_defaultRadio;
216 QRadioButton *m_customRadio;
219 QObject *m_action;
220};
221
222#endif /* KISSHORTCUTSDIALOG_P_H */
@ NonActionItem
@ ShortcutRole
@ DefaultShortcutRole
ColumnDesignation
@ LocalAlternate
@ LocalPrimary
QKeySequence alternateSequence(const QList< QKeySequence > &sequences)
QKeySequence primarySequence(const QList< QKeySequence > &sequences)
A container for a set of QAction objects.
A widget to input a QKeySequence.
QHash< QString, KisKActionCollection * > m_collections
void keySequenceChanged(const QKeySequence &)
void hiddenBySearchLine(QTreeWidgetItem *, bool)
KisShortcutsEditorDelegate(QTreeWidget *parent, bool allowLetterShortcuts)
QList< KisKActionCollection * > m_checkActionCollections
List of actionCollections to check for conflicts.
QPersistentModelIndex m_editingIndex
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
void stealShortcut(const QKeySequence &seq, QAction *action)
void setCheckActionCollections(const QList< KisKActionCollection * > checkActionCollections)
bool eventFilter(QObject *, QEvent *) override
void shortcutChanged(QVariant, const QModelIndex &)
Widget for configuration of KAccel and KGlobalAccel.
void stealShortcut(const QKeySequence &seq, QAction *action)
void setCheckForConflictsAgainst(KisKKeySequenceWidget::ShortcutTypes)
void setAction(QObject *action)
ShortcutEditWidget(QWidget *viewport, const QKeySequence &defaultSeq, const QKeySequence &activeSeq, bool allowLetterShortcuts)
void paintEvent(QPaintEvent *pe) override
KisKKeySequenceWidget * m_customEditor
QKeySequence m_defaultKeySequence
void setCustom(const QKeySequence &)
void keySequenceChanged(const QKeySequence &)
Emitted when the key sequence is changed.
void setCheckActionCollections(const QList< KisKActionCollection * > checkActionCollections)
KisKKeySequenceWidget::ShortcutTypes checkForConflictsAgainst() const
void setKeySequence(const QKeySequence &activeSeq)
Set the displayed sequences.
QRadioButton * m_defaultRadio
void setComponentName(const QString componentName)