summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2018-11-05 09:26:18 +0100
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-11-29 10:42:45 +0000
commit67a826716a9a58659f7272cbce3c450af384da5a (patch)
tree5ba6810b8ea839cc9c61e46bf567e3a335d64547
parent9fb8dd4e76700da8d321a8677e44e771a0213a7e (diff)
Windows: Repaint QVideoWidget when WM_PAINT or WM_ERASEBKGND received
Since updates are disabled, and no paint events will be sent to QVideoWidget, need to somehow repaint the video window. When BeginPaint is called outside of the expose event, the window might not be refreshed. So moved calling the repainting within the expose event. Also added repainting when the display rect is changed to immediate refreshing. Task-number: QTBUG-71326 Change-Id: I7c29b3f8ad35e33590c7b138a5141546ce3c1a42 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/multimediawidgets/qvideowidget.cpp18
-rw-r--r--src/multimediawidgets/qvideowidget.h3
-rw-r--r--src/plugins/common/evr/evrvideowindowcontrol.cpp3
3 files changed, 24 insertions, 0 deletions
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
index e9977c5a8..ab552b90d 100644
--- a/src/multimediawidgets/qvideowidget.cpp
+++ b/src/multimediawidgets/qvideowidget.cpp
@@ -324,6 +324,7 @@ QWindowVideoWidgetBackend::QWindowVideoWidgetBackend(
control->setWinId(widget->winId());
#if defined(Q_OS_WIN)
+ // Disable updates to avoid flickering while resizing/moving.
m_widget->setUpdatesEnabled(false);
#endif
}
@@ -1001,6 +1002,23 @@ void QVideoWidget::paintEvent(QPaintEvent *event)
}
}
+#if defined(Q_OS_WIN)
+bool QVideoWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
+{
+ Q_D(QVideoWidget);
+ Q_UNUSED(eventType);
+ Q_UNUSED(result);
+
+ MSG *mes = reinterpret_cast<MSG *>(message);
+ if (mes->message == WM_PAINT || mes->message == WM_ERASEBKGND) {
+ if (d->windowBackend)
+ d->windowBackend->showEvent();
+ }
+
+ return false;
+}
+#endif
+
#include "moc_qvideowidget.cpp"
#include "moc_qvideowidget_p.cpp"
QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
index b1e2da46b..2a08b6fbd 100644
--- a/src/multimediawidgets/qvideowidget.h
+++ b/src/multimediawidgets/qvideowidget.h
@@ -81,6 +81,9 @@ public:
int saturation() const;
QSize sizeHint() const override;
+#if defined(Q_OS_WIN)
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result) override;
+#endif
public Q_SLOTS:
void setFullScreen(bool fullScreen);
diff --git a/src/plugins/common/evr/evrvideowindowcontrol.cpp b/src/plugins/common/evr/evrvideowindowcontrol.cpp
index ce837c553..95f63c2e7 100644
--- a/src/plugins/common/evr/evrvideowindowcontrol.cpp
+++ b/src/plugins/common/evr/evrvideowindowcontrol.cpp
@@ -158,6 +158,9 @@ void EvrVideoWindowControl::setDisplayRect(const QRect &rect)
} else {
m_displayControl->SetVideoPosition(NULL, &displayRect);
}
+
+ // To refresh content immediately.
+ repaint();
}
}