|
@@ -52,6 +52,11 @@ public:
|
|
QString Label; //!< used in file dialogs
|
|
QString Label; //!< used in file dialogs
|
|
QStringList NameFilters; //!< Regular expression (in wildcard mode) used to help the user to complete the line
|
|
QStringList NameFilters; //!< Regular expression (in wildcard mode) used to help the user to complete the line
|
|
QDir::Filters Filters; //!< Type of path (file, dir...)
|
|
QDir::Filters Filters; //!< Type of path (file, dir...)
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+ QFileDialog::Options DialogOptions;
|
|
|
|
+#else
|
|
|
|
+ ctkPathLineEdit::Options DialogOptions;
|
|
|
|
+#endif
|
|
|
|
|
|
bool HasValidInput; //!< boolean that stores the old state of valid input
|
|
bool HasValidInput; //!< boolean that stores the old state of valid input
|
|
|
|
|
|
@@ -182,6 +187,28 @@ ctkPathLineEdit::Filters ctkPathLineEdit::filters()const
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+void ctkPathLineEdit::setOptions(const QFileDialog::Options& dialogOptions)
|
|
|
|
+#else
|
|
|
|
+void ctkPathLineEdit::setOptions(const Options& dialogOptions)
|
|
|
|
+#endif
|
|
|
|
+{
|
|
|
|
+ Q_D(ctkPathLineEdit);
|
|
|
|
+ d->DialogOptions = dialogOptions;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+const QFileDialog::Options& ctkPathLineEdit::options()const
|
|
|
|
+#else
|
|
|
|
+const ctkPathLineEdit::Options& ctkPathLineEdit::options()const
|
|
|
|
+#endif
|
|
|
|
+{
|
|
|
|
+ Q_D(const ctkPathLineEdit);
|
|
|
|
+ return d->DialogOptions;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
void ctkPathLineEdit::browse()
|
|
void ctkPathLineEdit::browse()
|
|
{
|
|
{
|
|
Q_D(ctkPathLineEdit);
|
|
Q_D(ctkPathLineEdit);
|
|
@@ -190,18 +217,33 @@ void ctkPathLineEdit::browse()
|
|
{
|
|
{
|
|
if ( d->Filters & QDir::Writable) // load or save
|
|
if ( d->Filters & QDir::Writable) // load or save
|
|
{
|
|
{
|
|
- path = QFileDialog::getSaveFileName(this,
|
|
|
|
|
|
+ path = QFileDialog::getSaveFileName(
|
|
|
|
+ this,
|
|
tr("Select a file to save "),
|
|
tr("Select a file to save "),
|
|
- this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory : this->currentPath(),
|
|
|
|
- d->NameFilters.join(";;"));
|
|
|
|
|
|
+ this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory :
|
|
|
|
+ this->currentPath(),
|
|
|
|
+ d->NameFilters.join(";;"),
|
|
|
|
+ 0,
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+ d->DialogOptions);
|
|
|
|
+#else
|
|
|
|
+ QFlags<QFileDialog::Option>(int(d->DialogOptions)));
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
path = QFileDialog::getOpenFileName(
|
|
path = QFileDialog::getOpenFileName(
|
|
this,
|
|
this,
|
|
QString("Open a file"),
|
|
QString("Open a file"),
|
|
- this->currentPath().isEmpty()? ctkPathLineEditPrivate::sCurrentDirectory : this->currentPath(),
|
|
|
|
- d->NameFilters.join(";;"));
|
|
|
|
|
|
+ this->currentPath().isEmpty()? ctkPathLineEditPrivate::sCurrentDirectory :
|
|
|
|
+ this->currentPath(),
|
|
|
|
+ d->NameFilters.join(";;"),
|
|
|
|
+ 0,
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+ d->DialogOptions);
|
|
|
|
+#else
|
|
|
|
+ QFlags<QFileDialog::Option>(int(d->DialogOptions)));
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else //directory
|
|
else //directory
|
|
@@ -209,7 +251,13 @@ void ctkPathLineEdit::browse()
|
|
path = QFileDialog::getExistingDirectory(
|
|
path = QFileDialog::getExistingDirectory(
|
|
this,
|
|
this,
|
|
QString("Select a directory..."),
|
|
QString("Select a directory..."),
|
|
- this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory : this->currentPath());
|
|
|
|
|
|
+ this->currentPath().isEmpty() ? ctkPathLineEditPrivate::sCurrentDirectory :
|
|
|
|
+ this->currentPath(),
|
|
|
|
+#ifdef USE_QFILEDIALOG_OPTIONS
|
|
|
|
+ d->DialogOptions);
|
|
|
|
+#else
|
|
|
|
+ QFlags<QFileDialog::Option>(int(d->DialogOptions)));
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
if (path.isEmpty())
|
|
if (path.isEmpty())
|
|
{
|
|
{
|