CountryInput::CountryInput(QWidget *parent, const style::countryInput &st) : QWidget(parent), _st(st), _active(false), _text(lang(lng_country_code)), _select(0) { initCountries(); resize(_st.width, _st.height + _st.ptrSize.height()); QImage trImage(_st.ptrSize.width(), _st.ptrSize.height(), QImage::Format_ARGB32_Premultiplied); { static const QPoint trPoints[3] = { QPoint(0, 0), QPoint(_st.ptrSize.width(), 0), QPoint(qCeil(trImage.width() / 2.), trImage.height()) }; QPainter p(&trImage); p.setRenderHint(QPainter::Antialiasing); p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(0, 0, trImage.width(), trImage.height(), st::transparent->b); p.setPen(Qt::NoPen); p.setBrush(_st.bgColor->b); p.drawPolygon(trPoints, 3); } _arrow = QPixmap::fromImage(trImage); _inner = QRect(0, 0, _st.width, _st.height); _arrowRect = QRect((st::inpIntroCountryCode.width - _arrow.width() - 1) / 2, _st.height, _arrow.width(), _arrow.height()); }
const CountriesByISO2 &countriesByISO2() { initCountries(); return _countriesByISO2; }
const CountriesByCode &countriesByCode() { initCountries(); return _countriesByCode; }