Conditionally handle Tab in fields in custom way.

This commit is contained in:
John Preston
2026-02-09 14:02:36 +04:00
parent 998b3af598
commit 5c87c43007
8 changed files with 27 additions and 35 deletions
@@ -246,7 +246,6 @@ Options::Option::Option(
InitField(outer, _field, session);
_field->setMaxLength(kOptionLimit + kErrorLimit);
_field->show();
_field->customTab(true);
_wrap->hide(anim::type::instant);
@@ -725,13 +724,14 @@ void Options::addEmptyOption() {
_scrollToWidget.fire_copy(field);
}, field->lifetime());
field->tabbed(
) | rpl::on_next([=] {
) | rpl::on_next([=](not_null<bool*> handled) {
const auto index = findField(field);
if (index + 1 < _list.size()) {
_list[index + 1]->setFocus();
} else {
_tabbed.fire({});
}
*handled = true;
}, field->lifetime());
base::install_event_filter(field, [=](not_null<QEvent*> event) {
if (event->type() != QEvent::KeyPress
@@ -863,7 +863,6 @@ not_null<Ui::InputField*> CreatePollBox::setupQuestion(
InitField(getDelegate()->outerContainer(), question, session);
question->setMaxLength(kQuestionLimit + kErrorLimit);
question->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
question->customTab(true);
if (isPremium) {
using Selector = ChatHelpers::TabbedSelector;
@@ -968,7 +967,6 @@ not_null<Ui::InputField*> CreatePollBox::setupSolution(
));
solution->setEditLinkCallback(
DefaultEditLinkCallback(_controller->uiShow(), solution));
solution->customTab(true);
const auto warning = CreateWarningLabel(
inner,
@@ -1048,8 +1046,9 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
st::createPollLimitPadding));
question->tabbed(
) | rpl::on_next([=] {
) | rpl::on_next([=](not_null<bool*> handled) {
options->focusFirst();
*handled = true;
}, question->lifetime());
Ui::AddSkip(container);
@@ -1097,8 +1096,9 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
}, question->lifetime());
solution->tabbed(
) | rpl::on_next([=] {
) | rpl::on_next([=](not_null<bool*> handled) {
question->setFocus();
*handled = true;
}, solution->lifetime());
quiz->setDisabled(_disabled & PollData::Flag::Quiz);