[vlc-commits] [Git][videolan/vlc][master] qml: derive from `RoundButton` in `PlayCover` and `ButtonExt`
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Nov 15 23:38:07 UTC 2026
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
c13b3f29 by Fatih Uzunoglu at 2026-11-16T00:14:01+01:00
qml: derive from `RoundButton` in `PlayCover` and `ButtonExt`
This is strictly for maintenance reasons, hoping
that Qt in the future uses input mask that adheres
to the radius used.
- - - - -
2 changed files:
- modules/gui/qt/widgets/qml/ButtonExt.qml
- modules/gui/qt/widgets/qml/PlayCover.qml
Changes:
=====================================
modules/gui/qt/widgets/qml/ButtonExt.qml
=====================================
@@ -26,7 +26,7 @@ import VLC.MainInterface
import VLC.Widgets as Widgets
import VLC.Style
-T.Button {
+T.RoundButton {
id: root
// Properties
@@ -45,7 +45,7 @@ T.Button {
property color color: theme.fg.primary
property color colorFocus: theme.visualFocus
- property int radius: VLCStyle.button_radius
+ radius: VLCStyle.button_radius
//set to true when user animates the background manually
property bool extBackgroundAnimation: false
=====================================
modules/gui/qt/widgets/qml/PlayCover.qml
=====================================
@@ -19,23 +19,29 @@
*****************************************************************************/
import QtQuick
+import QtQuick.Templates as T
import VLC.Style
import VLC.Widgets as Widgets
-Item {
+T.RoundButton {
id: root
// Settings
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+
width: VLCStyle.play_cover_normal
height: width
// NOTE: This is the same scaling than the PlayButton, except we make it bigger.
// Maybe we could crank this to 1.1.
- scale: (hoverHandler.hovered && !tapHandler.pressed) ? 1.05 : 1.0
+ scale: (hovered && !pressed) ? 1.05 : 1.0
- property real _hoverProgress: hoverHandler.hovered ? 1.0 : 0.0
+ property real _hoverProgress: hovered ? 1.0 : 0.0
activeFocusOnTab: false
@@ -46,11 +52,15 @@ Item {
colorSet: ColorContext.ToolButton
}
+ onClicked: {
+ tapped(Qt.point(pressX, pressY))
+ }
+
// Animations
Behavior on scale {
// NOTE: We disable the animation while pressing to make it more impactful.
- enabled: (!tapHandler.pressed)
+ enabled: (!root.pressed)
NumberAnimation {
duration: VLCStyle.duration_short
@@ -69,26 +79,8 @@ Item {
// Children
- TapHandler {
- id: tapHandler
-
- grabPermissions: TapHandler.CanTakeOverFromHandlersOfDifferentType | TapHandler.ApprovesTakeOverByAnything
-
- onSingleTapped: (eventPoint, button) => {
- root.tapped(point)
- }
- }
-
- HoverHandler {
- id: hoverHandler
-
- grabPermissions: PointerHandler.CanTakeOverFromHandlersOfDifferentType | PointerHandler.ApprovesTakeOverByAnything
- }
-
- Rectangle {
- anchors.fill: parent
-
- radius: width / 2
+ background: Rectangle {
+ radius: root.radius
color: "white"
@@ -97,9 +89,7 @@ Item {
}
}
- Widgets.IconLabel {
- anchors.centerIn: parent
-
+ contentItem: Widgets.IconLabel {
text: VLCIcons.play_filled
color: {
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c13b3f29cd32d28a6ec6363ea6b2a94ee1fd0452
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/c13b3f29cd32d28a6ec6363ea6b2a94ee1fd0452
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list