Skip to content
Permalink
Browse files

rephrase shown to visible

  • Loading branch information
3nids committed Jul 13, 2020
1 parent d2e1d96 commit 256044cf2c5a10614b283c199c3dfec93ba7dc78
@@ -1,13 +1,13 @@
# The following has been generated automatically from src/core/qgsattributeeditorelement.h
# monkey patching scoped based enum
QgsAttributeEditorRelation.Button.Link.__doc__ = "Show link button"
QgsAttributeEditorRelation.Button.Unlink.__doc__ = "Show unlink button"
QgsAttributeEditorRelation.Button.SaveChildEdits.__doc__ = "Show save child edits button"
QgsAttributeEditorRelation.Button.AddChildFeature.__doc__ = "Show add child feature (as in some projects we only want to allow to link/unlink existing features)"
QgsAttributeEditorRelation.Button.DuplicateChildFeature.__doc__ = "Show duplicate child feature"
QgsAttributeEditorRelation.Button.DeleteChildFeature.__doc__ = "Show delete child feature button"
QgsAttributeEditorRelation.Button.ZoomToChildFeature.__doc__ = "Show zoom to child feature"
QgsAttributeEditorRelation.Button.AllButtons.__doc__ = "Defaults set of buttons shown"
QgsAttributeEditorRelation.Button.Link.__doc__ = "Link button"
QgsAttributeEditorRelation.Button.Unlink.__doc__ = "Unlink button"
QgsAttributeEditorRelation.Button.SaveChildEdits.__doc__ = "Save child edits button"
QgsAttributeEditorRelation.Button.AddChildFeature.__doc__ = "Add child feature (as in some projects we only want to allow to link/unlink existing features)"
QgsAttributeEditorRelation.Button.DuplicateChildFeature.__doc__ = "Duplicate child feature"
QgsAttributeEditorRelation.Button.DeleteChildFeature.__doc__ = "Delete child feature button"
QgsAttributeEditorRelation.Button.ZoomToChildFeature.__doc__ = "Zoom to child feature"
QgsAttributeEditorRelation.Button.AllButtons.__doc__ = "All buttons"
QgsAttributeEditorRelation.Button.__doc__ = 'Possible buttons shown in the relation editor\n\n.. versionadded:: 3.16\n\n' + '* ``Link``: ' + QgsAttributeEditorRelation.Button.Link.__doc__ + '\n' + '* ``Unlink``: ' + QgsAttributeEditorRelation.Button.Unlink.__doc__ + '\n' + '* ``SaveChildEdits``: ' + QgsAttributeEditorRelation.Button.SaveChildEdits.__doc__ + '\n' + '* ``AddChildFeature``: ' + QgsAttributeEditorRelation.Button.AddChildFeature.__doc__ + '\n' + '* ``DuplicateChildFeature``: ' + QgsAttributeEditorRelation.Button.DuplicateChildFeature.__doc__ + '\n' + '* ``DeleteChildFeature``: ' + QgsAttributeEditorRelation.Button.DeleteChildFeature.__doc__ + '\n' + '* ``ZoomToChildFeature``: ' + QgsAttributeEditorRelation.Button.ZoomToChildFeature.__doc__ + '\n' + '* ``AllButtons``: ' + QgsAttributeEditorRelation.Button.AllButtons.__doc__
# --
QgsAttributeEditorRelation.Button.baseClass = QgsAttributeEditorRelation
@@ -359,7 +359,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowLinkButton( bool showLinkButton ) /Deprecated/;
@@ -369,7 +369,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showUnlinkButton() const /Deprecated/;
@@ -379,7 +379,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowUnlinkButton( bool showUnlinkButton ) /Deprecated/;
@@ -389,7 +389,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

void setShowSaveChildEditsButton( bool showChildEdits ) /Deprecated/;
@@ -399,7 +399,7 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showSaveChildEditsButton() const /Deprecated/;
@@ -409,17 +409,17 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons );
void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16
%End

QgsAttributeEditorRelation::Buttons shownButtons() const;
QgsAttributeEditorRelation::Buttons visibleButtons() const;
%Docstring
Returns the buttons which are shown

@@ -46,7 +46,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowLinkButton( bool showLinkButton ) /Deprecated/;
@@ -56,7 +56,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showUnlinkButton() const /Deprecated/;
@@ -66,7 +66,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowUnlinkButton( bool showUnlinkButton ) /Deprecated/;
@@ -76,7 +76,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

void setShowSaveChildEditsButton( bool showChildEdits ) /Deprecated/;
@@ -86,7 +86,7 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showSaveChildEditsButton() const /Deprecated/;
@@ -96,17 +96,17 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons );
void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16
%End

QgsAttributeEditorRelation::Buttons shownButtons() const;
QgsAttributeEditorRelation::Buttons visibleButtons() const;
%Docstring
Returns the buttons which are shown

@@ -116,7 +116,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowLinkButton( bool showLinkButton ) /Deprecated/;
@@ -126,7 +126,7 @@ Determines if the "link feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showUnlinkButton() const /Deprecated/;
@@ -136,7 +136,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShowUnlinkButton( bool showUnlinkButton ) /Deprecated/;
@@ -146,7 +146,7 @@ Determines if the "unlink feature" button should be shown
.. versionadded:: 2.18

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

void setShowSaveChildEditsButton( bool showChildEdits ) /Deprecated/;
@@ -156,7 +156,7 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use setShownButtons() instead
use setVisibleButtons() instead
%End

bool showSaveChildEditsButton() const /Deprecated/;
@@ -166,17 +166,17 @@ Determines if the "Save child layer edits" button should be shown
.. versionadded:: 3.14

.. deprecated:: QGIS 3.16
use shownButtons() instead
use visibleButtons() instead
%End

void setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons );
void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );
%Docstring
Defines the buttons which are shown

.. versionadded:: 3.16
%End

QgsAttributeEditorRelation::Buttons shownButtons() const;
QgsAttributeEditorRelation::Buttons visibleButtons() const;
%Docstring
Returns the buttons which are shown

@@ -170,7 +170,7 @@ bool QgsAttributeEditorRelation::showSaveChildEditsButton() const
return mButtons.testFlag( Button::SaveChildEdits );
}

void QgsAttributeEditorRelation::setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons )
void QgsAttributeEditorRelation::setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons )
{
mButtons = buttons;
}
@@ -342,14 +342,14 @@ class CORE_EXPORT QgsAttributeEditorRelation : public QgsAttributeEditorElement
*/
enum class Button : int
{
Link = 1 << 1, //!< Show link button
Unlink = 1 << 2, //!< Show unlink button
SaveChildEdits = 1 << 3, //!< Show save child edits button
AddChildFeature = 1 << 4, //!< Show add child feature (as in some projects we only want to allow to link/unlink existing features)
DuplicateChildFeature = 1 << 5, //!< Show duplicate child feature
DeleteChildFeature = 1 << 6, //!< Show delete child feature button
ZoomToChildFeature = 1 << 7, //!< Show zoom to child feature
AllButtons = Link | Unlink | SaveChildEdits | AddChildFeature | DuplicateChildFeature | DeleteChildFeature | ZoomToChildFeature //!< Defaults set of buttons shown
Link = 1 << 1, //!< Link button
Unlink = 1 << 2, //!< Unlink button
SaveChildEdits = 1 << 3, //!< Save child edits button
AddChildFeature = 1 << 4, //!< Add child feature (as in some projects we only want to allow to link/unlink existing features)
DuplicateChildFeature = 1 << 5, //!< Duplicate child feature
DeleteChildFeature = 1 << 6, //!< Delete child feature button
ZoomToChildFeature = 1 << 7, //!< Zoom to child feature
AllButtons = Link | Unlink | SaveChildEdits | AddChildFeature | DuplicateChildFeature | DeleteChildFeature | ZoomToChildFeature //!< All buttons
};
Q_ENUM( Button )
Q_DECLARE_FLAGS( Buttons, Button )
@@ -417,64 +417,64 @@ class CORE_EXPORT QgsAttributeEditorRelation : public QgsAttributeEditorElement
/**
* Determines if the "link feature" button should be shown
* \since QGIS 2.18
* \deprecated since QGIS 3.16 use shownButtons() instead
* \deprecated since QGIS 3.16 use visibleButtons() instead
*/
Q_DECL_DEPRECATED bool showLinkButton() const SIP_DEPRECATED;

/**
* Determines if the "link feature" button should be shown
* \since QGIS 2.18
* \deprecated since QGIS 3.16 use setShownButtons() instead
* \deprecated since QGIS 3.16 use setVisibleButtons() instead
*/
Q_DECL_DEPRECATED void setShowLinkButton( bool showLinkButton ) SIP_DEPRECATED;

/**
* Determines if the "unlink feature" button should be shown
* \since QGIS 2.18
* \deprecated since QGIS 3.16 use shownButtons() instead
* \deprecated since QGIS 3.16 use visibleButtons() instead
*/
Q_DECL_DEPRECATED bool showUnlinkButton() const SIP_DEPRECATED;

/**
* Determines if the "unlink feature" button should be shown
* \since QGIS 2.18
* \deprecated since QGIS 3.16 use setShownButtons() instead
* \deprecated since QGIS 3.16 use setVisibleButtons() instead
*/
Q_DECL_DEPRECATED void setShowUnlinkButton( bool showUnlinkButton ) SIP_DEPRECATED;

/**
* Determines if the "Save child layer edits" button should be shown
* \since QGIS 3.14
* \deprecated since QGIS 3.16 use setShownButtons() instead
* \deprecated since QGIS 3.16 use setVisibleButtons() instead
*/
Q_DECL_DEPRECATED void setShowSaveChildEditsButton( bool showChildEdits ) SIP_DEPRECATED;

/**
* Determines if the "Save child layer edits" button should be shown
* \since QGIS 3.14
* \deprecated since QGIS 3.16 use shownButtons() instead
* \deprecated since QGIS 3.16 use visibleButtons() instead
*/
Q_DECL_DEPRECATED bool showSaveChildEditsButton() const SIP_DEPRECATED;

/**
* Defines the buttons which are shown
* \since QGIS 3.16
*/
void setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons );
void setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons );

/**
* Returns the buttons which are shown
* \since QGIS 3.16
*/
QgsAttributeEditorRelation::Buttons shownButtons() const {return mButtons;}
QgsAttributeEditorRelation::Buttons visibleButtons() const {return mButtons;}


private:
void saveConfiguration( QDomElement &elem ) const override;
QString typeIdentifier() const override;
QString mRelationId;
QgsRelation mRelation;
Buttons mButtons = Button::AllButtons;
Buttons mButtons = Buttons( Button::AllButtons );
};

Q_DECLARE_OPERATORS_FOR_FLAGS( QgsAttributeEditorRelation::Buttons )
@@ -618,7 +618,7 @@ QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomEleme
if ( elem.hasAttribute( "buttons" ) )
{
QString buttonString = elem.attribute( QStringLiteral( "buttons" ), qgsFlagValueToKeys( QgsAttributeEditorRelation::Button::AllButtons ) );
relElement->setShownButtons( qgsFlagKeysToValue( buttonString, QgsAttributeEditorRelation::Button::AllButtons ) );
relElement->setVisibleButtons( qgsFlagKeysToValue( buttonString, QgsAttributeEditorRelation::Button::AllButtons ) );
}
else
{
@@ -627,7 +627,7 @@ QgsAttributeEditorElement *QgsEditFormConfig::attributeEditorElementFromDomEleme
buttons.setFlag( QgsAttributeEditorRelation::Button::Link, elem.attribute( QStringLiteral( "showLinkButton" ), QStringLiteral( "1" ) ).toInt() );
buttons.setFlag( QgsAttributeEditorRelation::Button::Unlink, elem.attribute( QStringLiteral( "showUnlinkButton" ), QStringLiteral( "1" ) ).toInt() );
buttons.setFlag( QgsAttributeEditorRelation::Button::SaveChildEdits, elem.attribute( QStringLiteral( "showSaveChildEditsButton" ), QStringLiteral( "1" ) ).toInt() );
relElement->setShownButtons( buttons );
relElement->setVisibleButtons( buttons );
}
newElement = relElement;
}
@@ -191,7 +191,7 @@ bool QgsRelationWidgetWrapper::valid() const

bool QgsRelationWidgetWrapper::showLinkButton() const
{
return shownButtons().testFlag( QgsAttributeEditorRelation::Button::Link );
return visibleButtons().testFlag( QgsAttributeEditorRelation::Button::Link );
}

void QgsRelationWidgetWrapper::setShowLinkButton( bool showLinkButton )
@@ -204,16 +204,16 @@ void QgsRelationWidgetWrapper::setShowLinkButton( bool showLinkButton )

bool QgsRelationWidgetWrapper::showSaveChildEditsButton() const
{
return shownButtons().testFlag( QgsAttributeEditorRelation::Button::SaveChildEdits );
return visibleButtons().testFlag( QgsAttributeEditorRelation::Button::SaveChildEdits );
}

void QgsRelationWidgetWrapper::setShownButtons( const QgsAttributeEditorRelation::Buttons &buttons )
void QgsRelationWidgetWrapper::setVisibleButtons( const QgsAttributeEditorRelation::Buttons &buttons )
{
if ( mWidget )
mWidget->setShownButtons( buttons );
mWidget->setVisibleButtons( buttons );
}

QgsAttributeEditorRelation::Buttons QgsRelationWidgetWrapper::shownButtons() const
QgsAttributeEditorRelation::Buttons QgsRelationWidgetWrapper::visibleButtons() const
{
return mWidget->shownButtons();
return mWidget->visibleButtons();
}

0 comments on commit 256044c

Please sign in to comment.
You can’t perform that action at this time.