src/widgets/extendedkeysequenceeditor.h

Thu, 20 Jun 2019 08:54:35 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 20 Jun 2019 08:54:35 +0300
changeset 1440
265b2e95a8e8
parent 1433
bd3a9e237ef5
permissions
-rw-r--r--

uuid things

1433
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
1 /*
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
3 * Copyright (C) 2013 - 2018 Teemu Piippo
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
4 *
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
8 * (at your option) any later version.
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
9 *
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
13 * GNU General Public License for more details.
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
14 *
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
17 */
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
18
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
19 #pragma once
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
20 #include <QWidget>
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
21
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
22 /*
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
23 * A widget which contains not only a key sequence editor, but also buttons for resetting and
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
24 * clearing the key sequence.
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
25 */
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
26 class ExtendedKeySequenceEditor : public QWidget
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
27 {
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
28 Q_OBJECT
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
29
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
30 public:
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
31 explicit ExtendedKeySequenceEditor(
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
32 const QKeySequence& initialSequence = {},
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
33 const QKeySequence& defaultSequence = {},
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
34 QWidget *parent = nullptr);
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
35 ~ExtendedKeySequenceEditor();
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
36
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
37 QKeySequence keySequence() const;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
38
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
39 public slots:
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
40 void setKeySequence(const QKeySequence& newSequence);
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
41 void clear();
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
42
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
43 private:
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
44 const QKeySequence defaultSequence;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
45 class QKeySequenceEdit* editor;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
46 class QPushButton* clearButton;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
47 class QPushButton* resetButton;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
48 class QHBoxLayout* layout;
bd3a9e237ef5 reimplented shortcuts in the config dialog using model/view programming
Teemu Piippo <teemu@hecknology.net>
parents:
diff changeset
49 };

mercurial