- 博客(3)
- 问答 (1)
- 收藏
- 关注
原创 QT 三行构造 文件管理器
QT 控件里没有现成的 文件浏览器 。需要用到时 手撸极端繁琐,好在 QT诀窍。基于 QTreeView + QDir 可以三行就构建一个文件浏览器。赞!UI 里添加 QTreeView在类构造中写下: QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); ui->filetree->setModel(model);
2021-04-21 21:51:00
203
原创 QT PaintEvent重载后注意事项
QT PaintEvent重载后注意事项PaintEvent继承重载可以实现自定义功能。子类继承PaintEvent 后原定义的样式需要在PaintEvent 里重新调用画刷void MImageView::paintEvent(QPaintEvent * event){ // 绘制样式 QStyleOption opt; opt.init(this); QPainter painter(this); style()->drawPrimitive(QSty
2020-09-09 18:40:53
1266
原创 图像 矩形 定点/鼠标为中心缩放算法
图像 矩形 定点/鼠标为中心缩放算法图像 矩形 定点/鼠标为中心缩放算法条件,代码图像 矩形 定点/鼠标为中心缩放算法程序中 图像 或 矩形, 按照指定坐标不变缩放算法条件,代码图像矩形区域: Rect缩放系数:sim固定坐标点:pos求Rect 经过 sim 缩放后 Rect 的位移量:// 缩放后的矩形new_rect.size = Rect.size * sim;//前后缩放比例double new_sim = new_rect.width * 1.0 / Rect.width
2020-09-06 00:31:17
1960
1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人