mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
Refactor widget constraints to keep variables private
This commit is contained in:
parent
d285134109
commit
c68eaeb929
@ -199,5 +199,5 @@ class QgsEditorWidgetWrapper : QgsWidgetWrapper
|
||||
* This can be overwritten in subclasses to allow individual widgets to
|
||||
* change the visual cue.
|
||||
*/
|
||||
virtual void updateConstraintWidgetStatus();
|
||||
virtual void updateConstraintWidgetStatus( bool contraintValid );
|
||||
};
|
||||
|
@ -34,5 +34,5 @@ class QgsRelationReferenceWidgetWrapper : QgsEditorWidgetWrapper
|
||||
* change the visual cue.
|
||||
* @note added in QGIS 2.16
|
||||
*/
|
||||
void updateConstraintWidgetStatus();
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
};
|
||||
|
@ -97,9 +97,9 @@ void QgsEditorWidgetWrapper::valueChanged()
|
||||
emit valueChanged( value() );
|
||||
}
|
||||
|
||||
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
widget()->setStyleSheet( QString() );
|
||||
else
|
||||
widget()->setStyleSheet( "background-color: #dd7777;" );
|
||||
@ -162,7 +162,7 @@ void QgsEditorWidgetWrapper::updateConstraint( const QgsFeature &ft )
|
||||
|
||||
if ( toEmit )
|
||||
{
|
||||
updateConstraintWidgetStatus();
|
||||
updateConstraintWidgetStatus( mValidConstraint );
|
||||
emit constraintStatusChanged( expression, description, errStr, mValidConstraint );
|
||||
}
|
||||
}
|
||||
|
@ -220,11 +220,15 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
|
||||
*
|
||||
* This can be overwritten in subclasses to allow individual widgets to
|
||||
* change the visual cue.
|
||||
*
|
||||
* @param constraintValid The current constraint status.
|
||||
*
|
||||
* @note added in QGIS 2.16
|
||||
*/
|
||||
virtual void updateConstraintWidgetStatus();
|
||||
virtual void updateConstraintWidgetStatus( bool constraintValid );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Boolean storing the current validity of the constraint for this widget.
|
||||
*/
|
||||
|
@ -78,7 +78,7 @@ void QgsColorWidgetWrapper::setValue( const QVariant& value )
|
||||
mColorButton->setColor( !value.isNull() ? QColor( value.toString() ) : QColor() );
|
||||
}
|
||||
|
||||
void QgsColorWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsColorWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper
|
||||
void setValue( const QVariant& value ) override;
|
||||
|
||||
private:
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
QgsColorButtonV2* mColorButton;
|
||||
};
|
||||
|
@ -188,11 +188,11 @@ void QgsExternalResourceWidgetWrapper::setEnabled( bool enabled )
|
||||
mQgsWidget->setReadOnly( !enabled );
|
||||
}
|
||||
|
||||
void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mLineEdit )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
mLineEdit->setStyleSheet( QString() );
|
||||
else
|
||||
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
|
||||
|
@ -54,7 +54,7 @@ class GUI_EXPORT QgsExternalResourceWidgetWrapper : public QgsEditorWidgetWrappe
|
||||
void setEnabled( bool enabled ) override;
|
||||
|
||||
private:
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
QLineEdit* mLineEdit;
|
||||
QLabel* mLabel;
|
||||
|
@ -152,11 +152,11 @@ void QgsFileNameWidgetWrapper::selectFileName()
|
||||
mLineEdit->setText( fileName );
|
||||
}
|
||||
|
||||
void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mLineEdit )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
mLineEdit->setStyleSheet( QString() );
|
||||
else
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper
|
||||
void setValue( const QVariant& value ) override;
|
||||
|
||||
private:
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
QLineEdit* mLineEdit;
|
||||
QPushButton* mPushButton;
|
||||
|
@ -267,11 +267,11 @@ void QgsPhotoWidgetWrapper::setEnabled( bool enabled )
|
||||
mButton->setEnabled( enabled );
|
||||
}
|
||||
|
||||
void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mLineEdit )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
mLineEdit->setStyleSheet( QString() );
|
||||
else
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ class GUI_EXPORT QgsPhotoWidgetWrapper : public QgsEditorWidgetWrapper
|
||||
void loadPixmap( const QString& fileName );
|
||||
|
||||
private:
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
//! This label is used as a container to display the picture
|
||||
QLabel* mPhotoLabel;
|
||||
|
@ -140,11 +140,11 @@ void QgsRelationReferenceWidgetWrapper::foreignKeyChanged( QVariant value )
|
||||
emit valueChanged( value );
|
||||
}
|
||||
|
||||
void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mWidget )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
mWidget->setStyleSheet( QString() );
|
||||
else
|
||||
mWidget->setStyleSheet( ".QComboBox { background-color: #dd7777; }" );
|
||||
|
@ -71,7 +71,7 @@ class GUI_EXPORT QgsRelationReferenceWidgetWrapper : public QgsEditorWidgetWrapp
|
||||
* change the visual cue.
|
||||
* @note added in QGIS 2.16
|
||||
*/
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
private:
|
||||
QgsRelationReferenceWidget* mWidget;
|
||||
|
@ -189,11 +189,11 @@ void QgsWebViewWidgetWrapper::selectFileName()
|
||||
mLineEdit->setText( filePath );
|
||||
}
|
||||
|
||||
void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus()
|
||||
void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus( bool constraintValid )
|
||||
{
|
||||
if ( mLineEdit )
|
||||
{
|
||||
if ( mValidConstraint )
|
||||
if ( constraintValid )
|
||||
mLineEdit->setStyleSheet( QString() );
|
||||
else
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ class GUI_EXPORT QgsWebViewWidgetWrapper : public QgsEditorWidgetWrapper
|
||||
void selectFileName();
|
||||
|
||||
private:
|
||||
void updateConstraintWidgetStatus() override;
|
||||
void updateConstraintWidgetStatus( bool constraintValid ) override;
|
||||
|
||||
//! This label is used as a container to display the picture
|
||||
QWebView* mWebView;
|
||||
|
Loading…
x
Reference in New Issue
Block a user