diff --git a/.gitignore b/.gitignore index a33891e..069d1a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -/cmake-build-release/ /cmake-build-debug/ +/cmake-build-release/ /.idea/ diff --git a/CMakeLists.txt b/CMakeLists.txt index b07c934..cd41670 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,17 +18,20 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED) -include_directories(resources - src) +# 添加qrc资源 +qt5_add_resources(QRC_FILES resources/img.qrc) + +#include_directories(resources +# src) IF (CMAKE_BUILD_TYPE STREQUAL Debug) add_executable(${PROJECT_NAME} resources/app_win32.rc - ${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS}) + ${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS} ${QRC_FILES}) else(CMAKE_BUILD_TYPE STREQUAL Release) add_executable(${PROJECT_NAME} WIN32 resources/app_win32.rc - ${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS}) + ${DIR_MAIN_SRCS} ${DIR_RESOURCES_SRCS} ${DIR_SRC_SRCS} ${QRC_FILES}) ENDIF() target_link_libraries(${PROJECT_NAME} diff --git a/resources/close.jpeg b/resources/close.png similarity index 100% rename from resources/close.jpeg rename to resources/close.png diff --git a/resources/fullscreen3.jpeg b/resources/fullscreen3.png similarity index 100% rename from resources/fullscreen3.jpeg rename to resources/fullscreen3.png diff --git a/resources/fullscreen4.jpeg b/resources/fullscreen4.png similarity index 100% rename from resources/fullscreen4.jpeg rename to resources/fullscreen4.png diff --git a/resources/img.qrc b/resources/img.qrc new file mode 100644 index 0000000..43e7a68 --- /dev/null +++ b/resources/img.qrc @@ -0,0 +1,11 @@ + + + favicon.ico + + + close.png + fullscreen3.png + fullscreen4.png + min.png + + \ No newline at end of file diff --git a/resources/min.jpeg b/resources/min.png similarity index 100% rename from resources/min.jpeg rename to resources/min.png diff --git a/src/widget.cpp b/src/widget.cpp index 5670ead..05a0e5e 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -31,9 +31,9 @@ Widget::Widget(QWidget *parent) connect(ui->btnMin, SIGNAL(clicked()), this, SLOT(btnMinClickedSlot())); connect(ui->btnClose, SIGNAL(clicked()), this, SLOT(btnCloseClickedSlot())); - ui->btnMin->setStyleSheet("border-image: url(../resources/min.jpeg)"); - ui->btnMax->setStyleSheet("border-image: url(../resources/fullscreen3.jpeg)"); - ui->btnClose->setStyleSheet("border-image: url(../resources/close.jpeg)"); + ui->btnMin->setStyleSheet("border-image: url(:/png/min.png)"); + ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen3.png)"); + ui->btnClose->setStyleSheet("border-image: url(:/png/close.png)"); renameFile = new Rename(); @@ -115,15 +115,15 @@ void Widget::closeEvent(QCloseEvent *event) void Widget::btnMaxClickedSlot() { - ui->btnMax->setStyleSheet("border-image: url(../resources/fullscreen4.jpeg)"); + ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen4.png)"); if(this->isMaximized()){ ui->layoutMain->setMargin(9); - ui->btnMax->setStyleSheet("border-image: url(../resources/fullscreen3.jpeg)"); + ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen3.png)"); this->showNormal(); } else{ ui->layoutMain->setMargin(0); - ui->btnMax->setStyleSheet("border-image: url(../resources/fullscreen4.jpeg)"); + ui->btnMax->setStyleSheet("border-image: url(:/png/fullscreen4.png)"); this->showMaximized(); } } diff --git a/windeploy/FileRename.exe b/windeploy/FileRename.exe index 7abcf8e..e79ede0 100644 Binary files a/windeploy/FileRename.exe and b/windeploy/FileRename.exe differ