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:
@@ -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();
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user