[Interest] status ti while dragEnterEvent and dragMoveEvent from window folder

Sujan Dasmahapatra sujan.dasmahapatra at gmail.com
Wed Feb 5 12:42:55 CET 2014


I have implemented a dragEnterEvent, dragMoveEvent and dropEvent. I am
dragging from windows folder some images to QWidget. while draging the
status tips are changing. like "+Copy"....How can we change this to an
icon.

I tried with QCursor change but it is not changing.

Attached is the screenshot.

Below is the code snipped:

void crop_step_load::dragEnterEvent(QDragEnterEvent *event)

{

    const QMimeData *mime=event->mimeData();

    if(mime->hasUrls())

    {


        event->accept();

    }

    else

        event->ignore();

}


void crop_step_load::dragLeaveEvent(QDragLeaveEvent *event)

{


    event->accept();


}


void crop_step_load::dragMoveEvent(QDragMoveEvent *event)

{


    const QMimeData *mime=event->mimeData();

    if(mime->hasUrls())

    {


        event->accept();

    }

    else

        event->ignore();

}


void crop_step_load::dropEvent(QDropEvent *event)

{

    const QMimeData *mime=event->mimeData();

    if(mime->hasUrls())

    {


        vector<string> files;

        QList<QUrl> data = mime->urls();


        // extract the local paths of the files

        for (int i=0; i<data.size();++i)

        {

            QUrl url=data[i];

            if(url.isLocalFile())

            {

                string filename=url.toLocalFile().toStdString();

                if(QDir(url.toLocalFile()).exists())

                {

                    auto dirfiles=scan_dir(filename,true);

                    files.insert(files.end(),dirfiles.begin(),dirfiles.end());

                }

                else

                    files.push_back(filename);

            }

        }

        emit load_files(files);

    }

}


Any help is highly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140205/fa5b3455/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screenshot.jpg
Type: image/jpeg
Size: 84938 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140205/fa5b3455/attachment.jpg>


More information about the Interest mailing list