mirror of
https://github.com/vale981/tdesktop
synced 2025-03-08 19:21:39 -05:00
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
/*
|
|
This file is part of Telegram Desktop,
|
|
the official desktop application for the Telegram messaging service.
|
|
|
|
For license and copyright information please follow this link:
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
*/
|
|
#include "passport/passport_panel_details_row.h"
|
|
|
|
#include "ui/widgets/input_fields.h"
|
|
#include "styles/style_passport.h"
|
|
|
|
namespace Passport {
|
|
|
|
PanelDetailsRow::PanelDetailsRow(
|
|
QWidget *parent,
|
|
const QString &label,
|
|
const QString &value)
|
|
: _label(label)
|
|
, _field(this, st::passportDetailsField, nullptr, value) {
|
|
}
|
|
|
|
QPointer<Ui::InputField> PanelDetailsRow::field() const {
|
|
return _field.data();
|
|
}
|
|
|
|
int PanelDetailsRow::resizeGetHeight(int newWidth) {
|
|
const auto padding = st::passportDetailsPadding;
|
|
const auto inputLeft = padding.left() + st::passportDetailsFieldLeft;
|
|
const auto inputTop = st::passportDetailsFieldTop;
|
|
const auto inputRight = padding.right();
|
|
const auto inputWidth = std::max(newWidth - inputLeft - inputRight, 0);
|
|
_field->setGeometry(inputLeft, inputTop, inputWidth, _field->height());
|
|
return padding.top() + st::semiboldFont->height + padding.bottom();
|
|
}
|
|
|
|
void PanelDetailsRow::paintEvent(QPaintEvent *e) {
|
|
Painter p(this);
|
|
|
|
p.setFont(st::semiboldFont);
|
|
p.setPen(st::passportDetailsField.placeholderFg);
|
|
const auto padding = st::passportDetailsPadding;
|
|
p.drawTextLeft(padding.left(), padding.top(), width(), _label);
|
|
}
|
|
|
|
} // namespace Passport
|