1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:58:12 +00:00

Ladybird/Qt: Make String allocation infallible

This commit is contained in:
Timothy Flynn 2023-12-04 10:08:16 -05:00 committed by Andrew Kaster
parent 82c827fc56
commit a21998003c
10 changed files with 27 additions and 32 deletions

View file

@ -37,11 +37,11 @@ SettingsDialog::SettingsDialog(QMainWindow* window)
m_new_tab_page = make<QLineEdit>(this);
m_new_tab_page->setText(Settings::the()->new_tab_page());
QObject::connect(m_new_tab_page, &QLineEdit::textChanged, this, [this] {
auto url_string = MUST(ak_string_from_qstring(m_new_tab_page->text()));
auto url_string = ak_string_from_qstring(m_new_tab_page->text());
m_new_tab_page->setStyleSheet(URL(url_string).is_valid() ? "" : "border: 1px solid red;");
});
QObject::connect(m_new_tab_page, &QLineEdit::editingFinished, this, [this] {
auto url_string = MUST(ak_string_from_qstring(m_new_tab_page->text()));
auto url_string = ak_string_from_qstring(m_new_tab_page->text());
if (URL(url_string).is_valid())
Settings::the()->set_new_tab_page(m_new_tab_page->text());
});