Skip to content

Commit 7552d1c

Browse files
committedApr 19, 2017
sipify QgsFileWidget, QgsExternalResourceWidget
1 parent 56aa36e commit 7552d1c

File tree

5 files changed

+217
-101
lines changed

5 files changed

+217
-101
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,13 @@ gui/qgsexpressionhighlighter.sip
360360
gui/qgsexpressionlineedit.sip
361361
gui/qgsexpressionselectiondialog.sip
362362
gui/qgsextentgroupbox.sip
363-
gui/qgsexternalresourcewidget.sip
364363
gui/qgsfeatureselectiondlg.sip
365364
gui/qgsfieldcombobox.sip
366365
gui/qgsfieldmodel.sip
367366
gui/qgsfieldproxymodel.sip
368367
gui/qgsfieldvalidator.sip
369368
gui/qgsfieldvalueslineedit.sip
370369
gui/qgsfiledropedit.sip
371-
gui/qgsfilewidget.sip
372370
gui/qgsfiledownloader.sip
373371
gui/qgsfilterlineedit.sip
374372
gui/qgsfloatingwidget.sip
Lines changed: 104 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,143 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/gui/qgsexternalresourcewidget.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
113

214
class QgsExternalResourceWidget : QWidget
315
{
4-
%TypeHeaderCode
5-
#include <qgsexternalresourcewidget.h>
16+
%Docstring
17+
Widget to display file path with a push button for an "open file" dialog
18+
It can also be used to display a picture or a web page.
19+
*
620
%End
721

22+
%TypeHeaderCode
23+
#include "qgsexternalresourcewidget.h"
24+
%End
825
public:
9-
1026
enum DocumentViewerContent
1127
{
1228
NoContent,
1329
Image,
1430
Web
1531
};
1632

17-
/**
18-
* @brief QgsExternalResourceWidget creates a widget with a file widget and a document viewer
19-
* Both part of the widget are optional.
20-
* @see QgsFileWidget
21-
*/
22-
explicit QgsExternalResourceWidget( QWidget *parent = 0 );
23-
24-
/**
25-
* @brief documentPath returns the path of the current document in the widget
26-
* @param type determines the type of the returned null variant if the document is not defined yet
27-
*/
33+
explicit QgsExternalResourceWidget( QWidget *parent /TransferThis/ = 0 );
34+
%Docstring
35+
QgsExternalResourceWidget creates a widget with a file widget and a document viewer
36+
Both part of the widget are optional.
37+
\see QgsFileWidget
38+
%End
39+
2840
QVariant documentPath( QVariant::Type type = QVariant::String ) const;
29-
void setDocumentPath( const QVariant& documentPath );
41+
%Docstring
42+
documentPath returns the path of the current document in the widget
43+
\param type determines the type of the returned null variant if the document is not defined yet
44+
:rtype: QVariant
45+
%End
46+
void setDocumentPath( const QVariant &documentPath );
3047

31-
//! access the file widget to allow its configuration
32-
QgsFileWidget* fileWidget();
48+
QgsFileWidget *fileWidget();
49+
%Docstring
50+
access the file widget to allow its configuration
51+
:rtype: QgsFileWidget
52+
%End
3353

34-
//! returns if the file widget is visible in the widget
3554
bool fileWidgetVisible() const;
36-
//! set the visiblity of the file widget in the layout
55+
%Docstring
56+
returns if the file widget is visible in the widget
57+
:rtype: bool
58+
%End
3759
void setFileWidgetVisible( bool visible );
60+
%Docstring
61+
set the visiblity of the file widget in the layout
62+
%End
3863

39-
//! returns the type of content used in the document viewer
4064
QgsExternalResourceWidget::DocumentViewerContent documentViewerContent() const;
41-
//! setDocumentViewerContent defines the type of content to be shown. Widget will be adapted accordingly
65+
%Docstring
66+
returns the type of content used in the document viewer
67+
:rtype: QgsExternalResourceWidget.DocumentViewerContent
68+
%End
4269
void setDocumentViewerContent( QgsExternalResourceWidget::DocumentViewerContent content );
70+
%Docstring
71+
setDocumentViewerContent defines the type of content to be shown. Widget will be adapted accordingly
72+
%End
4373

44-
//! returns the height of the document viewer
4574
int documentViewerHeight() const;
46-
/**
47-
* @brief setDocumentViewerWidth set the height of the document viewer.
48-
* @param height the height. Use 0 for automatic best display.
49-
*/
75+
%Docstring
76+
returns the height of the document viewer
77+
:rtype: int
78+
%End
79+
5080
void setDocumentViewerHeight( int height );
51-
//! returns the width of the document viewer
81+
%Docstring
82+
setDocumentViewerWidth set the height of the document viewer.
83+
\param height the height. Use 0 for automatic best display.
84+
%End
5285
int documentViewerWidth() const ;
53-
/**
54-
* @brief setDocumentViewerWidth set the width of the document viewer.
55-
* @param width the width. Use 0 for automatic best display.
56-
*/
86+
%Docstring
87+
returns the width of the document viewer
88+
:rtype: int
89+
%End
90+
5791
void setDocumentViewerWidth( int width );
92+
%Docstring
93+
setDocumentViewerWidth set the width of the document viewer.
94+
\param width the width. Use 0 for automatic best display.
95+
%End
5896

59-
//! defines if the widget is readonly
6097
void setReadOnly( bool readOnly );
98+
%Docstring
99+
defines if the widget is readonly
100+
%End
61101

62-
/**
63-
* Configures if paths are handled absolute or relative and if relative,
64-
* which should be the base path.
65-
*/
66102
QgsFileWidget::RelativeStorage relativeStorage() const;
103+
%Docstring
104+
Configures if paths are handled absolute or relative and if relative,
105+
which should be the base path.
106+
:rtype: QgsFileWidget.RelativeStorage
107+
%End
67108

68-
/**
69-
* Configures if paths are handled absolute or relative and if relative,
70-
* which should be the base path.
71-
*/
72109
void setRelativeStorage( QgsFileWidget::RelativeStorage relativeStorage );
110+
%Docstring
111+
Configures if paths are handled absolute or relative and if relative,
112+
which should be the base path.
113+
%End
73114

74115

75-
/**
76-
* Configures the base path which should be used if the relativeStorage property
77-
* is set to QgsFileWidget::RelativeDefaultPath.
78-
*/
79116
QString defaultRoot() const;
117+
%Docstring
118+
Configures the base path which should be used if the relativeStorage property
119+
is set to QgsFileWidget.RelativeDefaultPath.
120+
:rtype: str
121+
%End
80122

81-
/**
82-
* Configures the base path which should be used if the relativeStorage property
83-
* is set to QgsFileWidget::RelativeDefaultPath.
84-
*/
85-
void setDefaultRoot(const QString& defaultRoot);
123+
void setDefaultRoot( const QString &defaultRoot );
124+
%Docstring
125+
Configures the base path which should be used if the relativeStorage property
126+
is set to QgsFileWidget.RelativeDefaultPath.
127+
%End
86128

87129
signals:
88-
//! emitteed as soon as the current document changes
89-
void valueChanged( const QString& );
130+
void valueChanged( const QString & );
131+
%Docstring
132+
emitteed as soon as the current document changes
133+
%End
134+
90135
};
136+
137+
/************************************************************************
138+
* This file has been generated automatically from *
139+
* *
140+
* src/gui/qgsexternalresourcewidget.h *
141+
* *
142+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
143+
************************************************************************/

‎python/gui/qgsfilewidget.sip

Lines changed: 108 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,159 @@
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+
113

214
class QgsFileWidget : QWidget
315
{
4-
%TypeHeaderCode
5-
#include <qgsfilewidget.h>
16+
%Docstring
17+
The QgsFileWidget class creates a widget for selecting a file or a folder.
618
%End
719

20+
%TypeHeaderCode
21+
#include "qgsfilewidget.h"
22+
%End
823
public:
9-
/**
10-
* @brief The StorageMode enum determines if the file picker should pick files or directories
11-
*/
24+
1225
enum StorageMode
1326
{
1427
GetFile,
1528
GetDirectory
1629
};
1730

18-
/**
19-
* @brief The RelativeStorage enum determines if path is absolute, relative to the current project path or relative to a defined default path.
20-
*/
2131
enum RelativeStorage
2232
{
2333
Absolute,
2434
RelativeProject,
2535
RelativeDefaultPath
2636
};
2737

28-
/**
29-
* @brief QgsFileWidget creates a widget for selecting a file or a folder.
30-
*/
31-
explicit QgsFileWidget( QWidget *parent /TransferThis/ );
32-
33-
~QgsFileWidget();
38+
explicit QgsFileWidget( QWidget *parent /TransferThis/ = 0 );
39+
%Docstring
40+
QgsFileWidget creates a widget for selecting a file or a folder.
41+
%End
3442

35-
//! Returns the current file path
3643
QString filePath();
44+
%Docstring
45+
Returns the current file path
46+
:rtype: str
47+
%End
3748

38-
//! Sets the file path
3949
void setFilePath( QString path );
50+
%Docstring
51+
Sets the file path
52+
%End
4053

41-
//! defines if the widget is readonly
4254
void setReadOnly( bool readOnly );
55+
%Docstring
56+
defines if the widget is readonly
57+
%End
4358

44-
//! returns the open file dialog title
4559
QString dialogTitle() const;
46-
/**
47-
* @brief setDialogTitle defines the open file dialog title
48-
* @note if not defined, the title is "Select a file" or "Select a directory" depending on the configuration.
49-
*/
50-
void setDialogTitle( const QString& title );
60+
%Docstring
61+
returns the open file dialog title
62+
:rtype: str
63+
%End
64+
65+
void setDialogTitle( const QString &title );
66+
%Docstring
67+
setDialogTitle defines the open file dialog title
68+
.. note::
69+
70+
if not defined, the title is "Select a file" or "Select a directory" depending on the configuration.
71+
%End
5172

52-
//! returns the filters used for QDialog::getOpenFileName
5373
QString filter() const;
54-
/**
55-
* @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.
56-
* @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 ';;',
57-
*/
74+
%Docstring
75+
returns the filters used for QDialog.getOpenFileName
76+
:rtype: str
77+
%End
78+
5879
void setFilter( const QString &filter );
80+
%Docstring
81+
setFilter sets the filter used by the model to filters. The filter is used to specify the kind of files that should be shown.
82+
\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 ';;',
83+
%End
5984

60-
//! determines if the tool button is shown
6185
bool fileWidgetButtonVisible() const;
62-
//! determines if the tool button is shown
86+
%Docstring
87+
determines if the tool button is shown
88+
:rtype: bool
89+
%End
6390
void setFileWidgetButtonVisible( bool visible );
91+
%Docstring
92+
determines if the tool button is shown
93+
%End
6494

65-
//! determines if the file path will be shown as a link
6695
bool useLink() const;
67-
//! determines if the file path will be shown as a link
96+
%Docstring
97+
determines if the file path will be shown as a link
98+
:rtype: bool
99+
%End
68100
void setUseLink( bool useLink );
101+
%Docstring
102+
determines if the file path will be shown as a link
103+
%End
69104

70-
//! returns if the links shows the full path or not
71105
bool fullUrl() const;
72-
//! determines if the links shows the full path or not
106+
%Docstring
107+
returns if the links shows the full path or not
108+
:rtype: bool
109+
%End
73110
void setFullUrl( bool fullUrl );
111+
%Docstring
112+
determines if the links shows the full path or not
113+
%End
74114

75-
//! returns the default root path
76115
QString defaultRoot() const;
77-
//! determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
78-
void setDefaultRoot( const QString& defaultRoot );
116+
%Docstring
117+
returns the default root path
118+
:rtype: str
119+
%End
120+
void setDefaultRoot( const QString &defaultRoot );
121+
%Docstring
122+
determines the default root path used as the first shown location when picking a file and used if the RelativeStorage is RelativeDefaultPath
123+
%End
79124

80-
//! returns the storage mode (i.e. file or directory)
81125
QgsFileWidget::StorageMode storageMode() const;
82-
//! determines the storage mode (i.e. file or directory)
126+
%Docstring
127+
returns the storage mode (i.e. file or directory)
128+
:rtype: QgsFileWidget.StorageMode
129+
%End
83130
void setStorageMode( QgsFileWidget::StorageMode storageMode );
131+
%Docstring
132+
determines the storage mode (i.e. file or directory)
133+
%End
84134

85-
//! returns if the relative path is with respect to the project path or the default path
86135
QgsFileWidget::RelativeStorage relativeStorage() const;
87-
//! determines if the relative path is with respect to the project path or the default path
136+
%Docstring
137+
returns if the relative path is with respect to the project path or the default path
138+
:rtype: QgsFileWidget.RelativeStorage
139+
%End
88140
void setRelativeStorage( QgsFileWidget::RelativeStorage relativeStorage );
141+
%Docstring
142+
determines if the relative path is with respect to the project path or the default path
143+
%End
89144

90145
signals:
91-
//! emitted as soon as the current file or directory is changed
92-
void fileChanged( const QString& );
93-
146+
void fileChanged( const QString & );
147+
%Docstring
148+
emitted as soon as the current file or directory is changed
149+
%End
94150

95151
};
152+
153+
/************************************************************************
154+
* This file has been generated automatically from *
155+
* *
156+
* src/gui/qgsfilewidget.h *
157+
* *
158+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
159+
************************************************************************/

‎src/gui/qgsexternalresourcewidget.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ class QgsPixmapLabel;
2525

2626
#include "qgsfilewidget.h"
2727
#include "qgis_gui.h"
28-
29-
28+
#include "qgis.h"
3029

3130

3231
/** \ingroup gui
@@ -57,7 +56,7 @@ class GUI_EXPORT QgsExternalResourceWidget : public QWidget
5756
* Both part of the widget are optional.
5857
* \see QgsFileWidget
5958
*/
60-
explicit QgsExternalResourceWidget( QWidget *parent = 0 );
59+
explicit QgsExternalResourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
6160

6261
/**
6362
* \brief documentPath returns the path of the current document in the widget

‎src/gui/qgsfilewidget.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ class QVariant;
2424
class QgsFilterLineEdit;
2525

2626
#include <QWidget>
27+
2728
#include "qgis_gui.h"
29+
#include "qgis.h"
2830

2931
/** \ingroup gui
3032
* \brief The QgsFileWidget class creates a widget for selecting a file or a folder.
@@ -65,7 +67,7 @@ class GUI_EXPORT QgsFileWidget : public QWidget
6567
/**
6668
* \brief QgsFileWidget creates a widget for selecting a file or a folder.
6769
*/
68-
explicit QgsFileWidget( QWidget *parent = 0 );
70+
explicit QgsFileWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr );
6971

7072
//! Returns the current file path
7173
QString filePath();

0 commit comments

Comments
 (0)
Please sign in to comment.