move "AutoComplete" classes into "md" namespace.
This commit is contained in:
parent
31a4a59a3f
commit
14f4403bce
|
@ -9,6 +9,8 @@
|
|||
#include "qtmaterialautocomplete_internal.h"
|
||||
#include "qtmaterialflatbutton.h"
|
||||
|
||||
namespace md
|
||||
{
|
||||
/*!
|
||||
* \class QtMaterialAutoCompletePrivate
|
||||
* \internal
|
||||
|
@ -17,28 +19,28 @@
|
|||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompletePrivate::QtMaterialAutoCompletePrivate(QtMaterialAutoComplete *q)
|
||||
: QtMaterialTextFieldPrivate(q)
|
||||
AutoCompletePrivate::AutoCompletePrivate(AutoComplete *q)
|
||||
: TextFieldPrivate(q)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompletePrivate::~QtMaterialAutoCompletePrivate()
|
||||
AutoCompletePrivate::~AutoCompletePrivate()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
* \internal
|
||||
*/
|
||||
void QtMaterialAutoCompletePrivate::init()
|
||||
void AutoCompletePrivate::init()
|
||||
{
|
||||
Q_Q(QtMaterialAutoComplete);
|
||||
Q_Q(AutoComplete);
|
||||
|
||||
menu = new QWidget;
|
||||
frame = new QWidget;
|
||||
stateMachine = new QtMaterialAutoCompleteStateMachine(menu);
|
||||
stateMachine = new AutoCompleteStateMachine(menu);
|
||||
menuLayout = new QVBoxLayout;
|
||||
maxWidth = 0;
|
||||
|
||||
|
@ -71,27 +73,27 @@ void QtMaterialAutoCompletePrivate::init()
|
|||
* \class QtMaterialAutoComplete
|
||||
*/
|
||||
|
||||
QtMaterialAutoComplete::QtMaterialAutoComplete(QWidget *parent)
|
||||
: QtMaterialTextField(*new QtMaterialAutoCompletePrivate(this), parent)
|
||||
AutoComplete::AutoComplete(QWidget *parent)
|
||||
: TextField(*new AutoCompletePrivate(this), parent)
|
||||
{
|
||||
d_func()->init();
|
||||
}
|
||||
|
||||
QtMaterialAutoComplete::~QtMaterialAutoComplete()
|
||||
AutoComplete::~AutoComplete()
|
||||
{
|
||||
}
|
||||
|
||||
void QtMaterialAutoComplete::setDataSource(const QStringList &data)
|
||||
void AutoComplete::setDataSource(const QStringList &data)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
Q_D(AutoComplete);
|
||||
|
||||
d->dataSource = data;
|
||||
update();
|
||||
}
|
||||
|
||||
void QtMaterialAutoComplete::updateResults(QString text)
|
||||
void AutoComplete::updateResults(QString text)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
Q_D(AutoComplete);
|
||||
|
||||
QStringList results;
|
||||
QString trimmed(text.trimmed());
|
||||
|
@ -156,9 +158,9 @@ void QtMaterialAutoComplete::updateResults(QString text)
|
|||
d->menu->update();
|
||||
}
|
||||
|
||||
bool QtMaterialAutoComplete::QtMaterialAutoComplete::event(QEvent *event)
|
||||
bool AutoComplete::AutoComplete::event(QEvent *event)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
Q_D(AutoComplete);
|
||||
|
||||
switch (event->type())
|
||||
{
|
||||
|
@ -178,12 +180,12 @@ bool QtMaterialAutoComplete::QtMaterialAutoComplete::event(QEvent *event)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return QtMaterialTextField::event(event);
|
||||
return TextField::event(event);
|
||||
}
|
||||
|
||||
bool QtMaterialAutoComplete::eventFilter(QObject *watched, QEvent *event)
|
||||
bool AutoComplete::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
Q_D(AutoComplete);
|
||||
|
||||
if (d->frame == watched)
|
||||
{
|
||||
|
@ -238,5 +240,7 @@ bool QtMaterialAutoComplete::eventFilter(QObject *watched, QEvent *event)
|
|||
break;
|
||||
}
|
||||
}
|
||||
return QtMaterialTextField::eventFilter(watched, event);
|
||||
return TextField::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,15 +3,18 @@
|
|||
|
||||
#include "qtmaterialtextfield.h"
|
||||
|
||||
class QtMaterialAutoCompletePrivate;
|
||||
namespace md
|
||||
{
|
||||
|
||||
class QtMaterialAutoComplete : public QtMaterialTextField
|
||||
class AutoCompletePrivate;
|
||||
|
||||
class AutoComplete : public TextField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtMaterialAutoComplete(QWidget *parent = 0);
|
||||
~QtMaterialAutoComplete();
|
||||
explicit AutoComplete(QWidget *parent = 0);
|
||||
~AutoComplete();
|
||||
|
||||
void setDataSource(const QStringList &data);
|
||||
|
||||
|
@ -26,8 +29,10 @@ protected:
|
|||
bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtMaterialAutoComplete)
|
||||
Q_DECLARE_PRIVATE(QtMaterialAutoComplete)
|
||||
Q_DISABLE_COPY(AutoComplete)
|
||||
Q_DECLARE_PRIVATE(AutoComplete)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QTMATERIALAUTOCOMPLETE_H
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <QtWidgets/QGraphicsOpacityEffect>
|
||||
#include <QDebug>
|
||||
|
||||
namespace md
|
||||
{
|
||||
/*!
|
||||
* \class QtMaterialAutoCompleteStateMachine
|
||||
* \internal
|
||||
|
@ -12,7 +14,7 @@
|
|||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompleteStateMachine::QtMaterialAutoCompleteStateMachine(QWidget *menu)
|
||||
AutoCompleteStateMachine::AutoCompleteStateMachine(QWidget *menu)
|
||||
: QStateMachine(menu),
|
||||
m_menu(menu),
|
||||
m_closedState(new QState),
|
||||
|
@ -64,6 +66,8 @@ QtMaterialAutoCompleteStateMachine::QtMaterialAutoCompleteStateMachine(QWidget *
|
|||
/*!
|
||||
* \internal
|
||||
*/
|
||||
QtMaterialAutoCompleteStateMachine::~QtMaterialAutoCompleteStateMachine()
|
||||
AutoCompleteStateMachine::~AutoCompleteStateMachine()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,16 @@
|
|||
#include <QStateMachine>
|
||||
#include "qtmaterialautocomplete.h"
|
||||
|
||||
class QtMaterialAutoCompleteStateMachine : public QStateMachine
|
||||
namespace md
|
||||
{
|
||||
|
||||
class AutoCompleteStateMachine : public QStateMachine
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtMaterialAutoCompleteStateMachine(QWidget *menu);
|
||||
~QtMaterialAutoCompleteStateMachine();
|
||||
explicit AutoCompleteStateMachine(QWidget *menu);
|
||||
~AutoCompleteStateMachine();
|
||||
|
||||
signals:
|
||||
void shouldOpen();
|
||||
|
@ -18,7 +21,7 @@ signals:
|
|||
void shouldFade();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QtMaterialAutoCompleteStateMachine)
|
||||
Q_DISABLE_COPY(AutoCompleteStateMachine)
|
||||
|
||||
QWidget *const m_menu;
|
||||
QState *const m_closedState;
|
||||
|
@ -26,4 +29,6 @@ private:
|
|||
QState *const m_closingState;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QTMATERIALAUTOCOMPLETESTATEMACHINE_H
|
||||
|
|
|
@ -3,28 +3,33 @@
|
|||
|
||||
#include "qtmaterialtextfield_p.h"
|
||||
|
||||
namespace md
|
||||
{
|
||||
|
||||
class QWidget;
|
||||
class QVBoxLayout;
|
||||
class QtMaterialAutoCompleteOverlay;
|
||||
class QtMaterialAutoCompleteStateMachine;
|
||||
class AutoCompleteOverlay;
|
||||
class AutoCompleteStateMachine;
|
||||
|
||||
class QtMaterialAutoCompletePrivate : public QtMaterialTextFieldPrivate
|
||||
class AutoCompletePrivate : public TextFieldPrivate
|
||||
{
|
||||
Q_DISABLE_COPY(QtMaterialAutoCompletePrivate)
|
||||
Q_DECLARE_PUBLIC(QtMaterialAutoComplete)
|
||||
Q_DISABLE_COPY(AutoCompletePrivate)
|
||||
Q_DECLARE_PUBLIC(AutoComplete)
|
||||
|
||||
public:
|
||||
QtMaterialAutoCompletePrivate(QtMaterialAutoComplete *q);
|
||||
virtual ~QtMaterialAutoCompletePrivate();
|
||||
AutoCompletePrivate(AutoComplete *q);
|
||||
virtual ~AutoCompletePrivate();
|
||||
|
||||
void init();
|
||||
|
||||
QWidget *menu;
|
||||
QWidget *frame;
|
||||
QtMaterialAutoCompleteStateMachine *stateMachine;
|
||||
AutoCompleteStateMachine *stateMachine;
|
||||
QVBoxLayout *menuLayout;
|
||||
QStringList dataSource;
|
||||
int maxWidth;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // QTMATERIALAUTOCOMPLETE_P_H
|
||||
|
|
Loading…
Reference in New Issue