itom
Loading...
Searching...
No Matches
shortcutAction.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom.
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 itom is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17 General Public Licence for more details.
18
19 You should have received a copy of the GNU Library General Public License
20 along with itom. If not, see <http://www.gnu.org/licenses/>.
21*********************************************************************** */
22
23#ifndef SHORTCUTACTION_H
24#define SHORTCUTACTION_H
25
26#include "../global.h"
27#include "../common/sharedStructures.h"
28
29#include <qaction.h>
30#include <qobject.h>
31#include <qstring.h>
32#include <qshortcut.h>
33#include <qpointer.h>
34
35namespace ito
36{
37
38class AbstractDockWidget; //forward declaration
39
40class ShortcutAction : public QObject
41{
42public:
44 ShortcutAction(const QString &text, AbstractDockWidget *parent);
45
47 ShortcutAction(const QIcon &icon, const QString &text, AbstractDockWidget *parent);
48
50 ShortcutAction(const QIcon &icon, const QString &text, AbstractDockWidget *parent,
51 const QKeySequence &key, Qt::ShortcutContext context = Qt::WindowShortcut);
52
54 ShortcutAction(const QIcon &icon, const QString &text, AbstractDockWidget *parent,
55 const QKeySequence &key, Qt::ShortcutContext dockedContext,
56 Qt::ShortcutContext undockedContext);
57
59
60 void connectTrigger(const QObject *receiver, const char *method, Qt::ConnectionType type = Qt::AutoConnection);
61
62 void setEnabled(bool actionEnabled, bool shortcutEnabled);
63
64 void setEnabled(bool enabled);
65
66 void setVisible(bool actionVisible, bool shortcutEnabled);
67
68 void setVisible(bool visible);
69
70 QAction* action() const { return m_action.data(); }
71
72private:
73 QPointer<QAction> m_action;
74 QPointer<QShortcut> m_shortcut;
75 Qt::ShortcutContext m_dockedShortcut;
76 Qt::ShortcutContext m_undockedShortcut;
77
78private Q_SLOTS:
79 void parentDockStateChanged(bool docked);
80
81};
82
83} //end namespace ito
84
85#endif
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition abstractDockWidget.h:55
Definition shortcutAction.h:41
ShortcutAction(const QString &text, AbstractDockWidget *parent)
< simple action with text only (no shortcut)
Definition shortcutAction.cpp:31
Definition apiFunctionsGraph.cpp:40