myPath->setPathFilter( f );
}
+/*!
+ \brief Get currently used path widget options.
+ \return file or directory path options
+ \sa setPathOptions()
+*/
+QFileDialog::Options QtxPagePrefPathItem::pathOptions() const
+{
+ return myPath->pathOptions();
+}
+
+/*!
+ \brief Set path widget options.
+ \param f new file or directory path options
+ \sa pathOptions()
+*/
+void QtxPagePrefPathItem::setPathOptions( const QFileDialog::Options options )
+{
+ myPath->setPathOptions( options );
+}
+
+
/*!
\brief Store preference item to the resource manager.
\sa retrieve()
return pathType();
else if ( name == "path_filter" )
return pathFilter();
+ else if ( name == "path_options" )
+ return QVariant::fromValue(pathOptions());
else
return QtxPageNamedPrefItem::optionValue( name );
}
if ( val.canConvert( QVariant::String ) )
setPathFilter( val.toString() );
}
+ else if ( name == "path_options" )
+ {
+ if ( val.canConvert( QVariant::Int ) )
+ setPathOptions( (QFileDialog::Options)val.toInt() );
+ }
else
QtxPageNamedPrefItem::setOptionValue( name, val );
}
QString pathFilter() const;
void setPathFilter( const QString& );
+
+ QFileDialog::Options pathOptions() const;
+ void setPathOptions(const QFileDialog::Options);
virtual void store();
virtual void retrieve();
#include <QCompleter>
#include <QKeyEvent>
#include <QToolButton>
-#include <QFileDialog>
#include <QRegExpValidator>
static const char* browse_icon[] = {
updateState();
}
+/*!
+ \brief Set path file dialog options.
+ \param f new file or directory path options
+ \sa pathOptions()
+*/
+void QtxPathEdit::setPathOptions(const QFileDialog::Options options)
+{
+ if ( myOptions == options )
+ return;
+
+ myOptions = options;
+}
+
+/*!
+ \brief Get currently used path options.
+ \return file or directory path options
+ \sa setPathOptions()
+*/
+QFileDialog::Options QtxPathEdit::pathOptions() const
+{
+ return myOptions;
+}
+
+
/*!
\brief Called when user clicks "Browse" button.
switch ( pathType() )
{
case Qtx::PT_OpenFile:
- path = QFileDialog::getOpenFileName( myPath, QString(), initial, pathFilter() );
+ path = QFileDialog::getOpenFileName( myPath, QString(), initial, pathFilter(), nullptr, pathOptions() );
break;
case Qtx::PT_SaveFile:
- path = QFileDialog::getSaveFileName( myPath, QString(), initial, pathFilter() );
+ path = QFileDialog::getSaveFileName( myPath, QString(), initial, pathFilter(), nullptr, pathOptions() );
break;
case Qtx::PT_Directory:
- path = QFileDialog::getExistingDirectory( myPath, QString(), initial );
+ path = QFileDialog::getExistingDirectory( myPath, QString(), initial, pathOptions() );
break;
}
#include "Qtx.h"
#include <QFrame>
+#include <QFileDialog>
class QLineEdit;
QString pathFilter() const;
void setPathFilter( const QString& );
+ QFileDialog::Options pathOptions() const;
+ void setPathOptions( const QFileDialog::Options );
+
private slots:
void onBrowse( bool = false );
QLineEdit* myPath;
Qtx::PathType myType;
QString myFilter;
+ QFileDialog::Options myOptions;
bool myBrowse;
};