qt/LedOK/base/qiplineedit.h
2023-04-18 14:14:46 +08:00

38 lines
931 B
C++

#ifndef QIPLINEEDIT_H
#define QIPLINEEDIT_H
#include <QLineEdit>
#include <QEvent>
#include <QHBoxLayout>
class QIPLineEdit : public QLineEdit {
Q_OBJECT
public:
QIPLineEdit(QWidget *parent = nullptr);
~QIPLineEdit();
void setText(const QString &strIP);
QString text() const;
void MyClear();
void MySetColor(QColor cr);
protected:
void paintEvent(QPaintEvent *event);
bool eventFilter(QObject *obj, QEvent *ev);
int getIndex(QLineEdit *pEdit);
bool isTextValid(const QString &strIP);
protected slots:
void OnLineEdit1TextChanged(const QString & strtemp);
void OnLineEdit2TextChanged(const QString & strtemp);
void OnLineEdit3TextChanged(const QString & strtemp);
void OnLineEdit4TextChanged(const QString & strtemp);
private:
QLineEdit *m_lineEidt[4];
QHBoxLayout *pHBox;
QColor m_Color;
};
#endif // QIPLINEEDIT_H