Browse Source

v1.0.1 增加qrc文件,修改cmakelist

master
tianzhendong 2 years ago
parent
commit
8ec6e4644d
  1. 2
      .gitignore
  2. 11
      CMakeLists.txt
  3. 0
      resources/close.png
  4. 0
      resources/fullscreen3.png
  5. 0
      resources/fullscreen4.png
  6. 11
      resources/img.qrc
  7. 0
      resources/min.png
  8. 12
      src/widget.cpp
  9. BIN
      windeploy/FileRename.exe

2
.gitignore

@ -1,3 +1,3 @@
/cmake-build-release/
/cmake-build-debug/
/cmake-build-release/
/.idea/

11
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}

0
resources/close.jpeg → resources/close.png

Before

Width:  |  Height:  |  Size: 342 B

After

Width:  |  Height:  |  Size: 342 B

0
resources/fullscreen3.jpeg → resources/fullscreen3.png

Before

Width:  |  Height:  |  Size: 352 B

After

Width:  |  Height:  |  Size: 352 B

0
resources/fullscreen4.jpeg → resources/fullscreen4.png

Before

Width:  |  Height:  |  Size: 357 B

After

Width:  |  Height:  |  Size: 357 B

11
resources/img.qrc

@ -0,0 +1,11 @@
<RCC>
<qresource prefix="img">
<file>favicon.ico</file>
</qresource>
<qresource prefix="png">
<file>close.png</file>
<file>fullscreen3.png</file>
<file>fullscreen4.png</file>
<file>min.png</file>
</qresource>
</RCC>

0
resources/min.jpeg → resources/min.png

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

12
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();
}
}

BIN
windeploy/FileRename.exe

Binary file not shown.
Loading…
Cancel
Save