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