Skip to content

Commit ad44a57

Browse files
re2zerodeepin-bot[bot]
authored andcommitted
fix: Fix Qt5 build failed issue
- 在 CMakeLists.txt 中为 Qt6 正确配置 OpenGL 和 OpenGLWidgets 依赖项 - 更新 DeviceInput.cpp 中的 Qt 版本兼容性代码,使用条件编译处理字符串截取方法差异 Log: Fix Qt5 build failed issue.
1 parent f97d027 commit ad44a57

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ ui_*.h
2929
Makefile*
3030
*build-*
3131
build/
32+
.cache/
3233

3334
# Qt unit tests
3435
target_wrapper.*

deepin-devicemanager/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,12 @@ set(QT_COMPONENTS
115115
Svg
116116
SvgWidgets
117117
Xml
118-
OpenGL
119118
Core
120119
)
121120

122121
# Add components only available in Qt6, remove SvgWidgets from Qt5
123122
if(${QT_VERSION_MAJOR} EQUAL 6)
124-
list(APPEND QT_COMPONENTS OpenGLWidgets)
123+
list(APPEND QT_COMPONENTS OpenGL OpenGLWidgets)
125124
else()
126125
# Remove SvgWidgets for Qt5 (not available)
127126
list(REMOVE_ITEM QT_COMPONENTS SvgWidgets)

deepin-devicemanager/src/DeviceManager/DeviceInput.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ void DeviceInput::setInfoFromHwinfo(const QMap<QString, QString> &mapInfo)
113113
}
114114
if (m_VID_PID.size() == 10) {
115115
m_VID = m_VID_PID.mid(2, 4);
116+
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
116117
m_PID = m_VID_PID.last(4);
118+
#else
119+
m_PID = m_VID_PID.right(4);
120+
#endif
117121
}
118122
m_Enable = false;
119123
// m_CanUninstall = !driverIsKernelIn(m_Driver);

0 commit comments

Comments
 (0)