diff --git a/docs/teaching/examples/mainwindow_showcase/CMakeLists.txt b/docs/teaching/examples/mainwindow_showcase/CMakeLists.txt new file mode 100644 index 0000000..c923e88 --- /dev/null +++ b/docs/teaching/examples/mainwindow_showcase/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.5) + +project(qt_mainwindow_showcase LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# QtCreator supports the following variables for Android, which are identical to qmake Android variables. +# Check http://doc.qt.io/qt-5/deployment-android.html for more information. +# They need to be set before the find_package(Qt5 ...) call. + +#if(ANDROID) +# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android") +# if (ANDROID_ABI STREQUAL "armeabi-v7a") +# set(ANDROID_EXTRA_LIBS +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so +# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so) +# endif() +#endif() + +find_package(Qt5 COMPONENTS Widgets REQUIRED) + +if(ANDROID) + add_library(qt_mainwindow_showcase + main.cpp + mainwindow_showcase.cpp + mainwindow_showcase.h + mainwindow2.cpp + mainwindow2.h + mainwindow2.ui + mainwindow.ui + ) +else() +add_executable(qt_mainwindow_showcase + main.cpp + mainwindow_showcase.cpp + mainwindow_showcase.h + mainwindow2.cpp + mainwindow2.h + mainwindow2.ui + mainwindow.ui + mainwindow.qrc) +endif() + +target_link_libraries(qt_mainwindow_showcase PRIVATE Qt5::Widgets) diff --git a/docs/teaching/examples/mainwindow_showcase/mainwindow.qrc b/docs/teaching/examples/mainwindow_showcase/mainwindow.qrc index abc19cf..3678785 100644 --- a/docs/teaching/examples/mainwindow_showcase/mainwindow.qrc +++ b/docs/teaching/examples/mainwindow_showcase/mainwindow.qrc @@ -6,4 +6,8 @@ icons/about.png icons/dock.png + + icons/about.png + + diff --git a/docs/teaching/examples/mainwindow_showcase/mainwindow.ui b/docs/teaching/examples/mainwindow_showcase/mainwindow.ui index 2f43d8d..3113020 100644 --- a/docs/teaching/examples/mainwindow_showcase/mainwindow.ui +++ b/docs/teaching/examples/mainwindow_showcase/mainwindow.ui @@ -14,10 +14,9 @@ QMainWindow 教学综合示例 - + :/icons/app.png:/icons/app.png - @@ -46,14 +45,13 @@ - 0 0 720 - 22 + 21 @@ -95,9 +93,7 @@ - - 主工具栏 @@ -113,7 +109,6 @@ - 浮动窗口 @@ -138,36 +133,35 @@ - - + :/icons/new.png:/icons/new.png 新建 - - Ctrl+N - 清空编辑区(5.5 中心部件) + + Ctrl+N + - + :/icons/quit.png:/icons/quit.png 退出 - - Ctrl+Q - 退出程序 + + Ctrl+Q + @@ -213,7 +207,7 @@ - + :/icons/dock.png:/icons/dock.png @@ -281,7 +275,7 @@ - + :/icons/about.png:/icons/about.png @@ -292,8 +286,6 @@ - - - + diff --git a/docs/teaching/examples/mainwindow_showcase/mainwindow2.cpp b/docs/teaching/examples/mainwindow_showcase/mainwindow2.cpp new file mode 100644 index 0000000..2f2e368 --- /dev/null +++ b/docs/teaching/examples/mainwindow_showcase/mainwindow2.cpp @@ -0,0 +1,14 @@ +#include "mainwindow2.h" +#include "ui_mainwindow2.h" + +MainWindow2::MainWindow2(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow2) +{ + ui->setupUi(this); +} + +MainWindow2::~MainWindow2() +{ + delete ui; +} diff --git a/docs/teaching/examples/mainwindow_showcase/mainwindow2.h b/docs/teaching/examples/mainwindow_showcase/mainwindow2.h new file mode 100644 index 0000000..13ab424 --- /dev/null +++ b/docs/teaching/examples/mainwindow_showcase/mainwindow2.h @@ -0,0 +1,22 @@ +#ifndef MAINWINDOW2_H +#define MAINWINDOW2_H + +#include + +namespace Ui { +class MainWindow2; +} + +class MainWindow2 : public QMainWindow +{ + Q_OBJECT + +public: + explicit MainWindow2(QWidget *parent = nullptr); + ~MainWindow2(); + +private: + Ui::MainWindow2 *ui; +}; + +#endif // MAINWINDOW2_H diff --git a/docs/teaching/examples/mainwindow_showcase/mainwindow2.ui b/docs/teaching/examples/mainwindow_showcase/mainwindow2.ui new file mode 100644 index 0000000..f0e7847 --- /dev/null +++ b/docs/teaching/examples/mainwindow_showcase/mainwindow2.ui @@ -0,0 +1,66 @@ + + + MainWindow2 + + + + 0 + 0 + 640 + 480 + + + + MainWindow + + + + + + 0 + 0 + 640 + 21 + + + + + &File + + + + + + Edit + + + + + + Help + + + + + + + + + + + + &Open + + + Alt+O + + + + + About Me + + + + + +