Commit c2526a27 authored by Waqar Ahmed's avatar Waqar Ahmed
Browse files

Urlbar: adjust label for Untitled docs

parent fbe16066
Pipeline #251953 passed with stage
in 9 minutes and 16 seconds
......@@ -1162,6 +1162,16 @@ void KateUrlBar::setupLayout()
layout->setContentsMargins({});
layout->setSpacing(0);
layout->addWidget(m_stack);
auto updatePalette = [this]() {
auto pal = m_untitledDocLabel->palette();
auto textColor = pal.text().color();
textColor = textColor.lightness() > 127 ? textColor.darker(150) : textColor.lighter(150);
pal.setBrush(QPalette::Active, QPalette::WindowText, textColor);
m_untitledDocLabel->setPalette(pal);
};
updatePalette();
connect(qApp, &QApplication::paletteChanged, this, updatePalette, Qt::QueuedConnection);
}
void KateUrlBar::onViewChanged(KTextEditor::View *v)
......@@ -1175,7 +1185,8 @@ void KateUrlBar::onViewChanged(KTextEditor::View *v)
if (!v) {
updateForDocument(nullptr);
m_untitledDocLabel->setText(i18n("Untitled"));
// no view => show nothing
m_untitledDocLabel->setText({});
m_stack->setCurrentWidget(m_untitledDocLabel);
return;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment