浏览代码

KonvergoWindow: fix some more resize issues

The webScaleChanged signal does not only affect webScale. Who would have
thought? It's needed for normal resize events too. So remove the signal
from notifyScale() (where it's evidently useless), and emit it on every
potential size change. Also, the return value of some properties which
use "NOTIFY webScaleChanged" depend on other stuff, like the desktop
mode, so move the signal emission to until after all these things have
changed.
Vincent Lang 8 年之前
父节点
当前提交
fad0a1526f
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      src/ui/KonvergoWindow.cpp

+ 6 - 2
src/ui/KonvergoWindow.cpp

@@ -59,6 +59,7 @@ KonvergoWindow::KonvergoWindow(QWindow* parent) :
 
   QRect loadedGeo = loadGeometry();
   notifyScale(loadedGeo.size());
+  emit webScaleChanged();
 
   connect(SettingsComponent::Get().getSection(SETTINGS_SECTION_MAIN), &SettingsSection::valuesUpdated,
           this, &KonvergoWindow::updateMainSectionSettings);
@@ -365,6 +366,7 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
       m_webDesktopMode = newDesktopMode;
       emit webDesktopModeChanged();
       emit webUrlChanged();
+      emit webScaleChanged();
     }
     else
     {
@@ -380,12 +382,13 @@ void KonvergoWindow::updateMainSectionSettings(const QVariantMap& values)
       SettingsComponent::Get().setValue(SETTINGS_SECTION_MAIN, "fullscreen", fullscreen);
       QTimer::singleShot(0, [=]
       {
+        m_webDesktopMode = newDesktopMode;
         auto s = size();
         QLOG_DEBUG() << "compute scale for mode switch" << s;
         notifyScale(s);
-        m_webDesktopMode = newDesktopMode;
         emit webDesktopModeChanged();
         emit webUrlChanged();
+        emit webScaleChanged();
 
         if (m_webDesktopMode)
           SystemComponent::Get().setCursorVisibility(true);
@@ -544,6 +547,7 @@ void KonvergoWindow::onVisibilityChanged(QWindow::Visibility visibility)
 
   InputComponent::Get().cancelAutoRepeat();
   notifyScale(size());
+  emit webScaleChanged();
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -632,7 +636,6 @@ void KonvergoWindow::notifyScale(const QSize& size)
     m_lastWindowScale = windowScale;
     m_lastWebScale = webScale;
     emit SystemComponent::Get().updateScale(webScale);
-    emit webScaleChanged();
   }
 }
 
@@ -666,6 +669,7 @@ void KonvergoWindow::resizeEvent(QResizeEvent* event)
   #endif
 
   notifyScale(event->size());
+  emit webScaleChanged();
   QQuickWindow::resizeEvent(event);
 }