01b264fe97
- qdialog_showcase:wiki「6 对话框 QDialog」6.2–6.5 综合演示。含两套实现:
· Designer 表单版(dialog.{h,cpp,ui} + resources.qrc + source.gif,QMovie 播 GIF)
· 纯代码版(qt_dialog_showcase.cpp,单文件,QWidget 布满按钮逐个演示 QDialog 行为)
- lineedit_eye_toggle:子类化 QLineEdit,paintEvent 自绘小眼睛、mouseEvent 命中切换
echoMode,并与内置 clear button 动态避让(读 objectName=="clearButton" 子 widget 几何)。
含独立子目录 CMakeLists.txt 供单独打开(顶层 add_subdirectory 不递归)。
- file_io_demo:QFile/QTextStream/QDataStream/QFileInfo/QDir/QTextCodec/QJson 五主题
综合示例,每个按钮产出一个文件落到 demo_output/ 便于课堂手动查看。
构建注册:examples/CMakeLists.txt 用 add_teaching_example 注册前两个纯代码示例,
mandelbrot 多源文件单独 add_executable;calculator_mainwindow_qss 加 themes.qrc 与
AUTORCC;all_teaching_examples 依赖列表同步补齐。
附 lineedit_eye_toggle 设计文档(docs/superpowers/specs)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
46 lines
1.1 KiB
CMake
46 lines
1.1 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
|
|
project(qt_dialog_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_dialog_showcase
|
|
qt_dialog_showcase.cpp
|
|
dialog.cpp
|
|
dialog.h
|
|
dialog.ui
|
|
)
|
|
else()
|
|
add_executable(qt_dialog_showcase
|
|
dialog.cpp
|
|
dialog.h
|
|
dialog.ui
|
|
resources.qrc
|
|
qt_dialog_showcase.cpp)
|
|
endif()
|
|
|
|
target_link_libraries(qt_dialog_showcase PRIVATE Qt5::Widgets)
|