1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 19:19:56 +00:00
openmw-tes3mp/apps/opencs/model/prefs/shortcut.hpp
Aesylwinn e8626e588a Changes in shortcut design.
- Handle input in centralized class for potential conflict resolution.
- Remove wrapper class for QShortcut; it should be unnecessary.
- Added customizable shortcut usage to orbit camera mode.
2016-07-20 08:25:11 -04:00

65 lines
1.5 KiB
C++

#ifndef CSM_PREFS_SHORTCUT_H
#define CSM_PREFS_SHORTCUT_H
#include <string>
#include <QKeySequence>
#include <QObject>
#include <QString>
class QKeyEvent;
class QMouseEvent;
class QShortcut;
namespace CSMPrefs
{
/// A class similar in purpose to QShortcut, but with the ability to use mouse buttons
class Shortcut : public QObject
{
Q_OBJECT
public:
Shortcut(const std::string& name, QObject* parent);
~Shortcut();
bool isActive() const;
bool isEnabled() const;
const std::string& getName() const;
const QKeySequence& getSequence() const;
/// The position in the sequence
int getPosition() const;
/// The position in the sequence
int getLastPosition() const;
void setSequence(const QKeySequence& sequence);
/// The position in the sequence
void setPosition(int pos);
void activate(bool state);
void enable(bool state);
QString toString() const;
private:
std::string mName;
QKeySequence mSequence;
int mCurrentPos;
int mLastPos;
bool mActive;
bool mEnabled;
signals:
/// Triggered when the shortcut is activated or deactived; can be determined from \p state
void activated(bool state);
/// Trigger when activated; convenience signal.
void activated();
};
}
#endif