[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt: introduce `MainCtx::setTimeout()`
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Thu Mar 12 17:36:08 UTC 2026
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
cb210f8b by Fatih Uzunoglu at 2026-03-12T17:43:20+01:00
qt: introduce `MainCtx::setTimeout()`
This allows us to get rid of one-off `Timer`s, which
occupies memory unnecessarily when they are no longer
necessary.
- - - - -
81d6e4af by Fatih Uzunoglu at 2026-03-12T17:43:20+01:00
qml: get rid of the one-off `Timer` in `FadingEdge.qml`
- - - - -
c5a0f9f5 by Fatih Uzunoglu at 2026-03-12T17:43:20+01:00
qml: get rid of the one-off `Timer` in `HomePage.qml`
- - - - -
3 changed files:
- modules/gui/qt/maininterface/mainctx.hpp
- modules/gui/qt/medialibrary/qml/HomePage.qml
- modules/gui/qt/widgets/qml/FadingEdge.qml
Changes:
=====================================
modules/gui/qt/maininterface/mainctx.hpp
=====================================
@@ -29,6 +29,7 @@
#include <QtQuick/QQuickView>
#include <QApplication>
#include <QQuickItem>
+#include <QTimer>
Q_MOC_INCLUDE( "dialogs/toolbar/controlbar_profile_model.hpp" )
Q_MOC_INCLUDE( "util/csdbuttonmodel.hpp" )
@@ -341,6 +342,16 @@ public:
return window->format().depthBufferSize() > 0;
}
+ // TODO: This functions is akin to Window Web API's `setTimeout()`. Get rid of this once
+ // once Qt implements it.
+ Q_INVOKABLE static void setTimeout(const QJSValue& func, const int delay, const QJSValueList& params = {}, const QObject* context = nullptr)
+ {
+ assert(func.isCallable());
+ QTimer::singleShot(delay, context, [func, params]() {
+ func.call(params);
+ });
+ }
+
Q_INVOKABLE virtual bool platformHandlesResizeWithCSD() const { return false; };
Q_INVOKABLE virtual bool platformHandlesTitleBarButtonsWithCSD() const { return false; };
Q_INVOKABLE virtual bool platformHandlesShadowsWithCSD() const { return false; };
=====================================
modules/gui/qt/medialibrary/qml/HomePage.qml
=====================================
@@ -98,15 +98,6 @@ T.Page {
property bool _hasMedias: true
- Timer {
- interval: 50
- running: true
-
- onTriggered: {
- flickable._hasMedias = Qt.binding(() => { return continueWatchingRow.visible || favoritesRow.visible || newMediaRow.visible } )
- }
- }
-
ScrollBar.vertical: Widgets.ScrollBarExt {}
// This behavior allows to have similar "smooth" animation
@@ -131,6 +122,10 @@ T.Page {
// feature for non-touch cases, so disable it here and enable
// it if touch is detected through the hover handler:
MainCtx.setFiltersChildMouseEvents(this, false)
+
+ MainCtx.setTimeout(() => {
+ flickable._hasMedias = Qt.binding(() => { return continueWatchingRow.visible || favoritesRow.visible || newMediaRow.visible } )
+ }, 50, [], flickable)
}
HoverHandler {
=====================================
modules/gui/qt/widgets/qml/FadingEdge.qml
=====================================
@@ -17,6 +17,7 @@
*****************************************************************************/
import QtQuick
+import VLC.MainInterface
import VLC.Style
import VLC.Util
@@ -85,13 +86,11 @@ Item {
}
}
- // This is used to prevent animating at initialization.
- Timer {
- interval: 50
- running: true
- onTriggered: {
+ Component.onCompleted: {
+ // This is used to prevent animating at initialization:
+ MainCtx.setTimeout(() => {
opacityBehavior.enabled = true
- }
+ }, 50, [], fadingEdgeRectangle)
}
required property color colorStop0
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdefe5c6346f4fcdf076030ef14ed75bf476fb4e...c5a0f9f52e00c5b7379181416b9c651c3fb0c8c2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fdefe5c6346f4fcdf076030ef14ed75bf476fb4e...c5a0f9f52e00c5b7379181416b9c651c3fb0c8c2
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list