Files
qad/libs/widgets/qipedit.h
Andrey 4497123421 refactoring qad widgets part 2
c++ cast, nullptr, forward declaration, agregate ui, connect to member functions, order and clear includes
2022-12-12 10:18:34 +03:00

69 lines
1.8 KiB
C++

/*
QAD - Qt ADvanced
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QIPEDIT_H
#define QIPEDIT_H
#include "qad_widgets_export.h"
#include <QWidget>
class QBoxLayout;
class QLineEdit;
class QLabel;
class QAD_WIDGETS_EXPORT QIPEdit: public QWidget
{
Q_OBJECT
Q_PROPERTY(QString IP READ IP WRITE setIP)
public:
QIPEdit(QWidget * parent = nullptr, const QString & ip = "");
QString IP();
public slots:
void setIP(const QString & text);
private slots:
void returnPressed0() {returnPress(0);}
void returnPressed1() {returnPress(1);}
void returnPressed2() {returnPress(2);}
void returnPressed3() {returnPress(3);}
void textChanged0(const QString & text) {textChange(0, text);}
void textChanged1(const QString & text) {textChange(1, text);}
void textChanged2(const QString & text) {textChange(2, text);}
void textChanged3(const QString & text) {textChange(3, text);}
signals:
void valueChanged(QString);
private:
void returnPress(int index);
void textChange(int index, const QString &text);
int cind;
QBoxLayout * layout;
QList<QLineEdit * > edits;
QList<QLabel * > dots;
};
#endif // QIPEDIT_H