2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Allow selecting country in passport.

This commit is contained in:
John Preston
2018-04-10 15:26:21 +04:00
parent 62389f5ef7
commit e4e05a14b7
11 changed files with 417 additions and 32 deletions

View File

@@ -35,8 +35,12 @@ int LinkButton::naturalWidth() const {
void LinkButton::paintEvent(QPaintEvent *e) {
Painter p(this);
auto &font = (isOver() ? _st.overFont : _st.font);
auto &pen = (isOver() ? _st.overColor : _st.color);
const auto &font = (isOver() ? _st.overFont : _st.font);
const auto pen = _textFgOverride.has_value()
? QPen(*_textFgOverride)
: isOver()
? _st.overColor
: _st.color;
p.setFont(font);
p.setPen(pen);
const auto left = _st.padding.left();
@@ -56,6 +60,11 @@ void LinkButton::setText(const QString &text) {
update();
}
void LinkButton::setColorOverride(base::optional<QColor> textFg) {
_textFgOverride = textFg;
update();
}
void LinkButton::onStateChanged(State was, StateChangeSource source) {
update();
}

View File

@@ -24,6 +24,7 @@ public:
int naturalWidth() const override;
void setText(const QString &text);
void setColorOverride(base::optional<QColor> textFg);
protected:
void paintEvent(QPaintEvent *e) override;
@@ -34,6 +35,7 @@ private:
const style::LinkButton &_st;
QString _text;
int _textWidth = 0;
base::optional<QColor> _textFgOverride;
};