QGIS/python/gui/qgsfilewidget.sip

96 lines
3.1 KiB
Plaintext
Raw Normal View History

2016-01-11 16:52:39 +01:00
class QgsFileWidget : QWidget
2016-01-11 16:52:39 +01:00
{
%TypeHeaderCode
#include <qgsfilewidget.h>
2016-01-11 16:52:39 +01:00
%End
public:
2016-02-14 03:50:23 +01:00
/**
* @brief The StorageMode enum determines if the file picker should pick files or directories
*/
2016-01-11 16:52:39 +01:00
enum StorageMode
{
GetFile,
GetDirectory
2016-01-11 16:52:39 +01:00
};
2016-02-14 03:50:23 +01:00
/**
* @brief The RelativeStorage enum determines if path is absolute, relative to the current project path or relative to a defined default path.
*/
2016-01-11 16:52:39 +01:00
enum RelativeStorage
{
Absolute,
RelativeProject,
RelativeDefaultPath
};
2016-02-14 03:50:23 +01:00
/**
* @brief QgsFileWidget creates a widget for selecting a file or a folder.
*/
explicit QgsFileWidget( QWidget *parent /TransferThis/ );
2016-01-11 16:52:39 +01:00
~QgsFileWidget();
2016-01-11 16:52:39 +01:00
2016-02-14 03:50:23 +01:00
//! Returns the current file path
2016-01-11 16:52:39 +01:00
QString filePath();
//! Sets the file path
void setFilePath( QString path );
//! defines if the widget is readonly
void setReadOnly( bool readOnly );
//! returns the open file dialog title
QString dialogTitle() const;
/**
* @brief setDialogTitle defines the open file dialog title
* @note if not defined, the title is "Select a file" or "Select a directory" depending on the configuration.
*/
void setDialogTitle( const QString& title );
2016-01-11 16:52:39 +01:00
2016-02-14 03:50:23 +01:00
//! returns the filters used for QDialog::getOpenFileName
QString filter() const;
/**
* @brief setFilter sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.
* @param filter Only files that match the given filter are shown, it may be an empty string. If you want multiple filters, separate them with ';;',
*/
void setFilter( const QString &filter );
2016-01-11 16:52:39 +01:00
//! determines if the tool button is shown
bool fileWidgetButtonVisible() const;
2016-01-11 16:52:39 +01:00
//! determines if the tool button is shown
void setFileWidgetButtonVisible( bool visible );
2016-01-11 16:52:39 +01:00
//! determines if the file path will be shown as a link
bool useLink() const;
//! determines if the file path will be shown as a link
void setUseLink( bool useLink );
2016-02-14 03:50:23 +01:00
//! returns if the links shows the full path or not
2016-01-11 16:52:39 +01:00
bool fullUrl() const;
2016-02-14 03:50:23 +01:00
//! determines if the links shows the full path or not
2016-01-11 16:52:39 +01:00
void setFullUrl( bool fullUrl );
2016-02-14 03:50:23 +01:00
//! returns the default root path
2016-01-11 16:52:39 +01:00
QString defaultRoot() const;
2016-02-14 03:50:23 +01:00
//! determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
void setDefaultRoot( const QString& defaultRoot );
2016-01-11 16:52:39 +01:00
2016-02-14 03:50:23 +01:00
//! returns the storage mode (i.e. file or directory)
QgsFileWidget::StorageMode storageMode() const;
2016-02-14 03:50:23 +01:00
//! determines the storage mode (i.e. file or directory)
void setStorageMode( QgsFileWidget::StorageMode storageMode );
2016-01-11 16:52:39 +01:00
2016-02-14 03:50:23 +01:00
//! returns if the relative path is with respect to the project path or the default path
QgsFileWidget::RelativeStorage relativeStorage() const;
2016-02-14 03:50:23 +01:00
//! determines if the relative path is with respect to the project path or the default path
void setRelativeStorage( QgsFileWidget::RelativeStorage relativeStorage );
2016-01-11 16:52:39 +01:00
signals:
2016-02-14 03:50:23 +01:00
//! emitted as soon as the current file or directory is changed
void fileChanged( const QString& );
2016-01-11 16:52:39 +01:00
};