atitit.D&D drag&drop拖拽文件到界面功能 html5 web 跟个java swing c#.net c++ 的总结
2014-12-13 23:20
1466 查看
atitit.D&D drag&drop拖拽文件到界面功能 html5 web 跟个java swing c#.net c++ 的总结
1. DND的操作流程 1
2. Html5 注解事件 document.dragover >>preventDefault 1
3. 代码(js) 1
4. C++ 实现拖曳 2
5. QT拖拽功能简介 - pcsuite的专栏 - 博客频道 - CSDN.NET.htm
2
dragleave事件::更改提示的颜色.
Drop 事件:处理文件..不过,好像html子能有文件名称,马文件路径..
注释::::拖曳距离,, 如果这个距离大于QApplication认定的拖动的最小距离(通常为四个象素),调用私有函数startDrag()开始拖动。通过判断距离可以避免因为用户手抖动引起的误操作
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
handleFiles = function(files) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
alert("aa"+file);
}
}
document.addEventListener("dragenter", function(e){
dropbox.style.borderColor = 'gray';
}, false);
document.addEventListener("dragleave", function(e){
dropbox.style.borderColor = 'silver';
}, false);
document.addEventListener("dragover", function(e){
e.stopPropagation();
e.preventDefault();
}, false);
document.addEventListener("drop", function(e){
e.stopPropagation();
e.preventDefault();
alert(e.dataTransfer.files);
handleFiles(e.dataTransfer.files);
// submit.disabled = false;
}, false);
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())
参考
HTML5文件实现拖拽上传 - caonidayecnblogs - 博客园.htm
1. DND的操作流程 1
2. Html5 注解事件 document.dragover >>preventDefault 1
3. 代码(js) 1
4. C++ 实现拖曳 2
5. QT拖拽功能简介 - pcsuite的专栏 - 博客频道 - CSDN.NET.htm
2
1. DND的操作流程
Dragenter 事件::更改提示的颜色..自动改变光标状态指示用户当前的控件是否是一个合法的drop地点dragleave事件::更改提示的颜色.
Drop 事件:处理文件..不过,好像html子能有文件名称,马文件路径..
注释::::拖曳距离,, 如果这个距离大于QApplication认定的拖动的最小距离(通常为四个象素),调用私有函数startDrag()开始拖动。通过判断距离可以避免因为用户手抖动引起的误操作
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
2. Html5 注解事件 document.dragover >>preventDefault
调用 preventDefault() 来避免浏览器对数据的默认处理(drop 事件的默认行为是以链接形式打开)3. 代码(js)
<script>handleFiles = function(files) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
alert("aa"+file);
}
}
document.addEventListener("dragenter", function(e){
dropbox.style.borderColor = 'gray';
}, false);
document.addEventListener("dragleave", function(e){
dropbox.style.borderColor = 'silver';
}, false);
document.addEventListener("dragover", function(e){
e.stopPropagation();
e.preventDefault();
}, false);
document.addEventListener("drop", function(e){
e.stopPropagation();
e.preventDefault();
alert(e.dataTransfer.files);
handleFiles(e.dataTransfer.files);
// submit.disabled = false;
}, false);
4. C++ 实现拖曳
雅十enter跟个drag事件..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())
参考
HTML5文件实现拖拽上传 - caonidayecnblogs - 博客园.htm
5. QT拖拽功能简介 - pcsuite的专栏 - 博客频道 - CSDN.NET.htm
相关文章推荐
- atitit.D&D drag&drop拖拽文件到界面功能 html5 web 跟个java swing c#.net c++ 的总结
- Atitit。D&D drag&drop拖拽功能c#.net java swing的对比与实现总结
- Atitit。D&D drag&drop拖拽功能c#.net java swing的对比与实现总结
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- atitit.泛型编程总结最佳实践 vO99 java c++ c#.net php
- Atitit. 悬浮窗口的实现 java swing c# .net c++ js html 的实现
- atitit.系统托盘图标的设计java swing c# .net c++ js
- atitit.泛型编程总结最佳实践 vO99 java c++ c#.net php
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- atitit.GUI图片非规则按钮跟动态图片切换的实现模式总结java .net c# c++ web html js
- ASP.NET AJAX (Atlas) 拖放(Drag & Drop)功能6种实现方法总结
- ASP.NET AJAX (Atlas) 拖放(Drag & Drop)功能6种实现方法总结
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- atitit.软件开发GUI 布局管理优缺点总结java swing wpf web html c++ qt php asp.net winform
- Atitit. 二进制数据ascii表示法,与base64编码解码api 设计标准化总结java php c#.net
- atitit.跨语言实现备份mysql数据库 为sql文件特性 api 兼容性java c#.net php js
- atitit.窗体静听esc退出本窗体java swing c# .net php
- atitit.js 与c# java交互html5化的原理与总结.doc