44 lines
871 B
C++
Executable File
44 lines
871 B
C++
Executable File
#pragma once
|
|
|
|
#include <QLineEdit>
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
|
|
class LineEdit : public QLineEdit
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
using QLineEdit::QLineEdit;
|
|
|
|
void clear();
|
|
bool isEmpty() const;
|
|
protected:
|
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
|
void focusOutEvent(QFocusEvent *event) override;
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
Q_SIGNALS:
|
|
void focusOutBackspace();
|
|
void focusOut();
|
|
};
|
|
|
|
class DigitsLineEdit final : public LineEdit
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
DigitsLineEdit(QWidget *parent = nullptr);
|
|
|
|
void setExactNumDigits(int num);
|
|
void setCursorPosition(int curPos);
|
|
void setValue(int val);
|
|
int getValue() const;
|
|
Q_SIGNALS:
|
|
void wheelEventReceived(bool bForward, int cursorPos);
|
|
protected:
|
|
void wheelEvent(QWheelEvent *event) override;
|
|
void keyPressEvent(QKeyEvent *event) override;
|
|
private:
|
|
int m_exactNumDigits = -1;
|
|
};
|
|
}
|