1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00

Merge pull request #140 from QtExcel/qt6beta

Qt6beta
This commit is contained in:
Jay Two 2021-02-12 01:36:37 +09:00 committed by GitHub
commit c8ca4f5bba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 407 additions and 79 deletions

6
.gitignore vendored
View File

@ -397,3 +397,9 @@ ASALocalRun/
/cmake_install.cmake
/CMakeFiles/
/Makefile
/QXlsx/CMakeCache.txt
/QXlsx/cmake_install.cmake
/QXlsx/CMakeFiles/
/QXlsx/Makefile

View File

@ -1,73 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(QXlsx VERSION 1.3.56 LANGUAGES CXX)
option(BUILD_SHARED_LIB "Build shared library (DLL)." ON)
include(GNUInstallDirs)
find_package(Qt5 CONFIG REQUIRED COMPONENTS Gui)
#------------------------------------------------------------------------------
# Library
#------------------------------------------------------------------------------
if (BUILD_SHARED_LIB)
add_library(QXlsx SHARED)
set_target_properties(QXlsx PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
if (UNIX)
# force linker to resolve all deps
set_target_properties(QXlsx PROPERTIES LINK_FLAGS "-Wl,--no-undefined")
endif (UNIX)
else (BUILD_SHARED_LIB)
add_library(QXlsx)
endif (BUILD_SHARED_LIB)
set_target_properties(QXlsx PROPERTIES
SOVERSION ${PROJECT_VERSION})
set_target_properties(QXlsx PROPERTIES AUTOMOC ON)
#------------------------------------------------------------------------------
# Target
#------------------------------------------------------------------------------
# Define target sources
file(GLOB_RECURSE files_cpp ${PROJECT_SOURCE_DIR}/QXlsx/source/*.cpp)
file(GLOB_RECURSE files_h ${PROJECT_SOURCE_DIR}/QXlsx/header/*.h)
target_sources(QXlsx PRIVATE
${files_cpp} ${files_h}
)
target_link_libraries(QXlsx PUBLIC Qt5::Gui Qt5::GuiPrivate)
target_compile_definitions(QXlsx PRIVATE
QT_NO_KEYWORDS
QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII
QT_STRICT_ITERATORS
QT_NO_URL_CAST_FROM_STRING
QT_NO_CAST_FROM_BYTEARRAY
QT_USE_QSTRINGBUILDER
QT_NO_SIGNALS_SLOTS_KEYWORDS
QT_USE_FAST_OPERATOR_PLUS
QT_DISABLE_DEPRECATED_BEFORE=0x050c00
)
target_include_directories(QXlsx
PRIVATE ${PROJECT_SOURCE_DIR}/QXlsx/header
INTERFACE ${CMAKE_INSTALL_FULL_INCLUDEDIR}/QXlsx)
configure_file(
${PROJECT_SOURCE_DIR}/CMake/QXlsxConfig.cmake.in
"${PROJECT_BINARY_DIR}/QXlsxConfig.cmake" @ONLY)
export(TARGETS QXlsx
FILE "${PROJECT_BINARY_DIR}/QXlsxTargets.cmake")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(${PROJECT_BINARY_DIR}/QXlsxConfigVersion.cmake
COMPATIBILITY AnyNewerVersion)
install(TARGETS QXlsx EXPORT QXlsxTargets)
install(FILES
${PROJECT_BINARY_DIR}/QXlsxConfig.cmake
${PROJECT_BINARY_DIR}/QXlsxConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/QXlsx/cmake)
install(EXPORT QXlsxTargets DESTINATION ${CMAKE_INSTALL_DATADIR}/QXlsx/cmake)
install(FILES ${files_h} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QXlsx)

84
DateTime/CMakeLists.txt Normal file
View File

@ -0,0 +1,84 @@
# CMakeLists.txt for Console Application
# TODO: Set minumum cmake version
cmake_minimum_required(VERSION 3.14)
# TODO: Set project name
project(DateTime LANGUAGES CXX)
# TODO: Set Your C++ version
set(CMAKE_CXX_STANDARD 11) # C++ 11
##########################
# bolier-plate code (1) {{
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED ${QXLSX_PARENTPATH})
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
endif(NOT DEFINED ${QXLSX_PARENTPATH})
if(NOT DEFINED ${QXLSX_HEADERPATH})
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
endif(NOT DEFINED ${QXLSX_HEADERPATH})
if(NOT DEFINED ${QXLSX_SOURCEPATH})
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
message("Current Path of QXlsx")
message(${QXLSX_PARENTPATH})
message(${QXLSX_HEADERPATH})
message(${QXLSX_SOURCEPATH})
include_directories(${QXLSX_HEADERPATH})
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
set(SRC_FILES ${QXLSX_CPP})
list(APPEND SRC_FILES ${QXLSX_H})
# bolier-plate code (1) }}
###########################
#########################
# Console Application {{
# TODO: set your source code
set(APP_SRC_FILES
main.cpp
test.cpp )
list(APPEND SRC_FILES ${APP_SRC_FILES})
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Console Application }}
########################
##########################
# bolier-plate code (2) {{
target_include_directories(${PROJECT_NAME} PRIVATE
${QXLSX_HEADERPATH}
${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
set(CMAKE_WIN32_EXECUTABLE OFF)
# bolier-plate code (2) }}
##########################

83
HelloWorld/CMakeLists.txt Normal file
View File

@ -0,0 +1,83 @@
# CMakeLists.txt for Console Application
# TODO: Set minumum cmake version
cmake_minimum_required(VERSION 3.14)
# TODO: Set project name
project(HelloWorld LANGUAGES CXX)
# TODO: Set Your C++ version
set(CMAKE_CXX_STANDARD 11) # C++ 11
##########################
# bolier-plate code (1) {{
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED ${QXLSX_PARENTPATH})
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
endif(NOT DEFINED ${QXLSX_PARENTPATH})
if(NOT DEFINED ${QXLSX_HEADERPATH})
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
endif(NOT DEFINED ${QXLSX_HEADERPATH})
if(NOT DEFINED ${QXLSX_SOURCEPATH})
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
message("Current Path of QXlsx")
message(${QXLSX_PARENTPATH})
message(${QXLSX_HEADERPATH})
message(${QXLSX_SOURCEPATH})
include_directories(${QXLSX_HEADERPATH})
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
set(SRC_FILES ${QXLSX_CPP})
list(APPEND SRC_FILES ${QXLSX_H})
# bolier-plate code (1) }}
###########################
#########################
# Console Application {{
# TODO: set your source code
set(APP_SRC_FILES
main.cpp)
list(APPEND SRC_FILES ${APP_SRC_FILES})
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Console Application }}
########################
##########################
# bolier-plate code (2) {{
target_include_directories(${PROJECT_NAME} PRIVATE
${QXLSX_HEADERPATH}
${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
set(CMAKE_WIN32_EXECUTABLE OFF)
# bolier-plate code (2) }}
##########################

86
Pump/CMakeLists.txt Normal file
View File

@ -0,0 +1,86 @@
# CMakeLists.txt for Console Application
# TODO: Set minumum cmake version
cmake_minimum_required(VERSION 3.14)
# TODO: Set project name
project(Pump LANGUAGES CXX)
# TODO: Set Your C++ version
set(CMAKE_CXX_STANDARD 11) # C++ 11
##########################
# bolier-plate code (1) {{
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED ${QXLSX_PARENTPATH})
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
endif(NOT DEFINED ${QXLSX_PARENTPATH})
if(NOT DEFINED ${QXLSX_HEADERPATH})
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
endif(NOT DEFINED ${QXLSX_HEADERPATH})
if(NOT DEFINED ${QXLSX_SOURCEPATH})
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
message("Current Path of QXlsx")
message(${QXLSX_PARENTPATH})
message(${QXLSX_HEADERPATH})
message(${QXLSX_SOURCEPATH})
include_directories(${QXLSX_HEADERPATH})
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
set(SRC_FILES ${QXLSX_CPP})
list(APPEND SRC_FILES ${QXLSX_H})
# bolier-plate code (1) }}
###########################
#########################
# Console Application {{
# TODO: set your source code
set(APP_SRC_FILES
main.cpp
test.cpp
pump.qrc
)
list(APPEND SRC_FILES ${APP_SRC_FILES})
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Console Application }}
########################
##########################
# bolier-plate code (2) {{
target_include_directories(${PROJECT_NAME} PRIVATE
${QXLSX_HEADERPATH}
${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
set(CMAKE_WIN32_EXECUTABLE OFF)
# bolier-plate code (2) }}
##########################

52
QXlsx/CMakeLists.txt Normal file
View File

@ -0,0 +1,52 @@
# CMakeLists.txt for QXlsx Library
cmake_minimum_required(VERSION 3.14)
project(QXlsx LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED ${QXLSX_PARENTPATH})
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
endif(NOT DEFINED ${QXLSX_PARENTPATH})
if(NOT DEFINED ${QXLSX_HEADERPATH})
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
endif(NOT DEFINED ${QXLSX_HEADERPATH})
if(NOT DEFINED ${QXLSX_SOURCEPATH})
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
message("Current Path of QXlsx")
message(${QXLSX_PARENTPATH})
message(${QXLSX_HEADERPATH})
message(${QXLSX_SOURCEPATH})
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
set(SRC_FILES ${QXLSX_CPP})
list(APPEND SRC_FILES ${QXLSX_H})
add_library(QXlsx STATIC
${SRC_FILES} )
target_include_directories(QXlsx PRIVATE ${QXLSX_HEADERPATH})
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
target_compile_definitions(QXlsx PRIVATE QXLSX_LIBRARY)

View File

@ -143,26 +143,33 @@ win32-g++ {
}
}
win32-msvc2013 {
message("compiling for visual studio 2013")
message("Compiling for Visual Studio 2013")
INCLUDEPATH += $${QXLSX_HEADERPATH}msvc2013
CONFIG(debug, debug|release) {
} else {
}
}
win32-msvc2015 {
message("compiling for visual studio 2015")
message("Compiling for Visual Studio 2015")
INCLUDEPATH += $${QXLSX_HEADERPATH}msvc2015
CONFIG(debug, debug|release) {
} else {
}
}
win32-msvc2017 {
message("compiling for visual studio 2017")
message("Compiling for Visual Studio 2017")
INCLUDEPATH += $${QXLSX_HEADERPATH}msvc2017
CONFIG(debug, debug|release) {
} else {
}
}
win32-msvc2019 {
message("Compiling for Visual Studio 2019")
INCLUDEPATH += $${QXLSX_HEADERPATH}msvc2019
CONFIG(debug, debug|release) {
} else {
}
}
unix {
!contains(QT_ARCH, x86_64){
LIB=lib32

View File

@ -41,7 +41,7 @@ class RichString
{
public:
RichString();
explicit RichString(const QString text);
explicit RichString(const QString& text);
RichString(const RichString &other);
~RichString();

View File

@ -47,7 +47,7 @@ RichString::RichString()
/*!
Constructs a plain string with the given \a text.
*/
RichString::RichString(const QString text)
RichString::RichString(const QString& text)
:d(new RichStringPrivate)
{
addFragment(text, Format());
@ -116,7 +116,7 @@ bool RichString::isNull() const
*/
bool RichString::isEmtpy() const
{
for (const QString &str : d->fragmentTexts) {
for (const auto& str : d->fragmentTexts) {
if (!str.isEmpty())
return false;
}

83
WhatType/CMakeLists.txt Normal file
View File

@ -0,0 +1,83 @@
# CMakeLists.txt for Console Application
# TODO: Set minumum cmake version
cmake_minimum_required(VERSION 3.14)
# TODO: Set project name
project(WhatType LANGUAGES CXX)
# TODO: Set Your C++ version
set(CMAKE_CXX_STANDARD 11) # C++ 11
##########################
# bolier-plate code (1) {{
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Gui REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Gui REQUIRED)
if(NOT DEFINED ${QXLSX_PARENTPATH})
set(QXLSX_PARENTPATH ${CMAKE_CURRENT_SOURCE_DIR}/../)
endif(NOT DEFINED ${QXLSX_PARENTPATH})
if(NOT DEFINED ${QXLSX_HEADERPATH})
set(QXLSX_HEADERPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/header/)
endif(NOT DEFINED ${QXLSX_HEADERPATH})
if(NOT DEFINED ${QXLSX_SOURCEPATH})
set(QXLSX_SOURCEPATH ${CMAKE_CURRENT_SOURCE_DIR}/../QXlsx/source/)
endif(NOT DEFINED ${QXLSX_SOURCEPATH})
message("Current Path of QXlsx")
message(${QXLSX_PARENTPATH})
message(${QXLSX_HEADERPATH})
message(${QXLSX_SOURCEPATH})
include_directories(${QXLSX_HEADERPATH})
file(GLOB QXLSX_CPP "${QXLSX_SOURCEPATH}/*.cpp")
file(GLOB QXLSX_H "${QXLSX_HEADERPATH}/*.h")
set(SRC_FILES ${QXLSX_CPP})
list(APPEND SRC_FILES ${QXLSX_H})
# bolier-plate code (1) }}
###########################
#########################
# Console Application {{
# TODO: set your source code
set(APP_SRC_FILES
main.cpp )
list(APPEND SRC_FILES ${APP_SRC_FILES})
add_executable(${PROJECT_NAME} ${SRC_FILES})
# Console Application }}
########################
##########################
# bolier-plate code (2) {{
target_include_directories(${PROJECT_NAME} PRIVATE
${QXLSX_HEADERPATH}
${CMAKE_CURRENT_SOURCE_DIR} )
target_link_libraries(${PROJECT_NAME}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::GuiPrivate
)
set(CMAKE_WIN32_EXECUTABLE OFF)
# bolier-plate code (2) }}
##########################