theme:默认flatgray主题。

This commit is contained in:
taynpg 2024-08-08 17:05:57 +08:00
parent 52d3da20ad
commit 7a1bee6708
3 changed files with 16 additions and 46 deletions

View File

@ -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()

View File

@ -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();

View File

@ -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;