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

Allow date edition in passport.

This commit is contained in:
John Preston
2018-04-10 20:22:27 +04:00
parent e4e05a14b7
commit 9903546a2d
7 changed files with 549 additions and 6 deletions

View File

@@ -1530,7 +1530,11 @@ void InputField::paintEvent(QPaintEvent *e) {
auto placeholderLeft = anim::interpolate(0, -_st.placeholderShift, placeholderHiddenDegree);
p.setFont(_st.font);
QRect r(rect().marginsRemoved(_st.textMargins + _st.placeholderMargins));
r.moveLeft(r.left() + placeholderLeft);
if (rtl()) r.moveLeft(width() - r.left() - r.width());
p.setFont(_st.placeholderFont);
p.setPen(anim::pen(_st.placeholderFg, _st.placeholderFgActive, focusedDegree));
if (_st.placeholderAlign == style::al_topleft && _placeholderAfterSymbols > 0) {
@@ -1581,7 +1585,9 @@ void InputField::startBorderAnimation() {
}
void InputField::focusInEvent(QFocusEvent *e) {
_borderAnimationStart = (e->reason() == Qt::MouseFocusReason) ? mapFromGlobal(QCursor::pos()).x() : (width() / 2);
_borderAnimationStart = (e->reason() == Qt::MouseFocusReason)
? mapFromGlobal(QCursor::pos()).x()
: (width() / 2);
QTimer::singleShot(0, this, SLOT(onFocusInner()));
}
@@ -1596,6 +1602,10 @@ void InputField::onFocusInner() {
_borderAnimationStart = borderStart;
}
int InputField::borderAnimationStart() const {
return _borderAnimationStart;
}
void InputField::contextMenuEvent(QContextMenuEvent *e) {
_inner->contextMenuEvent(e);
}
@@ -3374,6 +3384,10 @@ void MaskedInputField::customUpDown(bool custom) {
_customUpDown = custom;
}
int MaskedInputField::borderAnimationStart() const {
return _borderAnimationStart;
}
void MaskedInputField::setTextMargins(const QMargins &mrg) {
_textMargins = mrg;
refreshPlaceholder();
@@ -3505,7 +3519,7 @@ void MaskedInputField::paintEvent(QPaintEvent *e) {
r.moveLeft(r.left() + placeholderLeft);
if (rtl()) r.moveLeft(width() - r.left() - r.width());
p.setFont(_st.font);
p.setFont(_st.placeholderFont);
p.setPen(anim::pen(_st.placeholderFg, _st.placeholderFgActive, focusedDegree));
p.drawText(r, _placeholder, _st.placeholderAlign);

View File

@@ -261,6 +261,7 @@ public:
void setSubmitSettings(SubmitSettings settings);
void customUpDown(bool isCustom);
void customTab(bool isCustom);
int borderAnimationStart() const;
not_null<QTextDocument*> document();
not_null<const QTextDocument*> document() const;
@@ -493,6 +494,8 @@ public:
QSize minimumSizeHint() const override;
void customUpDown(bool isCustom);
int borderAnimationStart() const;
const QString &getLastText() const {
return _oldtext;
}