Skip to content

fix: reset partialFactor in C++ exit path#1072

Draft
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/partialfactor-readonly-qml
Draft

fix: reset partialFactor in C++ exit path#1072
deepin-wm wants to merge 1 commit into
linuxdeepin:masterfrom
deepin-wm:fix/partialfactor-readonly-qml

Conversation

@deepin-wm

@deepin-wm deepin-wm commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix QML TypeError: Cannot assign to read-only property "partialFactor" in MultitaskviewProxy.qml.

Changes

  1. multitaskview.cpp exit(): Add qFuzzyCompare guard to reset m_partialFactor to 0.0, consistent with updatePartialFactor() style. When the value differs from 0.0, emit partialFactorChanged; otherwise just ensure exact 0.0 without redundant signal.
  2. MultitaskviewProxy.qml: Remove invalid assignment partialFactor = 0 to the read-only Q_PROPERTY. The reset is now handled in C++.

Related

  • PMS: BUG-346717

Summary by Sourcery

Ensure the multitask view resets its partial factor state on exit without violating QML read-only property constraints.

Bug Fixes:

  • Reset the C++ partial factor state on multitask view exit and emit change notifications only when needed to avoid stale values.
  • Remove an invalid QML assignment to a read-only partialFactor property that caused runtime TypeErrors.

@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deepin-wm

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Resets the Multitaskview partialFactor state on exit in C++ instead of QML, ensuring it is set to 0.0 only when needed and avoiding writes to a read-only Q_PROPERTY, while keeping signal emissions consistent with existing updatePartialFactor logic.

Sequence diagram for Multitaskview exit partialFactor reset

sequenceDiagram
    actor User
    participant MultitaskviewProxy
    participant Multitaskview
    participant QMLBindings

    User->>MultitaskviewProxy: exitRequested
    MultitaskviewProxy->>Multitaskview: exit(surface, immediately)
    Multitaskview-->>QMLBindings: aboutToExit()

    alt [m_partialFactor differs from 0.0]
        Multitaskview-->>QMLBindings: partialFactorChanged()
    else [m_partialFactor equals 0.0]
    end

    alt [immediately]
        Multitaskview->>Multitaskview: setVisible(false)
    else [not immediately]
        Multitaskview->>Multitaskview: startExitAnimation()
    end
Loading

File-Level Changes

Change Details Files
Handle partialFactor reset on exit in C++ with guarded signal emission.
  • In exit(), compare m_partialFactor against 0.0 using qFuzzyCompare before resetting.
  • When m_partialFactor differs from 0.0, set it to 0.0 and emit partialFactorChanged().
  • When m_partialFactor is already effectively 0.0, simply ensure the member is 0.0 without emitting a redundant signal.
src/plugins/multitaskview/multitaskview.cpp
Remove invalid QML write to read-only partialFactor property.
  • Delete the assignment partialFactor = 0 in the exited branch of the Multitaskview state machine, since the reset is now handled in C++.
  • Retain visibility handling and state transitions in QML unchanged aside from the removed assignment.
src/plugins/multitaskview/qml/MultitaskviewProxy.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-wm deepin-wm force-pushed the fix/partialfactor-readonly-qml branch from b5cafa8 to c8ae63c Compare June 30, 2026 07:36
1. Add qFuzzyCompare guard to reset m_partialFactor in exit()
   consistent with updatePartialFactor() style
2. Remove invalid QML assignment to read-only partialFactor
   property in MultitaskviewProxy.qml
3. Update copyright year in MultitaskviewProxy.qml to 2024-2026
   as required by SPDX CI check

Influence:
1. Test multitaskview exit resets partialFactor without QML errors
2. Verify gesture exit flow works correctly with factor reset

fix: 在C++退出路径中重置partialFactor

1. 在exit()中添加qFuzzyCompare守卫重置m_partialFactor
   与updatePartialFactor()风格保持一致
2. 删除MultitaskviewProxy.qml中对只读partialFactor
   属性的无效赋值
3. 更新MultitaskviewProxy.qml版权年份为2024-2026
   以满足SPDX CI检查要求

Influence:
1. 测试多任务视图退出时partialFactor正常重置且无QML报错
2. 验证手势退出流程中factor重置的正确性

PMS: BUG-346717
@deepin-wm deepin-wm force-pushed the fix/partialfactor-readonly-qml branch from c8ae63c to bd43e95 Compare June 30, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants