@ -35,6 +35,17 @@
@@ -35,6 +35,17 @@
is that the < a href = " http://qt-project.org/doc/qt-5/qfiledialog.html " > QFileDialog < / a > implementations of these use the native os dialogs . On OSX these
these can intermittently hang . So instead here we use the native dialogs . It also allows
use to catch these dialogs for unit testing .
@ remark If you need to know what type of file was returned by these functions , you can use something like :
@ code { . cpp }
QString filename = QGCFileDialog : : getSaveFileName ( this , tr ( " Save File " ) , " ~/ " , " Foo files (*.foo);;All Files (*.*) " , " foo " ) ;
if ( ! filename . isEmpty ( ) ) {
QFileInfo fi ( filename ) ;
QString fileExtension ( fi . suffix ( ) ) ;
if ( fileExtension = = QString ( " foo " ) ) {
// do something
}
}
@ endcode
*/
class QGCFileDialog : public QFileDialog {
@ -96,8 +107,8 @@ public:
@@ -96,8 +107,8 @@ public:
@ param [ in ] caption The caption displayed at the top of the dialog .
@ param [ in ] dir The initial directory shown to the user .
@ param [ in ] filter The filter used for selecting the file type .
@ param [ in ] options Set the various options that affect the look and feel of the dialog .
@ param [ in ] defaultSuffix Specifies a string that will be added to the filename if it has no suffix already . The suffix is typically used to indicate the file type ( e . g . " txt " indicates a text file ) .
@ param [ in ] options Set the various options that affect the look and feel of the dialog .
@ return The full path and filename to be used to save the file or \ c QString ( " " ) if none .
@ sa < a href = " http://qt-project.org/doc/qt-5/qfiledialog.html#getSaveFileName " > QFileDialog : : getSaveFileName ( ) < / a >
@ remark If a default suffix is given , it will be appended to the filename if the user does not enter one themselves . That is , if the user simply enters \ e foo and the default suffix is set to \ e bar ,
@ -108,8 +119,8 @@ public:
@@ -108,8 +119,8 @@ public:
const QString & caption = QString ( ) ,
const QString & dir = QString ( ) ,
const QString & filter = QString ( ) ,
Options options = 0 ,
QString * defaultSuffix = 0 ) ;
const QString & defaultSuffix = QString ( ) ,
Options options = 0 ) ;
private slots :
/// @brief The exec slot is private becasue we only want QGCFileDialog users to use the static methods. Otherwise it will break