diff widgets/InteractiveFileFinder.cpp @ 831:831188672987

Make it possible to set the parent widget
author Chris Cannam
date Wed, 13 Aug 2014 16:42:25 +0100
parents 9c272d39c3e3
children c02c51ae5238 a429b2acb45d
line wrap: on
line diff
--- a/widgets/InteractiveFileFinder.cpp	Fri Jul 25 17:02:29 2014 +0100
+++ b/widgets/InteractiveFileFinder.cpp	Wed Aug 13 16:42:25 2014 +0100
@@ -34,7 +34,8 @@
 
 InteractiveFileFinder::InteractiveFileFinder() :
     m_sessionExtension("sv"),
-    m_lastLocatedLocation("")
+    m_lastLocatedLocation(""),
+    m_parent(0)
 {
     SVDEBUG << "Registering interactive file finder" << endl;
     FileFinder::registerFileFinder(this);
@@ -45,6 +46,12 @@
 }
 
 void
+InteractiveFileFinder::setParentWidget(QWidget *parent)
+{
+    getInstance()->m_parent = parent;
+}
+
+void
 InteractiveFileFinder::setApplicationSessionExtension(QString extension)
 {
     m_sessionExtension = extension;
@@ -162,7 +169,7 @@
 
     // Use our own QFileDialog just for symmetry with getSaveFileName below
 
-    QFileDialog dialog;
+    QFileDialog dialog(m_parent);
     dialog.setNameFilters(filter.split('\n'));
     dialog.setWindowTitle(title);
     dialog.setDirectory(lastPath);
@@ -306,7 +313,7 @@
     // Use our own QFileDialog instead of static functions, as we may
     // need to adjust the file extension based on the selected filter
 
-    QFileDialog dialog;
+    QFileDialog dialog(m_parent);
 
     QStringList filters = filter.split('\n');