From 6c455978062b8e39e7a8815c95b39c0aefc8da74 Mon Sep 17 00:00:00 2001 From: Pierre Rossi <pierre.rossi@digia.com> Date: Tue, 11 Jun 2013 16:35:33 +0200 Subject: [PATCH] Don't depend on QApplication for cursorFlashTime Seems more future-proof to only depend on Gui as much as possible. --- lib/web_contents_delegate_qt.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/web_contents_delegate_qt.cpp b/lib/web_contents_delegate_qt.cpp index 53df69a66..646728fa5 100644 --- a/lib/web_contents_delegate_qt.cpp +++ b/lib/web_contents_delegate_qt.cpp @@ -53,7 +53,8 @@ #include <QToolButton> #include <QLineEdit> #include <QQuickView> -#include <QApplication> +#include <QGuiApplication> +#include <QStyleHints> static const int kTestWindowWidth = 800; static const int kTestWindowHeight = 600; @@ -164,7 +165,8 @@ void WebContentsDelegateQt::PlatformSetContents() content::RendererPreferences* rendererPrefs = m_webContents->GetMutableRendererPrefs(); rendererPrefs->use_custom_colors = true; // Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in seconds - rendererPrefs->caret_blink_interval = static_cast<double>(qApp->cursorFlashTime())/2000; + const int qtCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime(); + rendererPrefs->caret_blink_interval = 0.5 * static_cast<double>(qtCursorFlashTime) / 1000; m_webContents->GetRenderViewHost()->SyncRendererPrefs(); if (m_contentsView) { -- GitLab