From 825e14140c65d840cf4a4ca8bee1d3f604f7ea0f Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Sun, 24 Feb 2013 15:37:14 +0330 Subject: [PATCH] [Mac] fixed search highlighting on Mac, see #756, also don't paint cursor when showing popup. --- src/lib/app/mainapplication.cpp | 14 ++++++++++---- src/lib/navigation/locationbar.cpp | 2 ++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 946e3948c..9db62393c 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -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 diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 6b352038c..2aa0cac02 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -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);