-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
196 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
--- | ||
BasedOnStyle: Google | ||
IndentWidth: 4 | ||
Language: Cpp | ||
AccessModifierOffset: -2 | ||
AllowShortBlocksOnASingleLine: Empty | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AllowShortIfStatementsOnASingleLine: Never | ||
AllowShortLoopsOnASingleLine: false | ||
BreakBeforeBraces: Mozilla | ||
BreakConstructorInitializers: BeforeComma | ||
BreakInheritanceList: BeforeComma | ||
ColumnLimit: 120 | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
PackConstructorInitializers: NextLine | ||
PointerAlignment: Right | ||
ReflowComments: true # 重排注释 | ||
SortIncludes: CaseSensitive | ||
UseTab: Never | ||
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html | ||
BasedOnStyle: Google # 基于Google的代码风格 | ||
IndentWidth: 4 # 缩进宽度为4个空格 | ||
Language: Cpp # 语言为C++ | ||
AccessModifierOffset: -2 # 访问修饰符偏移-2个空格 | ||
AllowShortBlocksOnASingleLine: Empty # 允许在单行上写短代码块(Empty表示不设置) | ||
AllowShortFunctionsOnASingleLine: Inline # 允许在单行上写短函数(Inline表示与函数声明在同一行) | ||
AllowShortIfStatementsOnASingleLine: Never # 禁止在单行上写短if语句 | ||
AllowShortLoopsOnASingleLine: false # 禁止在单行上写短循环 | ||
BreakBeforeBraces: Mozilla # 在大括号前换行,与Mozilla风格保持一致 | ||
BreakConstructorInitializers: BeforeComma # 在逗号前换行,适用于构造函数初始化列表 | ||
BreakInheritanceList: BeforeComma # 在逗号前换行,适用于继承列表 | ||
ColumnLimit: 120 # 限制每行代码的最大字符数为120个 | ||
DerivePointerAlignment: false # 不从指针对齐中派生(false表示不设置) | ||
DisableFormat: false # 不禁用格式化(false表示不设置) | ||
IndentPPDirectives: AfterHash # 在hash符号后缩进预处理指令 | ||
PackConstructorInitializers: NextLine # 在下一行打包构造函数初始化列表 | ||
PointerAlignment: Right # 指针对齐在右侧 | ||
ReflowComments: true # 重新排列注释(true表示开启) | ||
SortIncludes: CaseSensitive # 按字母顺序排序包含文件(CaseSensitive表示区分大小写) | ||
UseTab: Never # 从不使用制表符(Never表示不设置) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
build*/ | ||
.vscode/ | ||
/*[Bb]uild* | ||
|
||
# clangd | ||
.cache | ||
|
||
# JetBrains | ||
.idea/ | ||
|
||
# Visual Studio | ||
.vs/ | ||
html/ | ||
latex/ | ||
*.lnk | ||
CMakeLists.txt.user | ||
|
||
# Visual Studio Code | ||
.vscode/* | ||
!.vscode/launch.json | ||
|
||
# QtCreator | ||
*.user | ||
*.user.* | ||
|
||
# MacOS | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,7 @@ | ||
<h1 align="center">QT CMAKE DEMO</h1> | ||
# QT CMAKE DEMO | ||
|
||
<!-- 目录 --> | ||
# Content | ||
- [Content](#content) | ||
- [Build \& Install](#build--install) | ||
- [Dependencies](#dependencies) | ||
- [Build](#build) | ||
- [Example](#example) | ||
- [Origin \& References](#origin--references) | ||
这是基于 Qt 的 C++项目工程模板。用于制作库文件。 | ||
|
||
# Build & Install | ||
## Dependencies | ||
这也是一个点击就能增加功德的利器。 | ||
|
||
Qt >= 5.15.2 | ||
|
||
## Build | ||
|
||
```bash | ||
git clone --recurse-submodules [email protected]:QianMoth/qt-cmake-project.git | ||
cd nodeeditor-p | ||
mkdir build | ||
|
||
# Release | ||
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=Release | ||
cmake --build build --config Release | ||
|
||
# Debug | ||
cmake -S . -Bbuild -DCMAKE_BUILD_TYPE=Debug | ||
cmake --build build --config Debug | ||
``` | ||
# Example | ||
|
||
|
||
# Origin & References | ||
![WoodenFish](./docs/WoodenFish.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# 文档 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
add_subdirectory(demo) | ||
add_subdirectory(WoodenFish) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "MainWindow.h" | ||
|
||
#include <QApplication> | ||
#include <QIcon> | ||
#include <QKeyEvent> | ||
#include <QLabel> | ||
#include <QMessageBox> | ||
#include <QPushButton> | ||
#include <QString> | ||
#include <QVBoxLayout> | ||
#include <knock/Knock> | ||
|
||
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) | ||
{ | ||
setWindowTitle(tr("About ") + qAppName()); | ||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); | ||
|
||
auto *w = new QWidget(this); | ||
auto *layout = new QVBoxLayout(w); | ||
setCentralWidget(w); | ||
|
||
// logo显示 | ||
auto *logo = new QLabel(this); | ||
layout->addWidget(logo, 0, Qt::AlignCenter); | ||
logo->setPixmap(QApplication::windowIcon().pixmap(64)); | ||
|
||
// 点击会功德+1的计数按钮 | ||
auto *c = new knock::Knock(); | ||
auto *btn = new QPushButton(this); | ||
layout->addWidget(btn, 0, Qt::AlignCenter); | ||
connect(c, &knock::Knock::num_changed, btn, [btn](int num) { btn->setText("功德: " + QString::number(num)); }); | ||
c->set_num(0); | ||
connect(btn, &QPushButton::clicked, c, &knock::Knock::num_Knock); | ||
|
||
// 版本&系统信息 | ||
QString str("<h1>" + qAppName() + " " + qApp->applicationVersion() + "</h1>"); | ||
str += R"(<div>Created by <a href="https://zmoth.top" target="_blank">Moth</a>; </div>)"; | ||
str += "<div>Locale : " + QLocale::system().name() + "</div>"; | ||
str += "<div>OS : " + QSysInfo::prettyProductName() + "</div>"; | ||
str += "<div>CPU : " + QSysInfo::currentCpuArchitecture() + "</div>"; | ||
|
||
auto *info = new QLabel(str, this); | ||
layout->addWidget(info); | ||
info->setOpenExternalLinks(true); | ||
|
||
setFixedSize(sizeHint()); | ||
show(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
#include <QMainWindow> | ||
|
||
class MainWindow : public QMainWindow | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit MainWindow(QWidget *parent = nullptr); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.