Kaynağa Gözat

Fix fullscreen resolution on windows at startup.

In the real world we would get a resizeEvent shortly after startup that
would resize the content area of the webview and cause some ugly black
bars around the content. This only happened when we started the app in
fullscreen. I tracked the event basically coming from system event bus,
so something is not playing nicely with Qt here. This hack should work
fine everywhere.
Tobias Hieta 9 yıl önce
ebeveyn
işleme
0eff439b14
1 değiştirilmiş dosya ile 16 ekleme ve 0 silme
  1. 16 0
      src/ui/KonvergoWindow.cpp

+ 16 - 0
src/ui/KonvergoWindow.cpp

@@ -352,6 +352,22 @@ void KonvergoWindow::notifyScale(const QSize& size)
 void KonvergoWindow::resizeEvent(QResizeEvent* event)
 {
   QLOG_DEBUG() << "resize event:" << event->size();
+
+  // This next block should never really be needed in a prefect world...
+  // Unfortunatly this is an imperfect world and on windows sometimes what
+  // would happen on startup is that we got a resize event that would make
+  // the window much smaller than fullscreen.
+  //
+  if (isFullScreen())
+  {
+    QSize fsSize = screen()->size();
+    if (event->size().width() < fsSize.width() || event->size().height() < fsSize.height())
+    {
+      QLOG_DEBUG() << "Ignoring resize event when in fullscreen...";
+      return;
+    }
+  }
+
   notifyScale(event->size());
   QQuickWindow::resizeEvent(event);
 }