mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Qt6: Fixed flickering MainWindow (#4452)
* Qt6: Fixed flickering MainWindow When opening a Mapchart for the first time after start of GC, the MainWindow used to shrink and be maximized again afterwards automatically, matching the description in https://forum.qt.io/topic/141398/qwebengineview-closes-reopens-window-when-added-dynamically By adding and removing a QWebEngineView before showing MainWindow, this flicker can be avoided * Added empty HTML to RideMapWindow This fix avoids flicker for the RideMapWindow in (un-)maximized windows (only if the chart was already part of the layout on startup)
This commit is contained in:
committed by
GitHub
parent
642eae96cb
commit
a1f02e925f
@@ -137,6 +137,7 @@ RideMapWindow::RideMapWindow(Context *context, int mapType) : GcChartWindow(cont
|
||||
view->setContentsMargins(0,0,0,0);
|
||||
view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
view->setAcceptDrops(false);
|
||||
view->page()->setHtml("<html></html>");
|
||||
layout->addWidget(view);
|
||||
|
||||
HelpWhatsThis *help = new HelpWhatsThis(view);
|
||||
|
||||
@@ -444,6 +444,19 @@ MainWindow::MainWindow(const QDir &home)
|
||||
tablayout->addWidget(viewStack);
|
||||
setCentralWidget(central);
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
/*----------------------------------------------------------------------
|
||||
* Hack to avoid a flickering MainWindow when showing a QWebEngineView in a chart, e.g. a Map:
|
||||
* Temporarily add a dummy QWebEngineView with some random content before the MainWindow is shown
|
||||
* https://forum.qt.io/topic/141398/qwebengineview-closes-reopens-window-when-added-dynamically
|
||||
*--------------------------------------------------------------------*/
|
||||
QWebEngineView *dummywev = new QWebEngineView();
|
||||
dummywev->page()->setHtml("<html></html>");
|
||||
mainLayout->addWidget(dummywev);
|
||||
mainLayout->removeWidget(dummywev);
|
||||
delete dummywev;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
* Application Menus
|
||||
*--------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user