1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/qgsfilewidget.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13 14class QgsFileWidget : QWidget 15{ 16%Docstring(signature="appended") 17The :py:class:`QgsFileWidget` class creates a widget for selecting a file or a folder. 18%End 19 20%TypeHeaderCode 21#include "qgsfilewidget.h" 22%End 23%ConvertToSubClassCode 24 if ( qobject_cast<QgsFileWidget *>( sipCpp ) ) 25 sipType = sipType_QgsFileWidget; 26 else 27 sipType = NULL; 28%End 29 public: 30 31 enum StorageMode 32 { 33 GetFile, 34 GetDirectory, 35 GetMultipleFiles, 36 SaveFile, 37 }; 38 39 enum RelativeStorage 40 { 41 Absolute, 42 RelativeProject, 43 RelativeDefaultPath 44 }; 45 46 explicit QgsFileWidget( QWidget *parent /TransferThis/ = 0 ); 47%Docstring 48QgsFileWidget creates a widget for selecting a file or a folder. 49%End 50 51 QString filePath(); 52%Docstring 53Returns the current file path(s). 54 55When multiple files are selected they are quoted and separated 56by a single space (for example: '"/path/foo" "path/bar"') 57 58.. seealso:: :py:func:`setFilePath` 59 60.. seealso:: :py:func:`splitFilePaths` 61%End 62 63 static QStringList splitFilePaths( const QString &path ); 64%Docstring 65Split the the quoted and space separated ``path`` and returns a list of strings. 66 67.. seealso:: :py:func:`filePath` 68%End 69 70 void setFilePath( const QString &path ); 71%Docstring 72Sets the current file ``path``. 73 74.. seealso:: :py:func:`filePath` 75%End 76 77 virtual void setReadOnly( bool readOnly ); 78%Docstring 79Sets whether the widget should be read only. 80%End 81 82 QString dialogTitle() const; 83%Docstring 84Returns the open file dialog title. 85 86.. seealso:: :py:func:`setDialogTitle` 87%End 88 89 void setDialogTitle( const QString &title ); 90%Docstring 91Sets the ``title`` to use for the open file dialog. 92 93.. note:: 94 95 If not defined, the title is "Select a file" or "Select a directory" or "Select one or more files" depending on the configuration. 96 97.. seealso:: :py:func:`dialogTitle` 98%End 99 100 QString filter() const; 101%Docstring 102returns the filters used for QDialog.getOpenFileName 103%End 104 105 void setFilter( const QString &filter ); 106%Docstring 107setFilter sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown. 108 109: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 ';;', 110%End 111 112 QFileDialog::Options options() const; 113%Docstring 114Returns the additional options used for QFileDialog. 115 116.. seealso:: :py:func:`setOptions` 117 118.. versionadded:: 3.14 119%End 120 121 void setOptions( QFileDialog::Options options ); 122%Docstring 123Set additional options used for QFileDialog. 124 125These options affect the look and feel of the QFileDialog shown when a user is interactively browsing 126for paths. 127 128.. seealso:: :py:func:`options` 129 130.. versionadded:: 3.14 131%End 132 133 void setSelectedFilter( const QString &selectedFilter ); 134%Docstring 135Sets the selected filter when the file dialog opens. 136 137.. seealso:: :py:func:`selectedFilter` 138%End 139 140 QString selectedFilter() const; 141%Docstring 142Returns the selected filter from the last opened file dialog. 143 144.. seealso:: :py:func:`setSelectedFilter` 145%End 146 147 void setConfirmOverwrite( bool confirmOverwrite ); 148%Docstring 149Sets whether a confirmation to overwrite an existing file will appear. 150 151By default, a confirmation will appear. 152 153:param confirmOverwrite: If set to ``True``, an overwrite confirmation will be shown 154 155.. seealso:: :py:func:`confirmOverwrite` 156%End 157 158 bool confirmOverwrite() const; 159%Docstring 160Returns whether a confirmation will be shown when overwriting an existing file. 161 162.. seealso:: :py:func:`setConfirmOverwrite` 163%End 164 165 bool fileWidgetButtonVisible() const; 166%Docstring 167Returns ``True`` if the tool button is shown. 168 169.. seealso:: :py:func:`setFileWidgetButtonVisible` 170%End 171 172 void setFileWidgetButtonVisible( bool visible ); 173%Docstring 174Sets whether the tool button is ``visible``. 175 176.. seealso:: :py:func:`fileWidgetButtonVisible` 177%End 178 179 bool useLink() const; 180%Docstring 181Returns ``True`` if the file path will be shown as a link. 182 183.. seealso:: :py:func:`setUseLink` 184%End 185 186 void setUseLink( bool useLink ); 187%Docstring 188Sets whether the file path will be shown as a link. 189 190.. seealso:: :py:func:`useLink` 191%End 192 193 bool fullUrl() const; 194%Docstring 195Returns ``True`` if the links shown use the full path. 196 197.. seealso:: :py:func:`setFullUrl` 198%End 199 200 void setFullUrl( bool fullUrl ); 201%Docstring 202Sets whether links shown use the full path. 203 204.. seealso:: :py:func:`fullUrl` 205%End 206 207 QString defaultRoot() const; 208%Docstring 209Returns the default root path. 210 211.. seealso:: :py:func:`setDefaultRoot` 212%End 213 214 void setDefaultRoot( const QString &defaultRoot ); 215%Docstring 216Returns the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath. 217 218.. seealso:: :py:func:`defaultRoot` 219%End 220 221 QgsFileWidget::StorageMode storageMode() const; 222%Docstring 223Returns the widget's storage mode (i.e. file or directory). 224 225.. seealso:: :py:func:`setStorageMode` 226%End 227 228 void setStorageMode( QgsFileWidget::StorageMode storageMode ); 229%Docstring 230Sets the widget's storage mode (i.e. file or directory). 231 232.. seealso:: :py:func:`storageMode` 233%End 234 235 QgsFileWidget::RelativeStorage relativeStorage() const; 236%Docstring 237Returns if the relative path is with respect to the project path or the default path. 238 239.. seealso:: :py:func:`setRelativeStorage` 240%End 241 242 void setRelativeStorage( QgsFileWidget::RelativeStorage relativeStorage ); 243%Docstring 244Sets whether the relative path is with respect to the project path or the default path. 245 246.. seealso:: :py:func:`relativeStorage` 247%End 248 249 QgsFilterLineEdit *lineEdit(); 250%Docstring 251Returns a pointer to the widget's line edit, which can be used to customize 252the appearance and behavior of the line edit portion of the widget. 253 254.. versionadded:: 3.0 255%End 256 257 signals: 258 259 void fileChanged( const QString &path ); 260%Docstring 261Emitted whenever the current file or directory ``path`` is changed. 262%End 263 264 protected: 265 266 virtual void updateLayout(); 267%Docstring 268Update buttons visibility 269%End 270 271 virtual void setSelectedFileNames( QStringList fileNames ); 272%Docstring 273Called whenever user select ``fileNames`` from dialog 274%End 275 276 static bool isMultiFiles( const QString &path ); 277%Docstring 278Returns true if ``path`` is a multifiles 279%End 280 281 void setFilePaths( const QStringList &filePaths ); 282%Docstring 283Update filePath according to ``filePaths`` list 284%End 285 286 287 288 QString toUrl( const QString &path ) const; 289%Docstring 290returns a HTML code with a link to the given file path 291%End 292 293 QString relativePath( const QString &filePath, bool removeRelative ) const; 294%Docstring 295Returns a filePath with relative path options applied (or not) ! 296%End 297 298}; 299 300 301 302 303 304/************************************************************************ 305 * This file has been generated automatically from * 306 * * 307 * src/gui/qgsfilewidget.h * 308 * * 309 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 310 ************************************************************************/ 311