Bug 484892

Summary: Rectangular selection unusably slow
Product: [Applications] Spectacle Reporter: Nicolas Fella <nicolas.fella>
Component: GeneralAssignee: Noah Davis <noahadvs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, kde, lomweatherdb, qydwhotmail
Priority: NOR    
Version First Reported In: git-master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Nicolas Fella 2024-04-01 23:46:39 UTC
The region selector when making a region screenshot only reacts several seconds delayed

Bisected to https://invent.kde.org/graphics/spectacle/-/commit/540448158fc55eac63256ad5c15e356eb2be3705

It also prints lots of 

qrc:/qt/qml/org/kde/spectacle/private/Gui/Handle.qml:135:5: QML ShapePath: Binding loop detected for property "scale"
qrc:/qt/qml/org/kde/spectacle/private/Gui/ImageCaptureOverlay.qml:131:9: QML SelectionHandle: Binding loop detected for property "visible"
qrc:/qt/qml/org/kde/spectacle/private/Gui/ImageCaptureOverlay.qml:131:9: QML SelectionHandle: Binding loop detected for property "implicitHeight"
qrc:/qt/qml/org/kde/spectacle/private/Gui/ImageCaptureOverlay.qml:131:9: QML SelectionHandle: Binding loop detected for property "visible"
qrc:/qt/qml/org/kde/spectacle/private/Gui/ImageCaptureOverlay.qml:131:9: QML SelectionHandle: Binding loop detected for property "implicitHeight"
qrc:/qt/qml/org/kde/spectacle/private/Gui/ImageCaptureOverlay.qml:131:9: QML SelectionHandle: Binding loop detected for property "implicitHeight"
Comment 1 Noah Davis 2024-04-01 23:56:20 UTC
I cannot reproduce this. I don't get any errors or slowness.
Comment 2 Nicolas Fella 2024-04-02 09:26:13 UTC
What kind of information do you need?
Comment 3 Noah Davis 2024-04-02 16:54:39 UTC
(In reply to Nicolas Fella from comment #2)
> What kind of information do you need?

Honestly, not sure. Are you sure you're on the latest git master? What if you do a clean build? What if you clear your QML cache ( `fd "qmlcache" ~/.cache -X rm -r {}` )?

I checked the code used for implicit height and there's no reason for there to be a binding loop:

/home/noah/kde/src/graphics/spectacle/src/Gui/ImageCaptureOverlay.qml:
        component SelectionHandle: Handle {
            visible: enabled && selectionRectangle.visible
                && SelectionEditor.dragLocation === SelectionEditor.None
                && G.rectIntersects(Qt.rect(x,y,width,height), annotations.viewportRect)
            shapePath.fillColor: selectionRectangle.border.color
            shapePath.strokeWidth: 0
        }

        SelectionHandle { // <-- Line 131
            startAngle: 90
            sweepAngle: 270
            x: SelectionEditor.handlesRect.x
            y: SelectionEditor.handlesRect.y
        }

/home/noah/kde/src/graphics/spectacle/src/Gui/Handle.qml:
    // Use a rounded physically even size so that straight edges don't look fuzzy
    implicitWidth: dprRoundEven(18)
    implicitHeight: implicitWidth

    // Round to a physically even size
    function dprRoundEven(value) {
        value = Math.round(value * Screen.devicePixelRatio)
        return (value - value % 2) / Screen.devicePixelRatio
    }
Comment 4 Nicolas Fella 2024-04-03 17:32:05 UTC
(by setting the but to NEEDSINFO it will be closed in 30 days unless it's set back, so it's not nice to do that if you don't ask for specific information)
Comment 5 Noah Davis 2024-04-03 18:11:50 UTC
(In reply to Nicolas Fella from comment #4)
> (by setting the but to NEEDSINFO it will be closed in 30 days unless it's
> set back, so it's not nice to do that if you don't ask for specific
> information)

Ah, sorry.
Comment 6 Kai Uwe Broulik 2024-04-10 22:15:36 UTC
Can confirm on Qt 6.7.

Not entirely sure what changed but changing the scale to 1,1 fixes it for me [1]. Probably just one link in the chain that gets broken and then it stops this loop but of course looks a bit broken then

[1] https://invent.kde.org/graphics/spectacle/-/blob/master/src/Gui/Handle.qml?ref_type=heads#L166
Comment 7 Noah Davis 2024-04-11 22:55:28 UTC
Git commit 862adb1ea39a6f393c0289cad9b3a380aa1b7c2c by Noah Davis.
Committed on 11/04/2024 at 22:55.
Pushed by ndavis into branch 'master'.

Handle: prevent division by zero in ShapePath scale

M  +5    -2    src/Gui/Handle.qml

https://invent.kde.org/graphics/spectacle/-/commit/862adb1ea39a6f393c0289cad9b3a380aa1b7c2c
Comment 8 Fushan Wen 2024-04-14 14:37:18 UTC
*** Bug 485545 has been marked as a duplicate of this bug. ***
Comment 9 Noah Davis 2024-06-05 18:46:52 UTC
*** Bug 484947 has been marked as a duplicate of this bug. ***