17 #ifndef QGSFILEWIDGET_H
18 #define QGSFILEWIDGET_H
23 class QgsFileDropEdit;
26 #include <QFileDialog>
41 if ( qobject_cast<QgsFileWidget *>( sipCpp ) )
42 sipType = sipType_QgsFileWidget;
49 Q_PROPERTY(
bool fileWidgetButtonVisible READ fileWidgetButtonVisible WRITE setFileWidgetButtonVisible )
50 Q_PROPERTY(
bool useLink READ useLink WRITE setUseLink )
51 Q_PROPERTY(
bool fullUrl READ fullUrl WRITE setFullUrl )
52 Q_PROPERTY( QString dialogTitle READ dialogTitle WRITE setDialogTitle )
53 Q_PROPERTY( QString filter READ filter WRITE setFilter )
54 Q_PROPERTY( QString defaultRoot READ defaultRoot WRITE setDefaultRoot )
55 Q_PROPERTY(
StorageMode storageMode READ storageMode WRITE setStorageMode )
56 Q_PROPERTY(
RelativeStorage relativeStorage READ relativeStorage WRITE setRelativeStorage )
57 Q_PROPERTY( QFileDialog::Options options READ options WRITE setOptions )
82 Q_ENUM( RelativeStorage )
101 static QStringList splitFilePaths(
const QString &path );
104 void setFilePath( QString path );
107 void setReadOnly(
bool readOnly );
110 QString dialogTitle()
const;
116 void setDialogTitle(
const QString &title );
119 QString filter()
const;
125 void setFilter(
const QString &filter );
131 QFileDialog::Options options()
const;
137 void setOptions( QFileDialog::Options options );
162 bool fileWidgetButtonVisible()
const;
164 void setFileWidgetButtonVisible(
bool visible );
167 bool useLink()
const;
169 void setUseLink(
bool useLink );
172 bool fullUrl()
const;
174 void setFullUrl(
bool fullUrl );
177 QString defaultRoot()
const;
179 void setDefaultRoot(
const QString &defaultRoot );
206 void openFileDialog();
207 void textEdited(
const QString &path );
214 bool mButtonVisible =
true;
215 bool mUseLink =
false;
216 bool mFullUrl =
false;
217 bool mReadOnly =
false;
218 bool mIsLinkEdited =
false;
219 QString mDialogTitle;
221 QString mSelectedFilter;
222 QString mDefaultRoot;
223 bool mConfirmOverwrite =
true;
226 QFileDialog::Options mOptions = QFileDialog::Options();
228 QLabel *mLinkLabel =
nullptr;
229 QgsFileDropEdit *mLineEdit =
nullptr;
230 QToolButton *mLinkEditButton =
nullptr;
231 QToolButton *mFileWidgetButton =
nullptr;
232 QHBoxLayout *mLayout =
nullptr;
235 QString toUrl(
const QString &path )
const;
238 QString relativePath(
const QString &filePath,
bool removeRelative )
const;
240 friend class TestQgsFileWidget;
267 void setFilters(
const QString &filters );
271 void dragEnterEvent( QDragEnterEvent *event )
override;
272 void dragLeaveEvent( QDragLeaveEvent *event )
override;
273 void dropEvent( QDropEvent *event )
override;
278 QString acceptableFilePath( QDropEvent *event )
const;
280 QStringList mAcceptableExtensions;
282 friend class TestQgsFileWidget;
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
A QgsFilterLineEdit subclass with the ability to "highlight" the edges of the widget.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)