Add drag and drop support
This commit is contained in:
1 parent
ab0637a889
commit
95c72d10e3
3 files changed
+51
-1
No files matched your search
@@ -64,6 +64,9 @@ plaYUVerApp::plaYUVerApp()
|
||||
|
||||
playingTimer = new QTimer( this );
|
||||
|
||||
setAcceptDrops( true );
|
||||
mdiArea->setAcceptDrops( true );
|
||||
|
||||
connect( playingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
|
||||
|
||||
}
|
||||
@@ -462,6 +465,48 @@ Void plaYUVerApp::createStatusBar()
|
||||
statusBar()->showMessage( tr( "Ready" ) );
|
||||
}
|
||||
|
||||
/*
|
||||
* Drag and drop functions
|
||||
*/
|
||||
void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
|
||||
{
|
||||
//setText(tr("<drop content>"));
|
||||
setBackgroundRole( QPalette::Highlight );
|
||||
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
void plaYUVerApp::dropEvent( QDropEvent *event )
|
||||
{
|
||||
|
||||
const QMimeData *mimeData = event->mimeData();
|
||||
|
||||
QList<QUrl> urlList = mimeData->urls();
|
||||
|
||||
if( urlList.size() == 1 )
|
||||
{
|
||||
QString fileName = urlList.at( 0 ).toLocalFile();
|
||||
|
||||
m_cLastOpenPath = QFileInfo( fileName ).path();
|
||||
|
||||
QMdiSubWindow *existing = findImageInterface( fileName );
|
||||
if( !existing )
|
||||
{
|
||||
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createImageInterface();
|
||||
if( interfaceChild->loadFile( fileName ) )
|
||||
{
|
||||
addImageInterface( interfaceChild );
|
||||
statusBar()->showMessage( tr( "File loaded" ), 2000 );
|
||||
interfaceChild->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
interfaceChild->close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::readSettings()
|
||||
{
|
||||
QSettings settings( "IT", "YUV Player" );
|
||||
|
||||
Reference in new issue
Block a user