Skip to content

Commit 39f7c04

Browse files
committed
Bindings and API docs
1 parent 46606b2 commit 39f7c04

File tree

6 files changed

+83
-22
lines changed

6 files changed

+83
-22
lines changed

python/core/qgseditformconfig.sip

+14
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,20 @@ class QgsAttributeEditorContainer : QgsAttributeEditorElement
179179
*/
180180
void setColumnCount( int columnCount );
181181

182+
/**
183+
* An expression that controls the visibility of this container.
184+
*
185+
* @note Added in QGIS 2.18
186+
*/
187+
QgsOptionalExpression visibilityExpression() const;
188+
189+
/**
190+
* An expression that controls the visibility of this container.
191+
*
192+
* @note Added in QGIS 2.18
193+
*/
194+
void setVisibilityExpression( const QgsOptionalExpression& visibilityExpression );
195+
182196
};
183197

184198
/**

python/gui/qgsfieldexpressionwidget.sip

+19
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ class QgsFieldExpressionWidget : QWidget
5353
*/
5454
QString asExpression() const;
5555

56+
/**
57+
* Returns the currently selected field or expression. If a field is currently selected, the returned
58+
* value will be converted to a valid expression referencing this field (ie enclosing the field name with
59+
* appropriate quotations).
60+
*
61+
* Alias for asExpression()
62+
*
63+
* @note added in QGIS 2.18
64+
*/
65+
QString expression() const;
66+
5667
//! Returns the currently used layer
5768
QgsVectorLayer* layer() const;
5869

@@ -90,6 +101,14 @@ class QgsFieldExpressionWidget : QWidget
90101
//! sets the current field or expression in the widget
91102
void setField( const QString &fieldName );
92103

104+
/**
105+
* Sets the current expression text and if applicable also the field.
106+
* Alias for setField.
107+
*
108+
* @note Added in QGIS 2.18
109+
*/
110+
void setExpression( const QString& expression );
111+
93112
protected slots:
94113
//! open the expression dialog to edit the current or add a new expression
95114
void editExpression();

python/gui/qgstabwidget.sip

+21-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* The QgsTabWidget class is the same as the QTabWidget but with additional methods to
1919
* temporarily hide/show tabs.
2020
*
21-
* @note Added in QGIS 3.0
21+
* @note Added in QGIS 2.18
2222
*/
2323
class QgsTabWidget : QTabWidget
2424
{
@@ -30,28 +30,28 @@ class QgsTabWidget : QTabWidget
3030
/**
3131
* Create a new QgsTabWidget with the optionally provided parent.
3232
*
33-
* @note Added in QGIS 3.0
33+
* @note Added in QGIS 2.18
3434
*/
3535
QgsTabWidget( QWidget *parent = nullptr );
3636

3737
/**
3838
* Hides the tab with the given widget
3939
*
40-
* @note Added in QGIS 3.0
40+
* @note Added in QGIS 2.18
4141
*/
4242
void hideTab( QWidget* tab );
4343

4444
/**
4545
* Shows the tab with the given widget
4646
*
47-
* @note Added in QGIS 3.0
47+
* @note Added in QGIS 2.18
4848
*/
4949
void showTab( QWidget* tab );
5050

5151
/**
5252
* Control the visibility for the tab with the given widget.
5353
*
54-
* @note Added in QGIS 3.0
54+
* @note Added in QGIS 2.18
5555
*/
5656
void setTabVisible( QWidget* tab, bool visible );
5757

@@ -60,10 +60,25 @@ class QgsTabWidget : QTabWidget
6060
* This index is not the same as the one provided to insertTab and removeTab
6161
* since these methods are not aware of hidden tabs.
6262
*
63-
* @note Added in QGIS 3.0
63+
* @note Added in QGIS 2.18
6464
*/
6565
int realTabIndex( QWidget* widget );
6666

67+
/**
68+
* Is called internally whenever a new tab has been inserted.
69+
*
70+
* Is used to keep track of currently available and visible tabs.
71+
*
72+
* @note Added in QGIS 2.18
73+
*/
6774
virtual void tabInserted( int index );
75+
76+
/**
77+
* Is called internally whenever a tab has been removed.
78+
*
79+
* Is used to keep track of currently available and visible tabs.
80+
*
81+
* @note Added in QGIS 2.18
82+
*/
6883
virtual void tabRemoved( int index );
6984
};

src/core/qgsoptional.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
#ifndef QGSOPTIONAL_H
1717
#define QGSOPTIONAL_H
1818

19+
1920
/**
2021
* \ingroup core
2122
*
22-
* \brief
23-
* QgsOptional is a container for other classes and adds an additional enabled/disabled flag.
23+
* \brief QgsOptional is a container for other classes and adds an additional enabled/disabled flag.
2424
*
2525
* Often it is used for configuration options which can be enabled or disabled but also have
2626
* more internal configuration information that should not be lost when disabling and re-enabling.

src/gui/qgstabwidget.h

+23-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* The QgsTabWidget class is the same as the QTabWidget but with additional methods to
2323
* temporarily hide/show tabs.
2424
*
25-
* @note Added in QGIS 3.0
25+
* @note Added in QGIS 2.18
2626
*/
2727
class GUI_EXPORT QgsTabWidget : public QTabWidget
2828
{
@@ -32,28 +32,28 @@ class GUI_EXPORT QgsTabWidget : public QTabWidget
3232
/**
3333
* Create a new QgsTabWidget with the optionally provided parent.
3434
*
35-
* @note Added in QGIS 3.0
35+
* @note Added in QGIS 2.18
3636
*/
3737
QgsTabWidget( QWidget *parent = nullptr );
3838

3939
/**
4040
* Hides the tab with the given widget
4141
*
42-
* @note Added in QGIS 3.0
42+
* @note Added in QGIS 2.18
4343
*/
4444
void hideTab( QWidget* tab );
4545

4646
/**
4747
* Shows the tab with the given widget
4848
*
49-
* @note Added in QGIS 3.0
49+
* @note Added in QGIS 2.18
5050
*/
5151
void showTab( QWidget* tab );
5252

5353
/**
5454
* Control the visibility for the tab with the given widget.
5555
*
56-
* @note Added in QGIS 3.0
56+
* @note Added in QGIS 2.18
5757
*/
5858
void setTabVisible( QWidget* tab, bool visible );
5959

@@ -62,12 +62,27 @@ class GUI_EXPORT QgsTabWidget : public QTabWidget
6262
* This index is not the same as the one provided to insertTab and removeTab
6363
* since these methods are not aware of hidden tabs.
6464
*
65-
* @note Added in QGIS 3.0
65+
* @note Added in QGIS 2.18
6666
*/
6767
int realTabIndex( QWidget* widget );
6868

69-
virtual void tabInserted( int index );
70-
virtual void tabRemoved( int index );
69+
/**
70+
* Is called internally whenever a new tab has been inserted.
71+
*
72+
* Is used to keep track of currently available and visible tabs.
73+
*
74+
* @note Added in QGIS 2.18
75+
*/
76+
virtual void tabInserted( int index ) override;
77+
78+
/**
79+
* Is called internally whenever a tab has been removed.
80+
*
81+
* Is used to keep track of currently available and visible tabs.
82+
*
83+
* @note Added in QGIS 2.18
84+
*/
85+
virtual void tabRemoved( int index ) override;
7186

7287
private:
7388
void synchronizeIndexes();

tests/src/python/test_qgstabwidget.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,14 @@
1717

1818
import qgis # NOQA
1919

20-
from qgis.testing import unittest
20+
from qgis.testing import unittest, start_app
2121
from qgis.gui import QgsTabWidget
22-
from qgis.PyQt.QtGui import QApplication, QWidget
22+
from qgis.PyQt.QtWidgets import QWidget
2323

24+
start_app()
2425

25-
class TestQgsTabWidget(unittest.TestCase):
2626

27-
@classmethod
28-
def setUpClass(cls):
29-
cls.app = QApplication([])
27+
class TestQgsTabWidget(unittest.TestCase):
3028

3129
def setUp(self):
3230
"""Run before each test."""

0 commit comments

Comments
 (0)