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>
21 lines
361 B
C++
21 lines
361 B
C++
#include "dialog.h"
|
|
#include "ui_dialog.h"
|
|
#include <QMovie>
|
|
#include <QDebug>
|
|
|
|
Dialog::Dialog(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::Dialog)
|
|
{
|
|
ui->setupUi(this);
|
|
this->pMovie = new QMovie(":/source.gif");
|
|
this->pMovie->start();
|
|
ui->label->setMovie(this->pMovie);
|
|
}
|
|
|
|
Dialog::~Dialog()
|
|
{
|
|
delete this->pMovie;
|
|
delete ui;
|
|
}
|