1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

[Mac] fixed search highlighting on Mac, see #756, also don't paint cursor when showing popup.

This commit is contained in:
S. Razi Alavizadeh 2013-02-24 15:37:14 +03:30
parent c7193162d2
commit 825e14140c
2 changed files with 12 additions and 4 deletions

View File

@ -979,12 +979,18 @@ QUrl MainApplication::userStyleSheet(const QString &filePath) const
{
QString userStyle;
#ifdef Q_OS_WIN
#ifndef QZ_WS_X11
// Don't grey out selection on losing focus (to prevent graying out found text)
QString highlightColor;
QString highlightedTextColor;
#ifdef Q_OS_MAC
highlightColor = QLatin1String("#b6d6fc");
highlightedTextColor = QLatin1String("#000");
#else
QPalette pal = style()->standardPalette();
QString highlightColor = pal.color(QPalette::Highlight).name();
QString highlightedTextColor = pal.color(QPalette::HighlightedText).name();
highlightColor = pal.color(QPalette::Highlight).name();
highlightedTextColor = pal.color(QPalette::HighlightedText).name();
#endif
userStyle += QString("::selection {background: %1; color: %2;} ").arg(highlightColor, highlightedTextColor);
#endif

View File

@ -567,6 +567,7 @@ void LocationBar::hideProgress()
void LocationBar::paintEvent(QPaintEvent* event)
{
#ifndef Q_OS_MAC
if (m_drawCursor && m_completer.isPopupVisible() && !m_completer.showingMostVisited()) {
// We need to draw cursor when popup is visible
// But don't paint it if we are just showing most visited sites
@ -596,6 +597,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
p.fillRect(cursorRect, option.palette.text().color());
return;
}
#endif
if (hasFocus() || text().isEmpty() || m_forcePaintEvent) {
LineEdit::paintEvent(event);