qt_demoe/control/ipaddress/ipaddress.h

75 lines
1.7 KiB
C
Raw Normal View History

2019-10-10 05:42:12 +00:00
#ifndef IPADDRESS_H
#define IPADDRESS_H
/**
2021-09-26 01:50:09 +00:00
* IP :feiyangqingyun(QQ:517216493) 2017-08-11
2021-09-13 08:12:35 +00:00
* 1. IP
* 2. IP
* 3.
* 4. 退
* 5. IP
* 6.
2019-10-10 05:42:12 +00:00
*/
#include <QWidget>
class QLabel;
class QLineEdit;
#ifdef quc
2020-12-24 10:00:09 +00:00
class Q_DECL_EXPORT IPAddress : public QWidget
2019-10-10 05:42:12 +00:00
#else
class IPAddress : public QWidget
#endif
{
Q_OBJECT
2021-05-30 07:59:42 +00:00
2019-10-10 05:42:12 +00:00
Q_PROPERTY(QString ip READ getIP WRITE setIP)
public:
explicit IPAddress(QWidget *parent = 0);
protected:
bool eventFilter(QObject *watched, QEvent *event);
private:
QLabel *labDot1; //第一个小圆点
QLabel *labDot2; //第二个小圆点
QLabel *labDot3; //第三个小圆点
QLineEdit *txtIP1; //IP地址网段输入框1
QLineEdit *txtIP2; //IP地址网段输入框2
QLineEdit *txtIP3; //IP地址网段输入框3
QLineEdit *txtIP4; //IP地址网段输入框4
QString ip; //IP地址
QString bgColor; //背景颜色
QString borderColor;//边框颜色
int borderRadius; //边框圆角角度
private slots:
void textChanged(const QString &text);
public:
2023-09-08 05:51:39 +00:00
//默认尺寸和最小尺寸
QSize sizeHint() const;
QSize minimumSizeHint() const;
2019-10-10 05:42:12 +00:00
2023-09-08 05:51:39 +00:00
//获取和设置IP地址
QString getIP() const;
2019-10-10 05:42:12 +00:00
void setIP(const QString &ip);
2023-09-08 05:51:39 +00:00
2019-10-10 05:42:12 +00:00
//清空
void clear();
//设置背景颜色
void setBgColor(const QString &bgColor);
//设置边框颜色
void setBorderColor(const QString &borderColor);
//设置边框圆角角度
void setBorderRadius(int borderRadius);
};
#endif // IPADDRESS_H