#ifndef QIPLINEEDIT_H
#define QIPLINEEDIT_H

#include <QLineEdit>
#include <QEvent>
#include <QHBoxLayout>
#define SPACE 5

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);
//    virtual void keyPressEvent(QKeyEvent *e);
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
