summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2020-04-24 12:42:25 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2020-05-05 14:20:20 +0200
commit58cd21c0aa7a9dc5a18ea411dcf462a2ee8193f6 (patch)
treea778f350c4257eb888f87d7fee0091daa8042b9a /src/webengine/api/qquickwebengineview.cpp
parent9b21cff6f46d8e98b85996111bd8187ef2e45577 (diff)
Fix setting WebEngineView.audioMuted before initialization
Fixes: QTBUG-83732 Change-Id: Ie07a1ecf87b214436ab7cea07003ddd5aeaedda3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index c56014a57..804d81e54 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -129,6 +129,7 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_webChannel(0)
, m_webChannelWorld(0)
+ , m_defaultAudioMuted(false)
, m_isBeingAdopted(false)
, m_backgroundColor(Qt::white)
, m_zoomFactor(1.0)
@@ -906,6 +907,9 @@ void QQuickWebEngineViewPrivate::initializationFinished()
adapter->setWebChannel(m_webChannel, m_webChannelWorld);
#endif
+ if (m_defaultAudioMuted != adapter->isAudioMuted())
+ adapter->setAudioMuted(m_defaultAudioMuted);
+
if (devToolsView && devToolsView->d_ptr->adapter)
adapter->openDevToolsFrontend(devToolsView->d_ptr->adapter);
@@ -1426,15 +1430,18 @@ void QQuickWebEngineView::setBackgroundColor(const QColor &color)
bool QQuickWebEngineView::isAudioMuted() const
{
const Q_D(QQuickWebEngineView);
- return d->adapter->isAudioMuted();
+ if (d->adapter->isInitialized())
+ return d->adapter->isAudioMuted();
+ return d->m_defaultAudioMuted;
}
void QQuickWebEngineView::setAudioMuted(bool muted)
{
Q_D(QQuickWebEngineView);
- bool wasAudioMuted = d->adapter->isAudioMuted();
+ bool wasAudioMuted = isAudioMuted();
+ d->m_defaultAudioMuted = muted;
d->adapter->setAudioMuted(muted);
- if (wasAudioMuted != d->adapter->isAudioMuted())
+ if (wasAudioMuted != isAudioMuted())
Q_EMIT audioMutedChanged(muted);
}