12 event->acceptProposedAction( );
16 event->acceptProposedAction( );
24 const QMimeData *mimeData =
event->mimeData( );
26 qDebug( ) <<
"mime: " << mimeData->text( );
27 if( mimeData->hasText( ) ) {
28 QString
file = mimeData->text( ).remove(
"file://" ).remove(
"\r\n" );
29 qDebug( ) <<
"text: " << file;
30 QFileInfo info( file );
31 qDebug( ) <<
"file: " << info.isFile( );
32 qDebug( ) <<
"folder: " << info.isDir( );
33 qDebug( ) <<
"suffix: " << info.completeSuffix( );
34 if( objectName( ) ==
"graphicsViewOutput" ) {
35 emit
saveFile( event->mimeData( )->text( ) );
38 if( info.isFile( ) ) {
41 else if( info.isDir( ) ) {
49 fitInView( scene( )->itemsBoundingRect( ), Qt::KeepAspectRatio );
51 QGraphicsView::resizeEvent( event );
virtual void dragLeaveEvent(QDragLeaveEvent *event) override
void saveFile(const QString &item)
void dropImage(const QString &filePath)
GraphicsView(QWidget *parent=0)
virtual void dropEvent(QDropEvent *event) override
virtual void dragEnterEvent(QDragEnterEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override
virtual void dragMoveEvent(QDragMoveEvent *event) override
void dropFolder(const QString &folderPath)