Files
0417_QT_code/APP/APP_KeypadModel.h

52 lines
1.1 KiB
C
Raw Normal View History

2026-03-26 10:45:29 +08:00
#pragma once
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVector>
namespace APP {
enum class APP_KeyTone
{
Normal,
Aqua,
Amber,
Blue
};
struct APP_KeyInfo
{
QString id;
QString label;
QString hint;
quint16 usage = 0;
int row = 0;
int column = 0;
int rowSpan = 1;
int columnSpan = 1;
APP_KeyTone tone = APP_KeyTone::Normal;
};
class APP_KeypadModel
{
public:
APP_KeypadModel();
const QVector<APP_KeyInfo>& App_Func_GetKeyList() const;
bool App_Func_IsLatched(const QString& KeyId) const;
bool App_Func_IsPressed(const QString& KeyId) const;
quint16 App_Func_GetUsageFromKeyId(const QString& KeyId) const;
2026-04-17 16:25:19 +08:00
QString App_Func_GetKeyIdFromUsage(quint16 Usage) const;
QString App_Func_GetDefaultHint(const QString& KeyId) const;
2026-03-26 10:45:29 +08:00
void App_Func_SetNumLockOn(bool IsOn);
void App_Func_ClearPressedKeys();
void App_Func_SetPressedKeysFromUsageList(const QVector<quint16>& UsageList);
private:
QVector<APP_KeyInfo> appKeyList;
QStringList appPressedKeyIdList;
bool appNumLockOn = false;
};
} // namespace APP