Remove some FixedHeightWidget-s.

This commit is contained in:
John Preston
2025-08-22 12:56:51 +04:00
parent 7d7df4f749
commit 687bfd0f17
5 changed files with 39 additions and 87 deletions
+2 -11
View File
@@ -641,20 +641,11 @@ void ChangeSetNameBox(
const auto it = sets.find(input.id);
return (it == sets.end()) ? QString() : it->second->title;
}();
const auto wrap = box->addRow(object_ptr<Ui::FixedHeightWidget>(
const auto field = box->addRow(object_ptr<Ui::InputField>(
box,
st::editStickerSetNameField.heightMin));
auto owned = object_ptr<Ui::InputField>(
wrap,
st::editStickerSetNameField,
tr::lng_stickers_context_edit_name(),
wasName);
const auto field = owned.data();
wrap->widthValue() | rpl::start_with_next([=](int width) {
field->move(0, 0);
field->resize(width, field->height());
wrap->resize(width, field->height());
}, wrap->lifetime());
wasName));
field->selectAll();
constexpr auto kMaxSetNameLength = 50;
field->setMaxLength(kMaxSetNameLength);
@@ -488,8 +488,9 @@ not_null<Ui::RpWidget*> PanelEditDocument::setupContent(
}, lifetime());
}
inner->add(
object_ptr<Ui::FixedHeightWidget>(inner, st::passportDetailsSkip));
inner->add(object_ptr<Ui::FixedHeightWidget>(
inner,
st::passportDetailsSkip));
}
if (auto text = _controller->deleteValueLabel()) {
inner->add(
@@ -64,21 +64,13 @@ not_null<Ui::RpWidget*> PanelForm::setupContent() {
inner->resizeToWidth(width);
}, inner->lifetime());
const auto userpicWrap = inner->add(
object_ptr<Ui::FixedHeightWidget>(
inner,
st::passportFormUserpic.size.height()),
st::passportFormUserpicPadding);
_userpic = Ui::AttachParentChild(
userpicWrap,
_userpic = inner->add(
object_ptr<Ui::UserpicButton>(
userpicWrap,
inner,
bot,
st::passportFormUserpic));
userpicWrap->widthValue(
) | rpl::start_with_next([=](int width) {
_userpic->move((width - _userpic->width()) / 2, _userpic->y());
}, _userpic->lifetime());
st::passportFormUserpic),
st::passportFormUserpicPadding,
style::al_top);
_about1 = inner->add(
object_ptr<Ui::FlatLabel>(
@@ -418,48 +418,31 @@ void SessionInfoBox(
shown->fire({});
});
const auto userpicWrap = box->addRow(
object_ptr<Ui::FixedHeightWidget>(box, st::sessionBigUserpicSize),
st::sessionBigCoverPadding);
const auto big = GenerateUserpicBig(
userpicWrap,
box,
shown->events(),
TypeFromEntry(data));
userpicWrap->sizeValue(
) | rpl::start_with_next([=](QSize size) {
big->move((size.width() - big->width()) / 2, 0);
}, userpicWrap->lifetime());
big->setNaturalWidth(big->width());
box->addRow(
object_ptr<Ui::RpWidget>::fromRaw(big),
st::sessionBigCoverPadding,
style::al_top);
const auto nameWrap = box->addRow(
object_ptr<Ui::FixedHeightWidget>(
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
st::sessionBigName.maxHeight));
const auto name = Ui::CreateChild<Ui::FlatLabel>(
nameWrap,
rpl::single(data.name),
st::sessionBigName);
nameWrap->widthValue(
) | rpl::start_with_next([=](int width) {
name->resizeToWidth(width);
name->move((width - name->width()) / 2, 0);
}, name->lifetime());
rpl::single(data.name),
st::sessionBigName),
style::al_top);
const auto dateWrap = box->addRow(
object_ptr<Ui::FixedHeightWidget>(
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
st::sessionDateLabel.style.font->height),
style::margins(0, 0, 0, st::sessionDateSkip));
const auto date = Ui::CreateChild<Ui::FlatLabel>(
dateWrap,
rpl::single(
langDateTimeFull(base::unixtime::parse(data.activeTime))),
st::sessionDateLabel);
rpl::combine(
dateWrap->widthValue(),
date->widthValue()
) | rpl::start_with_next([=](int outer, int inner) {
date->move((outer - inner) / 2, 0);
}, date->lifetime());
rpl::single(
langDateTimeFull(base::unixtime::parse(data.activeTime))),
st::sessionDateLabel),
style::margins(0, 0, 0, st::sessionDateSkip),
style::al_top);
using namespace Settings;
const auto container = box->verticalLayout();
@@ -121,35 +121,20 @@ void InfoBox(
userpic->overrideShape(Ui::PeerUserpicShape::Forum);
userpic->setAttribute(Qt::WA_TransparentForMouseEvents);
const auto nameWrap = box->addRow(
object_ptr<Ui::FixedHeightWidget>(
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
st::sessionBigName.maxHeight));
const auto name = Ui::CreateChild<Ui::FlatLabel>(
nameWrap,
rpl::single(data.bot->name()),
st::sessionBigName);
nameWrap->widthValue(
) | rpl::start_with_next([=](int width) {
name->resizeToWidth(width);
name->move((width - name->width()) / 2, 0);
}, name->lifetime());
rpl::single(data.bot->name()),
st::sessionBigName),
style::al_top);
const auto domainWrap = box->addRow(
object_ptr<Ui::FixedHeightWidget>(
box->addRow(
object_ptr<Ui::FlatLabel>(
box,
st::sessionDateLabel.style.font->height),
style::margins(0, 0, 0, st::sessionDateSkip));
const auto domain = Ui::CreateChild<Ui::FlatLabel>(
domainWrap,
rpl::single(data.domain),
st::sessionDateLabel);
rpl::combine(
domainWrap->widthValue(),
domain->widthValue()
) | rpl::start_with_next([=](int outer, int inner) {
domain->move((outer - inner) / 2, 0);
}, domain->lifetime());
rpl::single(data.domain),
st::sessionDateLabel),
style::margins(0, 0, 0, st::sessionDateSkip),
style::al_top);
using namespace Settings;
const auto container = box->verticalLayout();