fix: resolve Qt6 compilation warnings and deprecations#519
Conversation
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#519
Reviewer's GuideThis PR implements Qt6 compatibility by wrapping container iterations in QT_VERSION checks to switch between qAsConst and std::as_const, adds deprecation suppression flags, removes obsolete code constructs, refines initialization syntax, corrects a platform attribute check, and improves memory handling in the loader tests. Class diagram for SettingsContainer and SettingsGroup iteration changesclassDiagram
class SettingsContainer {
+QVector<SettingsGroup *> groupList() const
+bool groupVisible(const QString &key) const
+void resetSettings()
-QVector<SettingsGroup *> m_groups
}
class SettingsGroup {
+void setBackground(QQmlComponent *background)
+void setConfig(QObject *config)
-QList<SettingsGroup *> m_children
-QList<Option *> m_options
}
SettingsContainer "1" *-- "*" SettingsGroup : m_groups
SettingsGroup "1" *-- "*" SettingsGroup : m_children
SettingsGroup "1" *-- "*" Option : m_options
Class diagram for DQuickControlColorSelector iteration changesclassDiagram
class DQuickControlColorSelector {
+void findAndSetControlParent()
+void recvPaletteColorChanged()
+void onPaletteDestroyed()
-QList<QMetaObject::Connection> m_itemParentChangeConnections
-QMap<QString, DQuickControlPalette*> m_palettes
}
Class diagram for WaterPopAttribute method signature changesclassDiagram
class WaterPopAttribute {
+qreal sizeRatio() const
+qreal yOffset() const
+void setYOffset(qreal offset)
+signal xSpeedChanged()
}
Class diagram for DAppLoaderPrivate iteration and memory management changesclassDiagram
class DAppLoaderPrivate {
+bool createObjects(const char *propertyName)
+void createChildComponents()
+void _q_onComponentProgressChanged()
}
Class diagram for DataManager and RhiNode static_assert removalclassDiagram
class DataManager {
+static DataManagerPointer<Derive> resolve(const DataManagerPointer<Derive> &other, QQuickWindow *owner)
}
class RhiNode {
+void render()
}
Class diagram for DQuickShadowProvider requestImage changeclassDiagram
class DQuickShadowProvider {
+QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1. Added conditional compilation for Qt5/Qt6 compatibility 2. Replaced deprecated qAsConst with std::as_const for Qt6 3. Added D_IGNORE_DEPRECATIONS flag to suppress deprecation warnings 4. Fixed static_assert removal in dbackdropnode.cpp 5. Added missing Q_UNUSED macro in dquickimageprovider.cpp 6. Cleaned up initialization syntax in dquickwindow_p.h 7. Fixed platform check from IsTreelandPlatform to IsWaylandPlatform 8. Improved memory management in AppLoaderSimulator destructor Influence: 1. Verify application builds successfully with both Qt5 and Qt6 2. Test high DPI functionality on both Qt versions 3. Validate blur effects and window management features 4. Check all QML components render correctly 5. Test palette and color selector functionality 6. Verify shadow provider image generation 7. Test settings container and group visibility fix: 解决Qt6编译警告和废弃API问题 1. 添加Qt5/Qt6兼容性条件编译 2. 将废弃的qAsConst替换为std::as_const(Qt6) 3. 添加D_IGNORE_DEPRECATIONS标志抑制废弃API警告 4. 修复dbackdropnode.cpp中移除的static_assert 5. 在dquickimageprovider.cpp中添加缺失的Q_UNUSED宏 6. 清理dquickwindow_p.h中的初始化语法 7. 将平台检查从IsTreelandPlatform修正为IsWaylandPlatform 8. 改进AppLoaderSimulator析构函数的内存管理 Influence: 1. 验证应用在Qt5和Qt6下都能成功构建 2. 测试两个Qt版本下的高DPI功能 3. 验证模糊效果和窗口管理功能 4. 检查所有QML组件是否正确渲染 5. 测试调色板和颜色选择器功能 6. 验证阴影提供者图像生成 7. 测试设置容器和组可见性
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#519
deepin pr auto review根据提供的代码差异,我来分析一下代码的质量、逻辑、性能和安全性,并提出改进建议: 1. Qt版本兼容性改进优点:
改进建议:
2. 代码安全性改进优点:
改进建议:
3. 代码质量改进优点:
改进建议:
4. 性能优化建议优点:
改进建议:
5. 其他建议
总体来说,这些代码差异展示了对Qt5和Qt6兼容性的良好处理,代码质量较高,但仍有一些可以改进的地方,特别是在代码重复和性能优化方面。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Synchronize source files from linuxdeepin/dtkdeclarative. Source-pull-request: linuxdeepin/dtkdeclarative#519
Influence:
fix: 解决Qt6编译警告和废弃API问题
Influence:
Summary by Sourcery
Resolve Qt6 compilation warnings and deprecations by adding Qt version guards, replacing deprecated APIs, suppressing warnings, and applying ancillary fixes to maintain compatibility with both Qt5 and Qt6.
Bug Fixes:
Enhancements:
Build: