[vlc-commits] [Git][videolan/vlc][master] 7 commits: qml: prevent assigning intermediate value to source size in `VideoInfoExpandPanel.qml`
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sat Feb 1 11:22:35 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
a25a34da by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `VideoInfoExpandPanel.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
cf11d530 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `ArtistTopBanner.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
7adbf332 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `AtoBButton.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
426d5085 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `BannnerCone.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
cec6daa9 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `MediaCover.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
73066495 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `MusicAlbumsGridExpandDelegate.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
32a0be32 by Fatih Uzunoglu at 2025-02-01T11:03:18+00:00
qml: prevent assigning intermediate value to source size in `MusicArtistDelegate.qml`
Partially changing a value type changes the whole value. In
image case, this means that the images can get re-loaded with
indeterminate size just to discard them after the size is
determined.
Fortunately this does not happen currently, because the sizes
are determined before the component is complete and QQuickImage
only loads if the component is complete.
However, due to the declarative nature of QML, bindings are
evaluated and assigned one by one, this means that source size
would be changed two times even if .width and .height are
pending re-evaluation at the same time (such as both depend on
DPR). At the same time, the order is also not defined, so
with such a setup as following:
sourceSize.width: width * eDPR
sourceSize.height: height * eDPR
When eDPR changes, Qt evaluates the binding for width or height,
adjusts sourceSize, sourceSize changes and change signal is signalled,
then evaluates the other sub-part of the value type (width or height),
adjusts sourceSize, sourceSize changes again and change signal is
signalled. Qt could technically optimize this, but as of Qt 6.8.1
it is not the case.
Meanwhile with the following:
sourceSize: Qt.size(width * eDPR, height * eDPR)
When eDPR changes, Qt evaluates the binding and adjusts the source
size, sourceSize changes and change signal is signalled. Source size
does not change two times, and the image would not be loaded two
times.
- - - - -
7 changed files:
- modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
- modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
- modules/gui/qt/player/qml/controlbarcontrols/AtoBButton.qml
- modules/gui/qt/widgets/qml/BannerCone.qml
- modules/gui/qt/widgets/qml/MediaCover.qml
Changes:
=====================================
modules/gui/qt/medialibrary/qml/ArtistTopBanner.qml
=====================================
@@ -104,8 +104,7 @@ FocusScope {
Widgets.RoundImage {
id: roundImage
source: artist.cover || VLCStyle.noArtArtist
- sourceSize.width: width * eDPR
- sourceSize.height: height * eDPR
+ sourceSize: Qt.size(width * eDPR, height * eDPR)
anchors.fill: parent
radius: VLCStyle.cover_normal
readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
=====================================
modules/gui/qt/medialibrary/qml/MusicAlbumsGridExpandDelegate.qml
=====================================
@@ -126,8 +126,7 @@ FocusScope {
source: (root.model && root.model.cover && root.model.cover !== "")
? root.model.cover
: VLCStyle.noArtAlbumCover
- sourceSize.width: width * eDPR
- sourceSize.height: height * eDPR
+ sourceSize: Qt.size(width * eDPR, height * eDPR)
readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -170,8 +170,7 @@ T.ItemDelegate {
source: (model.cover) ? model.cover
: VLCStyle.noArtArtistSmall
- sourceSize.width: width * eDPR
- sourceSize.height: height * eDPR
+ sourceSize: Qt.size(width * eDPR, height * eDPR)
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
=====================================
modules/gui/qt/medialibrary/qml/VideoInfoExpandPanel.qml
=====================================
@@ -114,8 +114,7 @@ FocusScope {
anchors.fill: parent
source: model.thumbnail || VLCStyle.noArtVideoCover
- sourceSize.width: width * eDPR
- sourceSize.height: height * eDPR
+ sourceSize: Qt.size(width * eDPR, height * eDPR)
radius: VLCStyle.gridCover_radius
readonly property real eDPR: MainCtx.effectiveDevicePixelRatio(Window.window)
=====================================
modules/gui/qt/player/qml/controlbarcontrols/AtoBButton.qml
=====================================
@@ -28,8 +28,7 @@ Widgets.ImageToolButton {
text: qsTr("A to B")
- sourceSize.width: VLCStyle.icon_toolbar
- sourceSize.height: VLCStyle.icon_toolbar
+ sourceSize: Qt.size(VLCStyle.icon_toolbar, VLCStyle.icon_toolbar)
checked: Player.ABloopState !== Player.ABLOOP_STATE_NONE
onClicked: Player.toggleABloopState()
=====================================
modules/gui/qt/widgets/qml/BannerCone.qml
=====================================
@@ -30,8 +30,7 @@ Image {
required property color color
property alias csdMenuVisible: csdMenu.menuVisible
- sourceSize.width: VLCStyle.icon_normal
- sourceSize.height: VLCStyle.icon_normal
+ sourceSize: Qt.size(VLCStyle.icon_normal, VLCStyle.icon_normal)
mipmap: MainCtx.useXmasCone()
source: MainCtx.useXmasCone() ? "qrc:///logo/vlc48-xmas.png" // TODO: new xmas cone for designs?
=====================================
modules/gui/qt/widgets/qml/MediaCover.qml
=====================================
@@ -108,8 +108,8 @@ Item {
anchors.fill: parent
- sourceSize.width: root.pictureWidth * root.eDPR
- sourceSize.height: root.pictureHeight * root.eDPR
+ sourceSize: Qt.size(root.pictureWidth * root.eDPR,
+ root.pictureHeight * root.eDPR)
onStatusChanged: {
if (status === Image.Loading) {
@@ -138,8 +138,8 @@ Item {
// try to release the resources otherwise
source: visible ? root.fallbackImageSource : ""
- sourceSize.width: root.pictureWidth * root.eDPR
- sourceSize.height: root.pictureHeight * root.eDPR
+ sourceSize: Qt.size(root.pictureWidth * root.eDPR,
+ root.pictureHeight * root.eDPR)
cache: true
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a0f7735597ca113742b4f5fca519f129c368284...32a0be32f89dfa124a423b76846caf93da43be04
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/2a0f7735597ca113742b4f5fca519f129c368284...32a0be32f89dfa124a423b76846caf93da43be04
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