8 #include "ui_countryselector.h"
20 CCountrySelector::CCountrySelector(QWidget *parent) : QFrame(parent), ui(new Ui::
CCountrySelector)
22 Q_ASSERT_X(
sGui, Q_FUNC_INFO,
"Missing sGui");
27 &CCountrySelector::onCountriesLoaded);
28 connect(ui->cb_Country, &QComboBox::currentTextChanged,
this, &CCountrySelector::onCountryNameChanged);
29 connect(ui->le_Iso, &QLineEdit::editingFinished,
this, &CCountrySelector::onIsoChanged);
31 this->onCountriesLoaded();
38 if (country == m_current) {
return; }
41 if (country.
getName() != ui->cb_Country->currentText()) { ui->cb_Country->setCurrentText(country.
getName()); }
45 void CCountrySelector::onCountriesLoaded()
50 ui->le_Iso->setCompleter(
new QCompleter(countries.
toIsoList(
true)));
51 ui->cb_Country->clear();
52 ui->cb_Country->addItems(countries.
toNameList(
true));
55 void CCountrySelector::onIsoChanged()
58 const QString iso(ui->le_Iso->text().trimmed().toUpper());
63 void CCountrySelector::onCountryNameChanged(
const QString &name)
66 if (m_current.
getName() == name) {
return; }
bool hasWebDataServices() const
Web data services available?
CWebDataServices * getWebDataServices() const
Get the web data services.
swift::misc::CCountryList getCountries() const
Countries.
swift::misc::CCountry getCountryForIsoCode(const QString &iso) const
Country by ISO code (GB, US...)
swift::misc::CCountry getCountryForName(const QString &name) const
Country by name (France, China ..)
virtual ~CCountrySelector()
Destructor.
void countryChanged(const swift::misc::CCountry &country)
Changed country.
void setCountry(const swift::misc::CCountry &country)
Set country.
const QString & getName() const
Country name.
const QString & getIsoCode() const
DB ISO code.
Value object encapsulating a list of countries.
QStringList toNameList(bool sorted=false) const
Name string list.
QStringList toIsoList(bool sorted=false) const
All ISO codes.
SWIFT_GUI_EXPORT swift::gui::CGuiApplication * sGui
Single instance of GUI application object.
Backend services of the swift project, like dealing with the network or the simulators.
High level reusable GUI components.
Free functions in swift::misc.