paip.提升用户体验------c++ 拖曳使用总结..
来源:互联网 发布:怎么下载同花顺云计算 编辑:程序博客网 时间:2024/05/16 07:50
paip.提升用户体验------c++ qt 拖曳使用总结..
作者Attilax , EMAIL:1466519819@qq.com
来源:attilax的专栏
地址:http://blog.csdn.net/attilax
1.头文件添加dragEnterEvent,dropEvent 俩个事件
------------------
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
2. 实现CPP
-------------
原理:
setAcceptDrops(true); // [[1]]: 使label可接受拖放操作
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
-------------------cpp--------------------
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setAcceptDrops(true);
//setAcceptDrops(true); // [[1]]: 使label可接受拖放操作
}
//ati c920
#include <QDragEnterEvent>
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("text/uri-list"))
event->acceptProposedAction();
}
void MainWindow::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty())
return;
QString fileName = urls.first().toLocalFile();
// if (fileName.isEmpty())
// return;
ui->lineEdit->setText(fileName);
// QMessageBox::about(NULL, "About", fileName);
// traveDir(fileName);
}
//c920 end
参考:
QT拖拽功能简介 - pcsuite的专栏 - 博客频道 - CSDN.NET.htm
作者Attilax , EMAIL:1466519819@qq.com
来源:attilax的专栏
地址:http://blog.csdn.net/attilax
1.头文件添加dragEnterEvent,dropEvent 俩个事件
------------------
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
2. 实现CPP
-------------
原理:
setAcceptDrops(true); // [[1]]: 使label可接受拖放操作
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
-------------------cpp--------------------
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setAcceptDrops(true);
//setAcceptDrops(true); // [[1]]: 使label可接受拖放操作
}
//ati c920
#include <QDragEnterEvent>
void MainWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("text/uri-list"))
event->acceptProposedAction();
}
void MainWindow::dropEvent(QDropEvent *event)
{
QList<QUrl> urls = event->mimeData()->urls();
if (urls.isEmpty())
return;
QString fileName = urls.first().toLocalFile();
// if (fileName.isEmpty())
// return;
ui->lineEdit->setText(fileName);
// QMessageBox::about(NULL, "About", fileName);
// traveDir(fileName);
}
//c920 end
参考:
QT拖拽功能简介 - pcsuite的专栏 - 博客频道 - CSDN.NET.htm
- paip.提升用户体验------c++ 拖曳使用总结..
- paip.提升用户体验与安全性---注册流程总结
- paip.提升用户体验---提高兼容性无JS支持总结
- paip.提升用户体验----错误信息提示结构总结
- paip.提升用户体验----c++ 源码字体自定义制造总结
- paip.提升用户体验----- 密码控件的使用
- paip.提升用户体验-----用户注册设计
- paip.提升用户体验之全角半角
- paip.提升用户体验---导入导出
- paip.提升用户体验---文件查找
- paip.提升用户体验---提示语
- paip.提升用户体验---注册异常记录
- paip.提升用户体验---搜索功能设计
- paip.提升用户体验----置顶菜单
- paip.提升用户体验---程序异常处理
- paip.提升用户体验与提升安全性----记住密码
- paip.提升用户体验与安全性----登录与权限流程总结
- paip.提升用户体验=----c++ qt 字体切换功能缺少的总结..
- .net中SessionState相关配置
- A星搜索_heuristic 算法
- 疯狂程序员(5)
- Java 基本功 之中断线程的理解
- 漫谈 Clustering (4): Spectral Clustering
- paip.提升用户体验------c++ 拖曳使用总结..
- spring完整配置文件
- Android 实现旋转键盘的例子
- OpenGL FBO (Frame Buffer Object) 帧缓冲对象
- windows socket实例
- 疯狂程序员(8)
- HDU 3642 Get The Treasury
- 关于读书
- Android模拟器点击进入所有应用程序界面后出现unfortunately,lanucher has stopped