Skip to content

Commit c68eaeb

Browse files
committed
Refactor widget constraints to keep variables private
1 parent d285134 commit c68eaeb

16 files changed

+27
-23
lines changed

python/gui/editorwidgets/core/qgseditorwidgetwrapper.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,5 +199,5 @@ class QgsEditorWidgetWrapper : QgsWidgetWrapper
199199
* This can be overwritten in subclasses to allow individual widgets to
200200
* change the visual cue.
201201
*/
202-
virtual void updateConstraintWidgetStatus();
202+
virtual void updateConstraintWidgetStatus( bool contraintValid );
203203
};

python/gui/editorwidgets/qgsrelationreferencewidgetwrapper.sip

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ class QgsRelationReferenceWidgetWrapper : QgsEditorWidgetWrapper
3434
* change the visual cue.
3535
* @note added in QGIS 2.16
3636
*/
37-
void updateConstraintWidgetStatus();
37+
void updateConstraintWidgetStatus( bool constraintValid ) override;
3838
};

src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ void QgsEditorWidgetWrapper::valueChanged()
9797
emit valueChanged( value() );
9898
}
9999

100-
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus()
100+
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
101101
{
102-
if ( mValidConstraint )
102+
if ( constraintValid )
103103
widget()->setStyleSheet( QString() );
104104
else
105105
widget()->setStyleSheet( "background-color: #dd7777;" );
@@ -162,7 +162,7 @@ void QgsEditorWidgetWrapper::updateConstraint( const QgsFeature &ft )
162162

163163
if ( toEmit )
164164
{
165-
updateConstraintWidgetStatus();
165+
updateConstraintWidgetStatus( mValidConstraint );
166166
emit constraintStatusChanged( expression, description, errStr, mValidConstraint );
167167
}
168168
}

src/gui/editorwidgets/core/qgseditorwidgetwrapper.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,15 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
220220
*
221221
* This can be overwritten in subclasses to allow individual widgets to
222222
* change the visual cue.
223+
*
224+
* @param constraintValid The current constraint status.
225+
*
223226
* @note added in QGIS 2.16
224227
*/
225-
virtual void updateConstraintWidgetStatus();
228+
virtual void updateConstraintWidgetStatus( bool constraintValid );
226229

227230
private:
231+
228232
/**
229233
* Boolean storing the current validity of the constraint for this widget.
230234
*/

src/gui/editorwidgets/qgscolorwidgetwrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void QgsColorWidgetWrapper::setValue( const QVariant& value )
7878
mColorButton->setColor( !value.isNull() ? QColor( value.toString() ) : QColor() );
7979
}
8080

81-
void QgsColorWidgetWrapper::updateConstraintWidgetStatus()
81+
void QgsColorWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
8282
{
8383
// nothing
8484
}

src/gui/editorwidgets/qgscolorwidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper
4646
void setValue( const QVariant& value ) override;
4747

4848
private:
49-
void updateConstraintWidgetStatus() override;
49+
void updateConstraintWidgetStatus( bool constraintValid ) override;
5050

5151
QgsColorButtonV2* mColorButton;
5252
};

src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,11 @@ void QgsExternalResourceWidgetWrapper::setEnabled( bool enabled )
188188
mQgsWidget->setReadOnly( !enabled );
189189
}
190190

191-
void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
191+
void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
192192
{
193193
if ( mLineEdit )
194194
{
195-
if ( mValidConstraint )
195+
if ( constraintValid )
196196
mLineEdit->setStyleSheet( QString() );
197197
else
198198
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );

src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class GUI_EXPORT QgsExternalResourceWidgetWrapper : public QgsEditorWidgetWrappe
5454
void setEnabled( bool enabled ) override;
5555

5656
private:
57-
void updateConstraintWidgetStatus() override;
57+
void updateConstraintWidgetStatus( bool constraintValid ) override;
5858

5959
QLineEdit* mLineEdit;
6060
QLabel* mLabel;

src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ void QgsFileNameWidgetWrapper::selectFileName()
152152
mLineEdit->setText( fileName );
153153
}
154154

155-
void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus()
155+
void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
156156
{
157157
if ( mLineEdit )
158158
{
159-
if ( mValidConstraint )
159+
if ( constraintValid )
160160
mLineEdit->setStyleSheet( QString() );
161161
else
162162
{

src/gui/editorwidgets/qgsfilenamewidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper
5151
void setValue( const QVariant& value ) override;
5252

5353
private:
54-
void updateConstraintWidgetStatus() override;
54+
void updateConstraintWidgetStatus( bool constraintValid ) override;
5555

5656
QLineEdit* mLineEdit;
5757
QPushButton* mPushButton;

src/gui/editorwidgets/qgsphotowidgetwrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,11 @@ void QgsPhotoWidgetWrapper::setEnabled( bool enabled )
267267
mButton->setEnabled( enabled );
268268
}
269269

270-
void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus()
270+
void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
271271
{
272272
if ( mLineEdit )
273273
{
274-
if ( mValidConstraint )
274+
if ( constraintValid )
275275
mLineEdit->setStyleSheet( QString() );
276276
else
277277
{

src/gui/editorwidgets/qgsphotowidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper
6565
void loadPixmap( const QString& fileName );
6666

6767
private:
68-
void updateConstraintWidgetStatus() override;
68+
void updateConstraintWidgetStatus( bool constraintValid ) override;
6969

7070
//! This label is used as a container to display the picture
7171
QLabel* mPhotoLabel;

src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ void QgsRelationReferenceWidgetWrapper::foreignKeyChanged( QVariant value )
140140
emit valueChanged( value );
141141
}
142142

143-
void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus()
143+
void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
144144
{
145145
if ( mWidget )
146146
{
147-
if ( mValidConstraint )
147+
if ( constraintValid )
148148
mWidget->setStyleSheet( QString() );
149149
else
150150
mWidget->setStyleSheet( ".QComboBox { background-color: #dd7777; }" );

src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapp
7171
* change the visual cue.
7272
* @note added in QGIS 2.16
7373
*/
74-
void updateConstraintWidgetStatus() override;
74+
void updateConstraintWidgetStatus( bool constraintValid ) override;
7575

7676
private:
7777
QgsRelationReferenceWidget* mWidget;

src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ void QgsWebViewWidgetWrapper::selectFileName()
189189
mLineEdit->setText( filePath );
190190
}
191191

192-
void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus()
192+
void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
193193
{
194194
if ( mLineEdit )
195195
{
196-
if ( mValidConstraint )
196+
if ( constraintValid )
197197
mLineEdit->setStyleSheet( QString() );
198198
else
199199
{

src/gui/editorwidgets/qgswebviewwidgetwrapper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class GUI_EXPORT QgsWebViewWidgetWrapper : public QgsEditorWidgetWrapper
5353
void selectFileName();
5454

5555
private:
56-
void updateConstraintWidgetStatus() override;
56+
void updateConstraintWidgetStatus( bool constraintValid ) override;
5757

5858
//! This label is used as a container to display the picture
5959
QWebView* mWebView;

0 commit comments

Comments
 (0)