-
Notifications
You must be signed in to change notification settings - Fork 41
fix: Fix Qt5 build failed issue #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 在 CMakeLists.txt 中为 Qt6 正确配置 OpenGL 和 OpenGLWidgets 依赖项 - 更新 DeviceInput.cpp 中的 Qt 版本兼容性代码,使用条件编译处理字符串截取方法差异 Log: Fix Qt5 build failed issue.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts Qt component configuration in CMake for proper OpenGL dependencies in Qt6 and fixes Qt5 build issues by adding Qt-version-specific string slicing for PID extraction in DeviceInput. Class diagram for DeviceInput with Qt-version-specific PID extractionclassDiagram
class DeviceInput {
QString m_VID_PID
QString m_VID
QString m_PID
bool m_Enable
void setInfoFromHwinfo(QMap<QString,QString> mapInfo)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've found 1 issue, and left some high level feedback:
- The version-specific PID extraction logic using preprocessor checks might be better centralized in a small helper (e.g., a QString compatibility utility) to avoid scattering Qt-version conditionals throughout the codebase.
- In CMakeLists.txt, the comment 'Add components only available in Qt6' no longer matches the logic now that
OpenGL(also available in Qt5) is appended there; consider updating the comment or movingOpenGLback into the common component list for clarity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The version-specific PID extraction logic using preprocessor checks might be better centralized in a small helper (e.g., a QString compatibility utility) to avoid scattering Qt-version conditionals throughout the codebase.
- In CMakeLists.txt, the comment 'Add components only available in Qt6' no longer matches the logic now that `OpenGL` (also available in Qt5) is appended there; consider updating the comment or moving `OpenGL` back into the common component list for clarity.
## Individual Comments
### Comment 1
<location> `deepin-devicemanager/src/DeviceManager/DeviceInput.cpp:117` </location>
<code_context>
if (m_VID_PID.size() == 10) {
m_VID = m_VID_PID.mid(2, 4);
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
m_PID = m_VID_PID.last(4);
+#else
+ m_PID = m_VID_PID.right(4);
</code_context>
<issue_to_address>
**suggestion:** Consider using a version-independent substring API to avoid preprocessor branching for PID extraction.
Given `m_VID_PID.size() == 10` is already validated, you can do `m_PID = m_VID_PID.mid(6, 4);` instead. This works in both Qt5 and Qt6, so you can drop the `#if QT_VERSION` block and keep the assignment in a single line.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这段代码的修改主要涉及构建系统配置、源代码兼容性处理以及版本控制忽略文件的更新。以下是对这三个文件变更的详细审查和改进建议: 1.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, re2zero 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 |
|
/merge |
Log: Fix Qt5 build failed issue.
Summary by Sourcery
Fix Qt5 build failures by adjusting Qt component configuration and making Qt version-specific string handling compatible with both Qt5 and Qt6.
Bug Fixes: