diff --git a/CMakeLists.txt b/CMakeLists.txt index 51e6212..cb835b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,8 +2,19 @@ cmake_minimum_required(VERSION 3.5) project(OneLevelXmlOpr VERSION 0.1 LANGUAGES CXX) +# 获取环境变量 HOME +if (DEFINED ENV{HOME}) + set(USER_HOME $ENV{HOME}) +else() + message(FATAL_ERROR "HOME environment variable is not set.") +endif() + +# 打印用户目录 +message(STATUS "User home directory: ${USER_HOME}") + set(CMAKE_PREFIX_PATH "C:/Qt/6.6.3/msvc2019_64" + "${USER_HOME}/Qt5.14.2/5.14.2/gcc_64/" ) set(CMAKE_AUTOUIC ON) @@ -39,37 +50,8 @@ add_compile_options(/wd4267) add_compile_options(-D_CRT_SECURE_NO_WARNINGS) endif() -if(${QT_VERSION_MAJOR} GREATER_EQUAL 6) - qt_add_executable(OneLevelXmlOpr - MANUAL_FINALIZATION - ${PROJECT_SOURCES} - ) -# Define target properties for Android with Qt 6 as: -# set_property(TARGET OneLevelXmlOpr 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(OneLevelXmlOpr 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") - else() - add_executable(OneLevelXmlOpr - ${PROJECT_SOURCES} - ) - endif() -endif() - +add_executable(OneLevelXmlOpr ${PROJECT_SOURCES}) target_link_libraries(OneLevelXmlOpr 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.OneLevelXmlOpr) -endif() set_target_properties(OneLevelXmlOpr PROPERTIES ${BUNDLE_ID_OPTION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} @@ -78,13 +60,3 @@ set_target_properties(OneLevelXmlOpr PROPERTIES WIN32_EXECUTABLE TRUE ) -include(GNUInstallDirs) -install(TARGETS OneLevelXmlOpr - BUNDLE DESTINATION . - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) - -if(QT_VERSION_MAJOR EQUAL 6) - qt_finalize_executable(OneLevelXmlOpr) -endif() diff --git a/MainWidget.cpp b/MainWidget.cpp index ce0f47e..92e0d92 100644 --- a/MainWidget.cpp +++ b/MainWidget.cpp @@ -104,10 +104,10 @@ MainWidget::MainWidget(QWidget* parent) : QWidget(parent), ui(new Ui::MainWidget settings.endGroup(); //QFile qss_file("://qss/lightblue.css"); - // QFile qss_file("://qss/flatgray.css"); - // if (qss_file.open(QFile::ReadOnly)) { - // qApp->setStyleSheet(qss_file.readAll()); - // } + QFile qss_file("://qss/flatgray.css"); + if (qss_file.open(QFile::ReadOnly)) { + qApp->setStyleSheet(qss_file.readAll()); + } init_menu(); diff --git a/main.cpp b/main.cpp index d2194e3..4cf99c8 100644 --- a/main.cpp +++ b/main.cpp @@ -10,8 +10,6 @@ int main(int argc, char *argv[]) QFont font("Microsoft YaHei", 9); a.setFont(font); a.setStyle("fusion"); -#else - a.setStyle("windows"); #endif MainWidget w;