From 8914ebf03d1998e0297c0cae5a26b0bf31ecf28d Mon Sep 17 00:00:00 2001 From: XMuli Date: Mon, 14 Mar 2022 19:59:16 +0800 Subject: [PATCH] feat: init Qt GUI project --- ExPicShot/.gitignore | 73 ++++++++++++++++++++++++++++++++++++++++ ExPicShot/CMakeLists.txt | 34 +++++++++++++++++++ ExPicShot/main.cpp | 11 ++++++ ExPicShot/widget.cpp | 11 ++++++ ExPicShot/widget.h | 14 ++++++++ 5 files changed, 143 insertions(+) create mode 100644 ExPicShot/.gitignore create mode 100644 ExPicShot/CMakeLists.txt create mode 100644 ExPicShot/main.cpp create mode 100644 ExPicShot/widget.cpp create mode 100644 ExPicShot/widget.h diff --git a/ExPicShot/.gitignore b/ExPicShot/.gitignore new file mode 100644 index 0000000..1358d83 --- /dev/null +++ b/ExPicShot/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/ExPicShot/CMakeLists.txt b/ExPicShot/CMakeLists.txt new file mode 100644 index 0000000..22a8ad0 --- /dev/null +++ b/ExPicShot/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.5) + +project(ExPicShot VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) + +set(PROJECT_SOURCES + main.cpp + widget.cpp + widget.h +) + +add_executable(ExPicShot + ${PROJECT_SOURCES} +) + +target_link_libraries(ExPicShot PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) + +set_target_properties(ExPicShot PROPERTIES + MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com + MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} + MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} +) + diff --git a/ExPicShot/main.cpp b/ExPicShot/main.cpp new file mode 100644 index 0000000..c3efeb4 --- /dev/null +++ b/ExPicShot/main.cpp @@ -0,0 +1,11 @@ +#include "widget.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.show(); + return a.exec(); +} diff --git a/ExPicShot/widget.cpp b/ExPicShot/widget.cpp new file mode 100644 index 0000000..607997a --- /dev/null +++ b/ExPicShot/widget.cpp @@ -0,0 +1,11 @@ +#include "widget.h" + +Widget::Widget(QWidget *parent) + : QWidget(parent) +{ +} + +Widget::~Widget() +{ +} + diff --git a/ExPicShot/widget.h b/ExPicShot/widget.h new file mode 100644 index 0000000..041ff0d --- /dev/null +++ b/ExPicShot/widget.h @@ -0,0 +1,14 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include + +class Widget : public QWidget +{ + Q_OBJECT + +public: + Widget(QWidget *parent = nullptr); + ~Widget(); +}; +#endif // WIDGET_H