Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
+89
@@ -0,0 +1,89 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
#include <QToolButton>
|
||||
#include <LtsVirtualKeyboard/ltsvirtualkeyboard_export.h>
|
||||
|
||||
#define DEFAULT_BACKGROUND_BUTTON "background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,stop: 0 #8C8F8C, stop: 1 #333831);"
|
||||
#define CHANGED_BACKGROUND_BUTTON "background:lightgray;color:darkred;"
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_STYLE_BUTTON "color:white;border: 1px solid #000000;border-radius:6px;"
|
||||
|
||||
#define STYLE_FOCUS_TEXT "border: 1px solid red"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace LtsVirtualKeyboard
|
||||
{
|
||||
class LTSVIRTUALKEYBOARD_EXPORT LtsKeyPushButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
#define KEY_TAB LtsKeyPushButton::tr("TAB")
|
||||
#define KEY_ALT LtsKeyPushButton::tr("!?#")
|
||||
#define KEY_ALT2 LtsKeyPushButton::tr("Abc")
|
||||
#define KEY_CAPS QStringLiteral("CAPS")
|
||||
#define KEY_CTRL_LEFT LtsKeyPushButton::tr("CTRL")
|
||||
#define KEY_CUT_LEFT LtsKeyPushButton::tr("cut")
|
||||
#define KEY_COPY LtsKeyPushButton::tr("copy")
|
||||
#define KEY_PASTE LtsKeyPushButton::tr("paste")
|
||||
#define KEY_BACKSPACE LtsKeyPushButton::tr("<--")
|
||||
#define KEY_HIDECHAR LtsKeyPushButton::tr("echo")
|
||||
#define KEY_CANC QStringLiteral("->")
|
||||
#define KEY_RETURN QStringLiteral("RETURN")
|
||||
#define KEY_FIN QStringLiteral("Ok")
|
||||
#define KEY_SHIFT QStringLiteral("SHIFT")
|
||||
#define KEY_SPACE " "
|
||||
|
||||
#define IS_KEY(keyTextPressed, keyValCompare) (keyTextPressed).contains((keyValCompare), Qt::CaseInsensitive)
|
||||
|
||||
#define IS_TAB(text) IS_KEY(text, KEY_TAB)
|
||||
#define IS_ALT(text) IS_KEY(text, KEY_ALT)
|
||||
#define IS_ALT2(text) IS_KEY(text, KEY_ALT2)
|
||||
#define IS_CAPS(text) IS_KEY(text, KEY_CAPS)
|
||||
#define IS_CTRL_LEFT(text) IS_KEY(text, KEY_CTRL_LEFT)
|
||||
#define IS_CUT_LEFT(text) IS_KEY(text, KEY_CUT_LEFT)
|
||||
#define IS_BACK(text) IS_KEY(text, KEY_BACKSPACE)
|
||||
#define IS_CANC(text) IS_KEY(text, KEY_CANC)
|
||||
#define IS_RETURN(text) IS_KEY(text, KEY_RETURN)
|
||||
#define IS_FIN(text) IS_KEY(text, KEY_FIN)
|
||||
#define IS_SHIFT(text) IS_KEY(text, KEY_SHIFT)
|
||||
#define IS_SPACE(text) IS_KEY(text, QStringLiteral(KEY_SPACE))
|
||||
#define IS_PASSWORD(text) IS_KEY(text, KEY_HIDECHAR)
|
||||
#define IS_COPY(text) IS_KEY(text, KEY_COPY)
|
||||
#define IS_PASTE(text) IS_KEY(text, KEY_PASTE)
|
||||
#define NO_SPECIAL_KEY(text) ((text).length() == 1)
|
||||
|
||||
public:
|
||||
LtsKeyPushButton(const QString ¬TranslatedText, const QString ¬TranslatedTextAlt, QWidget *parent = nullptr);
|
||||
void setAltMode(bool altmode);
|
||||
void setCapsMode(bool caps);
|
||||
|
||||
private slots:
|
||||
void getKeyPress();
|
||||
|
||||
signals:
|
||||
void pressedKey();
|
||||
|
||||
private:
|
||||
QWidget *m_parent;
|
||||
QString m_notTranslatedText;
|
||||
QString m_notTranslatedTextAlt;
|
||||
int m_oldYKey;
|
||||
bool m_altMode;
|
||||
bool m_capsMode;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void changeEvent(QEvent *event);
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user