refactoring qad widgets part 2
c++ cast, nullptr, forward declaration, agregate ui, connect to member functions, order and clear includes
This commit is contained in:
@@ -20,13 +20,13 @@
|
||||
#ifndef QIPEDIT_H
|
||||
#define QIPEDIT_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QBoxLayout>
|
||||
#include <QIntValidator>
|
||||
#include <QFocusEvent>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include "qad_widgets_export.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class QBoxLayout;
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
|
||||
|
||||
class QAD_WIDGETS_EXPORT QIPEdit: public QWidget
|
||||
@@ -35,19 +35,9 @@ class QAD_WIDGETS_EXPORT QIPEdit: public QWidget
|
||||
Q_PROPERTY(QString IP READ IP WRITE setIP)
|
||||
|
||||
public:
|
||||
QIPEdit(QWidget * parent = 0, const QString & ip = "");
|
||||
~QIPEdit();
|
||||
QIPEdit(QWidget * parent = nullptr, const QString & ip = "");
|
||||
|
||||
QString IP();
|
||||
|
||||
private:
|
||||
void returnPress(int index);
|
||||
inline void textChange(int index, const QString & text) {if (text.length() == 3 && isVisible()) returnPress(index); emit valueChanged(IP());}
|
||||
|
||||
int cind;
|
||||
QBoxLayout * layout;
|
||||
QVector<QLineEdit * > edits;
|
||||
QVector<QLabel * > dots;
|
||||
|
||||
public slots:
|
||||
void setIP(const QString & text);
|
||||
@@ -64,6 +54,15 @@ private slots:
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user