You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
1.4 KiB
79 lines
1.4 KiB
#ifndef NUMKEYDIA_H
|
|
#define NUMKEYDIA_H
|
|
|
|
#include "NumKeyBoard_global.h"
|
|
#include <QDialog>
|
|
#include <QLineEdit>
|
|
|
|
class QPushButton;
|
|
|
|
namespace Ui
|
|
{
|
|
class NumKeyDia;
|
|
}
|
|
|
|
class NUMKEYBOARD_EXPORT NumKeyDia : public QDialog
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit NumKeyDia(QWidget *parent = nullptr);
|
|
~NumKeyDia();
|
|
|
|
static NumKeyDia *instance()
|
|
{
|
|
return singleton;
|
|
}
|
|
|
|
void setValue(const QString &value);
|
|
QString &getValue();
|
|
|
|
protected:
|
|
virtual bool eventFilter(QObject *obj, QEvent *event) override;
|
|
|
|
private slots:
|
|
void on_btn_ok_clicked();
|
|
|
|
void on_btn_cancel_clicked();
|
|
|
|
void on_btn_clear_clicked();
|
|
|
|
void on_btn_back_clicked();
|
|
|
|
void btn_input_clicked();
|
|
|
|
void closeKeyBoard();
|
|
|
|
private:
|
|
enum class InputPage
|
|
{
|
|
NumberPage,
|
|
SymbolPage
|
|
};
|
|
|
|
void setInputPage(InputPage page);
|
|
void refreshInputButtons();
|
|
void configureInputButton(QPushButton *button,
|
|
const QString &label,
|
|
const QString &value,
|
|
bool enabled,
|
|
bool isModeSwitch = false);
|
|
|
|
Ui::NumKeyDia *ui;
|
|
|
|
static NumKeyDia *singleton;
|
|
|
|
QString value = QString();
|
|
|
|
QPoint m_point;
|
|
|
|
bool m_firstInputFlag = true;
|
|
InputPage m_inputPage = InputPage::NumberPage;
|
|
};
|
|
|
|
namespace KeyBoard
|
|
{
|
|
NUMKEYBOARD_EXPORT NumKeyDia *app();
|
|
};
|
|
|
|
#endif // NUMKEYDIA_H
|
|
|