[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: update render geometry at component initialization in `ViewBlockingRectangle`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon May 11 19:00:43 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
d201aa66 by Fatih Uzunoglu at 2026-05-11T16:36:39+00:00
qt: update render geometry at component initialization in `ViewBlockingRectangle`
Such early update is useful to get the render geometry at an earlier time,
so that it is not necessary to wait until the first `::updatePaintNode()`
call.
Currently we are already updating the render geometry at scene graph node
initialization, but that occurs at a later than qml component initialization.
- - - - -
cadacd08 by Fatih Uzunoglu at 2026-05-11T16:36:39+00:00
qt: do not adjust render position at init if not wanted in `ViewBlockingRectangle`
This is debatable, but I think it is better to not adjust the render position
at all if `m_updateRenderPosition` is `false`.
Note that unlike render position, it is trivial to update the render size so
there is no such condition for updating it.
- - - - -
3 changed files:
- modules/gui/qt/maininterface/videosurface.cpp
- modules/gui/qt/widgets/native/viewblockingrectangle.cpp
- modules/gui/qt/widgets/native/viewblockingrectangle.hpp
Changes:
=====================================
modules/gui/qt/maininterface/videosurface.cpp
=====================================
@@ -124,6 +124,12 @@ VideoSurface::VideoSurface(QQuickItem* parent)
setAcceptHoverEvents(true);
setAcceptedMouseButtons(Qt::AllButtons);
setFlag(ItemAcceptsInputMethod, true);
+
+ {
+ // This is for initialization, they are adjusted in `::updatePaintNode()`:
+ setUpdateRenderPosition(true);
+ setFlag(ItemHasContents, false); // `setUpdateRenderPosition(true)` sets `ItemHasContents`
+ }
}
int VideoSurface::qtMouseButton2VLC( Qt::MouseButton qtButton )
=====================================
modules/gui/qt/widgets/native/viewblockingrectangle.cpp
=====================================
@@ -159,15 +159,15 @@ QSGNode *ViewBlockingRectangle::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
if (m_updateRenderPosition)
{
observerNode = createObserverNode();
+
+ // Initial position:
+ m_renderPosition = mapToScene(QPointF(0,0));
}
else
{
observerNode = nullptr;
}
- // Initial position:
- m_renderPosition = mapToScene(QPointF(0,0));
-
if (m_renderingEnabled)
{
if (softwareMode)
@@ -329,3 +329,18 @@ bool ViewBlockingRectangle::updateRenderPosition() const
return m_updateRenderPosition;
}
+void ViewBlockingRectangle::componentComplete()
+{
+ QQuickItem::componentComplete();
+
+ if (isVisible())
+ {
+ m_renderSize = QSizeF(width(), height());
+
+ if (m_updateRenderPosition)
+ {
+ m_renderPosition = mapToScene(QPointF(0.0, 0.0));
+ }
+ }
+}
+
=====================================
modules/gui/qt/widgets/native/viewblockingrectangle.hpp
=====================================
@@ -82,6 +82,8 @@ protected:
void setUpdateRenderPosition(bool update);
bool updateRenderPosition() const;
+ void componentComplete() override;
+
private:
QColor m_color;
bool m_windowChanged = false;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f5be290dc6df16afb4de13e428865afb2d38e47b...cadacd08c2bcf9050226c7c493fe823ae2672e5a
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f5be290dc6df16afb4de13e428865afb2d38e47b...cadacd08c2bcf9050226c7c493fe823ae2672e5a
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list