ruki 6 роки тому
батько
коміт
7fabee2776
2 змінених файлів з 66 додано та 10 видалено
  1. 34 5
      guide/project_examples.md
  2. 32 5
      zh-cn/guide/project_examples.md

+ 34 - 5
guide/project_examples.md

@@ -44,11 +44,11 @@ Create an empty project:
 v2.2.9 or higher:
 
 ```console
-$ xmake create -l c++ -t qt.console test
-$ xmake create -l c++ -t qt.static test
-$ xmake create -l c++ -t qt.shared test
-$ xmake create -l c++ -t qt.quickapp test
-$ xmake create -l c++ -t qt.widgetapp test
+$ xmake create -t qt.console test
+$ xmake create -t qt.static test
+$ xmake create -t qt.shared test
+$ xmake create -t qt.quickapp test
+$ xmake create -t qt.widgetapp test
 ```
 
 For more project templates see: `xmake create --help`
@@ -104,6 +104,17 @@ target("qt_console")
 
 ### Quick Application
 
+v2.2.9 or higher:
+
+```lua
+target("qt_quickapp")
+    add_rules("qt.quickapp")
+    add_files("src/*.cpp")
+    add_files("src/qml.qrc")
+```
+
+!> The new version provides the `qt.quickapp` rule, built-in QtQuick built-in rules, the use of simpler, the following version of the `qt.application` is still supported, backward compatible:
+
 ```lua
 target("qt_quickapp")
     add_rules("qt.application")
@@ -112,8 +123,23 @@ target("qt_quickapp")
     add_frameworks("QtQuick")
 ```
 
+!> If you are using your own compiled static version of the QT SDK, you need to switch to the `add_rules("qt.quickapp_static")` static rule, 
+because the linked libraries are different and need to be statically linked.
+
 ### Widgets Application
 
+v2.2.9 or higher:
+
+```lua
+target("qt_widgetapp")
+    add_rules("qt.widgetapp")
+    add_files("src/*.cpp")
+    add_files("src/mainwindow.ui")
+    add_files("src/mainwindow.h")  -- add files with Q_OBJECT meta (only for qt.moc)
+```
+
+!> The new version provides the `qt.widgetapp` rule, built-in QtWidgets built-in rules, the use of simpler, the following version of the `qt.application` is still supported, backward compatible:
+
 ```lua
 target("qt_widgetapp")
     add_rules("qt.application")
@@ -123,6 +149,9 @@ target("qt_widgetapp")
     add_frameworks("QtWidgets")
 ```
 
+!> If you are using your own compiled static version of the QT SDK, you need to switch to the `add_rules("qt.widgetapp_static")` static rule, 
+because the linked libraries are different and need to be statically linked.
+
 ### Android Application
 
 After the 2.2.6 version, you can directly switch to the android platform to compile the Quick/Widgets application, generate the apk package, and install it to the device via the `xmake install` command.

+ 32 - 5
zh-cn/guide/project_examples.md

@@ -44,11 +44,11 @@ target("test")
 v2.2.9以上版本:
 
 ```console
-$ xmake create -l c++ -t qt.console test
-$ xmake create -l c++ -t qt.static test
-$ xmake create -l c++ -t qt.shared test
-$ xmake create -l c++ -t qt.quickapp test
-$ xmake create -l c++ -t qt.widgetapp test
+$ xmake create -t qt.console test
+$ xmake create -t qt.static test
+$ xmake create -t qt.shared test
+$ xmake create -t qt.quickapp test
+$ xmake create -t qt.widgetapp test
 ```
 
 更多工程模板见:`xmake create --help`
@@ -106,6 +106,17 @@ target("qt_console")
 
 ### Quick应用程序
 
+v2.2.9以上版本:
+
+```lua
+target("qt_quickapp")
+    add_rules("qt.quickapp")
+    add_files("src/*.cpp") 
+    add_files("src/qml.qrc")
+```
+
+!> 新版本提供了`qt.quickapp`规则,内置了QtQuick的内建规则,使用更加简单,下面老版本的`qt.application`还是支持的,向下兼容:
+
 ```lua
 target("qt_quickapp")
     add_rules("qt.application")
@@ -114,8 +125,22 @@ target("qt_quickapp")
     add_frameworks("QtQuick")
 ```
 
+!> 如果使用的自己编译的static版本QT SDK,那么需要切换到`add_rules("qt.quickapp_static")`静态规则才行,因为链接的库是不同的,需要做静态链接。
+
 ### Widgets应用程序
 
+v2.2.9以上版本:
+
+```lua
+target("qt_widgetapp")
+    add_rules("qt.widgetapp")
+    add_files("src/*.cpp") 
+    add_files("src/mainwindow.ui")
+    add_files("src/mainwindow.h")  -- 添加带有 Q_OBJECT 的meta头文件
+```
+
+!> 新版本提供了`qt.widgetapp`规则,内置了QtWidgets的内建规则,使用更加简单,下面老版本的`qt.application`还是支持的,向下兼容:
+
 ```lua
 target("qt_widgetapp")
     add_rules("qt.application")
@@ -125,6 +150,8 @@ target("qt_widgetapp")
     add_frameworks("QtWidgets")
 ```
 
+!> 如果使用的自己编译的static版本QT SDK,那么需要切换到`add_rules("qt.widgetapp_static")`静态规则才行,因为链接的库是不同的,需要做静态链接。
+
 ### Android应用程序
 
 2.2.6之后版本,可以直接切到android平台编译Quick/Widgets应用程序,生成apk包,并且可通过`xmake install`命令安装到设备。