update SelfInfoWidget

This commit is contained in:
xyz
2025-05-29 21:31:28 +08:00
parent beda1e32ad
commit 38f3a397fd
10 changed files with 283 additions and 44 deletions

View File

@ -9,14 +9,31 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
# 查找Qt版本
find_package(Qt6 COMPONENTS Widgets QUIET)
if(NOT Qt6_FOUND)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
set(QT_VERSION_MAJOR 5)
else()
set(QT_VERSION_MAJOR 6)
endif()
set(PROJECT_SOURCES
main.cpp
mainwidget.cpp
mainwidget.h
mainwidget.ui
main.cpp
mainwidget.cpp
mainwidget.h
mainwidget.ui
model/data.h
resource.qrc
sessionfriendarea.h
sessionfriendarea.cpp
debug.h
messageshowarea.h
messageshowarea.cpp
messageeditarea.h
messageeditarea.cpp
SelfInfoWidget.h
SelfInfoWidget.cpp
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
@ -24,45 +41,17 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET ClientChat APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(ClientChat SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
add_library(ClientChat SHARED ${PROJECT_SOURCES})
else()
add_executable(ClientChat
${PROJECT_SOURCES}
model/data.h
resource.qrc
sessionfriendarea.h sessionfriendarea.cpp
debug.h
messageshowarea.h messageshowarea.cpp
messageeditarea.h messageeditarea.cpp
)
add_executable(ClientChat ${PROJECT_SOURCES})
endif()
endif()
target_link_libraries(ClientChat PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.ClientChat)
endif()
set_target_properties(ClientChat PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
# Bundle设置
include(GNUInstallDirs)
install(TARGETS ClientChat