Skip to content

Commit

Permalink
QT >= 5.8 stop ride summary stealing focus
Browse files Browse the repository at this point in the history
.. its annoying!
  • Loading branch information
liversedge committed Sep 1, 2017
1 parent 2139fb4 commit f70ab21
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/Charts/LTMWindow.cpp
Expand Up @@ -144,6 +144,10 @@ LTMWindow::LTMWindow(Context *context) :
QFont defaultFont; // mainwindow sets up the defaults.. we need to apply
#ifdef NOWEBKIT
dataSummary = new QWebEngineView(this);
#if QT_VERSION >= 0x050800
// stop stealing focus!
dataSummary->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
#endif
//XXXdataSummary->setEnabled(false); // stop grabbing focus
if (dpiXFactor > 1) {
// 80 lines per page on hidpi screens (?)
Expand Down
6 changes: 6 additions & 0 deletions src/Charts/RideMapWindow.cpp
Expand Up @@ -37,6 +37,8 @@

#ifdef NOWEBKIT
#include <QtWebChannel>
#include <QWebEngineView>
#include <QWebEngineSettings>
#endif

// overlay helper
Expand Down Expand Up @@ -121,6 +123,10 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont

#ifdef NOWEBKIT
view = new QWebEngineView(this);
#if QT_VERSION >= 0x050800
// stop stealing focus!
view->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
#endif
#else
view = new QWebView();
#endif
Expand Down
11 changes: 7 additions & 4 deletions src/Charts/RideSummaryWindow.cpp
Expand Up @@ -91,12 +91,15 @@ RideSummaryWindow::RideSummaryWindow(Context *context, bool ridesummary) :
vlayout->setSpacing(0);
vlayout->setContentsMargins(10,10,10,10);

#ifdef NOWEBKIT
#ifdef NOWEBKIT
rideSummary = new QWebEngineView(this);
//XXX steals focus rideSummary->setEnabled(false);
#else
#if QT_VERSION >= 0x050800
// stop stealing focus!
rideSummary->settings()->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, false);
#endif
#else
rideSummary = new QWebView(this);
#endif
#endif

rideSummary->setContentsMargins(0,0,0,0);
rideSummary->page()->view()->setContentsMargins(0,0,0,0);
Expand Down

0 comments on commit f70ab21

Please sign in to comment.