PDA

View Full Version : how to drag a file to github ?



tsuibin
23rd February 2016, 07:45
I was created a app ui, a file or program, represented by an icon,

I want draging a icon to github, and then the file upload to github
my drag code like this




QMimeData* mimeData = new QMimeData;
QList<QUrl> urls;
foreach (DesktopItemPointer pCheckedItem, m_checkedDesktopItems) {
urls.append(pCheckedItem->getRawUrl());
}

mimeData->setUrls(urls);

if (m_checkedDesktopItems.length() > 0){
QPixmap dragPixmap = getCheckedPixmap();
QDrag* pDrag = new QDrag(this);
pDrag->setMimeData(mimeData);
pDrag->setPixmap(dragPixmap);
QRect borderRect = getCheckedBorderRect();
pDrag->setHotSpot(QPoint(-borderRect.x() + QCursor::pos().x(), -borderRect.y() + QCursor::pos().y() ));
Qt::DropAction action = pDrag->exec(Qt::MoveAction | Qt::CopyAction, Qt::CopyAction);



code on github: https://github.com/linuxdeepin/dde-desktop/blob/master/views/desktopframe.cpp#L514

but the file can't upload, I suspect that the problem is with mimedata ...

github support drag file to upload

"File uploading is now available
You can now drag and drop files into your repositories. "
learn more https://help.github.com/articles/adding-a-file-to-a-repository/

anda_skoa
23rd February 2016, 09:46
What does "drag to github" mean?

Dragging into a special Github client app?
Dragging into a browser?
Dragging into a Git UI that works on a clone of a github repository?

Cheers,
_

tsuibin
24th February 2016, 01:29
can't Draging into a google chrome browser

firefox is ok