DtkWidget
DTK Widget module
载入中...
搜索中...
未找到
dipv4lineedit.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DIPV4LINEEDIT_H
6#define DIPV4LINEEDIT_H
7
8#include <dtkwidget_global.h>
9#include <DObject>
10
11#include <QLineEdit>
12
13DWIDGET_BEGIN_NAMESPACE
14
15class DIpv4LineEditPrivate;
16class LIBDTKWIDGETSHARED_EXPORT DIpv4LineEdit : public QLineEdit, public DCORE_NAMESPACE::DObject
17{
18 Q_OBJECT
19
20 Q_DISABLE_COPY(DIpv4LineEdit)
21 D_DECLARE_PRIVATE(DIpv4LineEdit)
22 Q_PROPERTY(QString displayText READ displayText)
23 Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition)
24 Q_PROPERTY(Qt::Alignment alignment READ alignment)
25 Q_PROPERTY(QString selectedText READ selectedText)
26 Q_PROPERTY(bool acceptableInput READ hasAcceptableInput)
27 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
28 Q_PROPERTY(QString placeholderText READ placeholderText)
29 Q_PROPERTY(bool clearButtonEnabled READ isClearButtonEnabled)
30
31public:
32 explicit DIpv4LineEdit(QWidget *parent = 0);
33
34 QString displayText() const;
35 int cursorPosition() const;
36 Qt::Alignment alignment() const;
37 bool hasAcceptableInput() const;
38 bool isReadOnly() const;
39
40public Q_SLOTS:
41 void setCursorPosition(int cursorPosition);
42 void setReadOnly(bool readOnly);
43 void setSelection(int start, int length);
44 void selectAll();
45
46Q_SIGNALS:
47 void focusChanged(bool focus);
48
49protected:
50 bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE;
51
52private:
53 DIpv4LineEdit(DIpv4LineEditPrivate &q, QWidget *parent);
54 void setPlaceholderText(QString placeholderText);
55 void setClearButtonEnabled(bool clearButtonEnabled);
56
57 Q_PRIVATE_SLOT(d_func(), void _q_updateLineEditText())
58 Q_PRIVATE_SLOT(d_func(), void _q_setIpLineEditText(const QString &))
59
60protected:
61 void resizeEvent(QResizeEvent *event) override;
62};
63
64DWIDGET_END_NAMESPACE
65
66#endif // DIPV4LINEEDIT_H
Definition dipv4lineedit_p.h:16
类DIpv4LineEdit是专门用于输入ipv4格式文本的编辑框.
Definition dipv4lineedit.h:17