Skip to content

fix: rename QML value type NetType to netType to silence Qt6 naming warning - #605

Draft
52cyb wants to merge 1 commit into
masterfrom
agent/bot/ddc5f9eb
Draft

fix: rename QML value type NetType to netType to silence Qt6 naming warning#605
52cyb wants to merge 1 commit into
masterfrom
agent/bot/ddc5f9eb

Conversation

@52cyb

@52cyb 52cyb commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fix: Invalid QML element name "NetType" warning

Fixes the runtime warning:

[qt.qml.typeregistration] <> Invalid QML element name "NetType"; value type names should begin with a lowercase letter

Root cause

NetType is declared as a Q_GADGET class (an enum container, never instantiated) in net-view/operation/nettype.h. In Qt6, Q_GADGET types are registered as value types, and value type names must begin with a lowercase letter. It was registered with an uppercase name "NetType" in dcc-network/operation/dccnetwork.cpp:32, triggering the warning.

Changes

  • dcc-network/operation/dccnetwork.cpp:32: changed the 4th argument of qmlRegisterType<NetType>(...) from "NetType" to "netType" (the C++ template parameter <NetType> is unchanged).
  • dcc-network/qml/: updated 101 NetType. references to netType. across 15 QML files (enum value accesses only; import org.deepin.dcc.network 1.0 URIs unchanged).
  • The C++ class name NetType and all NetType:: enum references remain unchanged — only the QML element name is renamed.

Total: 16 files changed, 99 insertions(+), 99 deletions(-).

Verification (already passed)

  • Code review: 98/100, 0 vulnerabilities, 4 checks all passed.
  • Local build: UOS V25 / pbuilder (chroot isolated), build completed successfully. Invalid QML warnings: 0 (target warning eliminated). 6 binary deb packages generated normally.

Multica issue

DDE-148: dde-network-core: QML 类型注册警告 NetType 值类型名应以小写字母开头

Summary by Sourcery

Rename the network QML value type to comply with Qt6 naming requirements and remove the resulting runtime warning.

Bug Fixes:

  • Rename the QML-registered network value type to lowercase to eliminate the Qt6 invalid element-name warning.

Enhancements:

  • Update network QML enum references to use the renamed netType value type while preserving the C++ type and module URI.

Tests:

  • Verify the project builds successfully and produces no invalid QML warnings.

1. Rename QML value type registration "NetType" to "netType" in dccnetwork.cpp to satisfy Qt6 value type naming convention
2. Update 101 NetType. references to netType. across 15 QML files
3. Keep C++ class name NetType and all NetType:: enum references unchanged

Influence:
1. Verify no "Invalid QML element name" warning at runtime
2. Confirm network control center QML pages load and display correctly
3. Check NetType enum values resolve correctly in QML

fix: 将 QML NetType 注册名改为 netType

1. 将 dccnetwork.cpp 中 QML 值类型注册名 "NetType" 改为 "netType",符合 Qt6 值类型命名约定
2. 更新 15 个 QML 文件中 101 处 NetType. 引用为 netType.
3. C++ 类名 NetType 及所有 NetType:: 枚举引用保持不变

Influence:
1. 验证运行时不再出现 "Invalid QML element name" 警告
2. 确认控制中心网络 QML 页面加载和显示正常
3. 检查 QML 中 NetType 枚举值解析正确
@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: 52cyb

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 Aug 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR renames the QML value type exposure of the C++ Q_GADGET NetType from the invalid Qt6 value type name "NetType" to the lowercase "netType" and updates all QML enum usages accordingly, eliminating a Qt6 runtime warning without changing the underlying C++ enum container or import URIs.

Sequence diagram for QML value type registration of NetType as netType

sequenceDiagram
    participant DccNetwork
    participant QMLEngine
    actor QMLView

    DccNetwork->>QMLEngine: qmlRegisterType<NetType>(org.deepin.dcc.network,1,0,netType)
    QMLView->>QMLEngine: read netType.DS_Connected
    QMLEngine-->>QMLView: DS_Connected
Loading

File-Level Changes

Change Details Files
Adjust QML type registration so the NetType Q_GADGET is exported as a lowercase value type name to comply with Qt6 naming rules.
  • Change the qmlRegisterType registration string argument from "NetType" to "netType" while leaving the template type and module/versions unchanged.
  • Keep the C++ class name NetType and all C++ enum scopes intact; only the QML element name is modified.
dcc-network/operation/dccnetwork.cpp
Update all QML references that access NetType enums to use the new lowercase value type name while preserving existing logic and bindings.
  • Replace usages like NetType.FooBar with netType.FooBar across device status, wired/wireless pages, VPN/DSL pages, and various Section* components.
  • Ensure property types, roleValue comparisons, visibility conditions, and switch/case statements now reference netType while leaving surrounding QML structure and imports unchanged.
dcc-network/qml/DeviceStatusItem.qml
dcc-network/qml/NetworkMain.qml
dcc-network/qml/PageDSL.qml
dcc-network/qml/PageDSLSettings.qml
dcc-network/qml/PageSettings.qml
dcc-network/qml/PageSystemProxy.qml
dcc-network/qml/PageVPN.qml
dcc-network/qml/PageVPNSettings.qml
dcc-network/qml/PageWiredDevice.qml
dcc-network/qml/PageWirelessDevice.qml
dcc-network/qml/SectionDevice.qml
dcc-network/qml/SectionGeneric.qml
dcc-network/qml/SectionIPv4.qml
dcc-network/qml/SectionIPv6.qml
dcc-network/qml/SectionSecret.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

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