Move test data to example class
This commit is contained in:
parent
5f52329c59
commit
aef66be2ed
|
@ -51,70 +51,6 @@ void QtMaterialAutoCompletePrivate::init()
|
|||
menuLayout->setSpacing(0);
|
||||
|
||||
QObject::connect(q, SIGNAL(textChanged(QString)), q, SLOT(updateResults(QString)));
|
||||
|
||||
//
|
||||
|
||||
QStringList states =
|
||||
{ "Alabama"
|
||||
, "Alaska"
|
||||
, "American Samoa"
|
||||
, "Arizona"
|
||||
, "Arkansas"
|
||||
, "California"
|
||||
, "Colorado"
|
||||
, "Connecticut"
|
||||
, "Delaware"
|
||||
, "District of Columbia"
|
||||
, "Florida"
|
||||
, "Georgia"
|
||||
, "Guam"
|
||||
, "Hawaii"
|
||||
, "Idaho"
|
||||
, "Illinois"
|
||||
, "Indiana"
|
||||
, "Iowa"
|
||||
, "Kansas"
|
||||
, "Kentucky"
|
||||
, "Louisiana"
|
||||
, "Maine"
|
||||
, "Maryland"
|
||||
, "Massachusetts"
|
||||
, "Michigan"
|
||||
, "Minnesota"
|
||||
, "Mississippi"
|
||||
, "Missouri"
|
||||
, "Montana"
|
||||
, "Nebraska"
|
||||
, "Nevada"
|
||||
, "New Hampshire"
|
||||
, "New Jersey"
|
||||
, "New Mexico"
|
||||
, "New York"
|
||||
, "North Carolina"
|
||||
, "North Dakota"
|
||||
, "Northern Marianas Islands"
|
||||
, "Ohio"
|
||||
, "Oklahoma"
|
||||
, "Oregon"
|
||||
, "Pennsylvania"
|
||||
, "Puerto Rico"
|
||||
, "Rhode Island"
|
||||
, "South Carolina"
|
||||
, "South Dakota"
|
||||
, "Tennessee"
|
||||
, "Texas"
|
||||
, "Utah"
|
||||
, "Vermont"
|
||||
, "Virginia"
|
||||
, "Virgin Islands"
|
||||
, "Washington"
|
||||
, "West Virginia"
|
||||
, "Wisconsin"
|
||||
, "Wyoming"
|
||||
};
|
||||
foreach (QString state, states) {
|
||||
dataSource.push_back(state);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -131,6 +67,14 @@ QtMaterialAutoComplete::~QtMaterialAutoComplete()
|
|||
{
|
||||
}
|
||||
|
||||
void QtMaterialAutoComplete::setDataSource(const QStringList &data)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
|
||||
d->dataSource = data;
|
||||
update();
|
||||
}
|
||||
|
||||
void QtMaterialAutoComplete::updateResults(QString text)
|
||||
{
|
||||
Q_D(QtMaterialAutoComplete);
|
||||
|
|
|
@ -13,6 +13,8 @@ public:
|
|||
explicit QtMaterialAutoComplete(QWidget *parent = 0);
|
||||
~QtMaterialAutoComplete();
|
||||
|
||||
void setDataSource(const QStringList &data);
|
||||
|
||||
protected slots:
|
||||
void updateResults(QString text);
|
||||
|
||||
|
|
|
@ -30,6 +30,66 @@ AutoCompleteSettingsEditor::AutoCompleteSettingsEditor(QWidget *parent)
|
|||
layout = new QVBoxLayout;
|
||||
canvas->setLayout(layout);
|
||||
|
||||
QStringList states =
|
||||
{ "Alabama"
|
||||
, "Alaska"
|
||||
, "American Samoa"
|
||||
, "Arizona"
|
||||
, "Arkansas"
|
||||
, "California"
|
||||
, "Colorado"
|
||||
, "Connecticut"
|
||||
, "Delaware"
|
||||
, "District of Columbia"
|
||||
, "Florida"
|
||||
, "Georgia"
|
||||
, "Guam"
|
||||
, "Hawaii"
|
||||
, "Idaho"
|
||||
, "Illinois"
|
||||
, "Indiana"
|
||||
, "Iowa"
|
||||
, "Kansas"
|
||||
, "Kentucky"
|
||||
, "Louisiana"
|
||||
, "Maine"
|
||||
, "Maryland"
|
||||
, "Massachusetts"
|
||||
, "Michigan"
|
||||
, "Minnesota"
|
||||
, "Mississippi"
|
||||
, "Missouri"
|
||||
, "Montana"
|
||||
, "Nebraska"
|
||||
, "Nevada"
|
||||
, "New Hampshire"
|
||||
, "New Jersey"
|
||||
, "New Mexico"
|
||||
, "New York"
|
||||
, "North Carolina"
|
||||
, "North Dakota"
|
||||
, "Northern Marianas Islands"
|
||||
, "Ohio"
|
||||
, "Oklahoma"
|
||||
, "Oregon"
|
||||
, "Pennsylvania"
|
||||
, "Puerto Rico"
|
||||
, "Rhode Island"
|
||||
, "South Carolina"
|
||||
, "South Dakota"
|
||||
, "Tennessee"
|
||||
, "Texas"
|
||||
, "Utah"
|
||||
, "Vermont"
|
||||
, "Virginia"
|
||||
, "Virgin Islands"
|
||||
, "Washington"
|
||||
, "West Virginia"
|
||||
, "Wisconsin"
|
||||
, "Wyoming"
|
||||
};
|
||||
|
||||
m_autocomplete->setDataSource(states);
|
||||
|
||||
/*
|
||||
Xyz *xyz = new Xyz(m_autocomplete);
|
||||
|
|
Loading…
Reference in New Issue