Skip to content

Commit

Permalink
last fixes and sip_include
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Sep 11, 2018
1 parent b3e4755 commit 533ab61
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion python/gui/auto_generated/qgsattributeeditorcontext.sip.in
Expand Up @@ -225,7 +225,7 @@ Set ``attributeFormMode`` for the edited form
.. versionadded:: 3.4 .. versionadded:: 3.4
%End %End


QString attributeFormModeString( const Mode &attributeFormMode ); QString attributeFormModeString() const;
%Docstring %Docstring
Returns given ``attributeFormMode`` as string Returns given ``attributeFormMode`` as string


Expand Down
10 changes: 10 additions & 0 deletions python/gui/auto_generated/qgsattributeform.sip.in
Expand Up @@ -19,6 +19,16 @@ class QgsAttributeForm : QWidget
%End %End
public: public:


enum Mode
{
SingleEditMode,
AddFeatureMode,
MultiEditMode,
SearchMode,
AggregateSearchMode,
IdentifyMode
};

enum FilterType enum FilterType
{ {
ReplaceFilter, ReplaceFilter,
Expand Down
2 changes: 1 addition & 1 deletion python/gui/gui_auto.sip
@@ -1,5 +1,4 @@
// Include auto-generated SIP files // Include auto-generated SIP files
%Include auto_generated/qgsattributeeditorcontext.sip
%Include auto_generated/qgsattributeforminterface.sip %Include auto_generated/qgsattributeforminterface.sip
%Include auto_generated/qgsdetaileditemdata.sip %Include auto_generated/qgsdetaileditemdata.sip
%Include auto_generated/qgsexpressionbuilderdialog.sip %Include auto_generated/qgsexpressionbuilderdialog.sip
Expand Down Expand Up @@ -208,6 +207,7 @@
%Include auto_generated/qgsvariableeditorwidget.sip %Include auto_generated/qgsvariableeditorwidget.sip
%Include auto_generated/qgsvscrollarea.sip %Include auto_generated/qgsvscrollarea.sip
%Include auto_generated/qgsfiledownloaderdialog.sip %Include auto_generated/qgsfiledownloaderdialog.sip
%Include auto_generated/qgsattributeeditorcontext.sip
%Include auto_generated/raster/qgscolorrampshaderwidget.sip %Include auto_generated/raster/qgscolorrampshaderwidget.sip
%Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip %Include auto_generated/raster/qgsmultibandcolorrendererwidget.sip
%Include auto_generated/raster/qgspalettedrendererwidget.sip %Include auto_generated/raster/qgspalettedrendererwidget.sip
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsqmlwidgetwrapper.cpp
Expand Up @@ -87,7 +87,7 @@ void QgsQmlWidgetWrapper::setQmlContext( )


QgsAttributeEditorContext attributecontext = context(); QgsAttributeEditorContext attributecontext = context();
QgsExpressionContext expressionContext = layer()->createExpressionContext(); QgsExpressionContext expressionContext = layer()->createExpressionContext();
expressionContext << QgsExpressionContextUtils::formScope( mFeature, attributecontext.attributeFormModeString( attributecontext.attributeFormMode() ) ); expressionContext << QgsExpressionContextUtils::formScope( mFeature, attributecontext.attributeFormModeString() );
expressionContext.setFeature( mFeature ); expressionContext.setFeature( mFeature );


QmlExpression *qmlExpression = new QmlExpression(); QmlExpression *qmlExpression = new QmlExpression();
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsattributeeditorcontext.h
Expand Up @@ -236,10 +236,10 @@ class GUI_EXPORT QgsAttributeEditorContext
* Returns given \a attributeFormMode as string * Returns given \a attributeFormMode as string
* \since QGIS 3.4 * \since QGIS 3.4
*/ */
QString attributeFormModeString( const Mode &attributeFormMode ) QString attributeFormModeString() const
{ {
const QMetaEnum metaEnum( QMetaEnum::fromType<Mode>() ); const QMetaEnum metaEnum( QMetaEnum::fromType<Mode>() );
return metaEnum.valueToKey( static_cast<int>( attributeFormMode ) ); return metaEnum.valueToKey( static_cast<int>( mAttributeFormMode ) );
} }


private: private:
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsattributeform.cpp
Expand Up @@ -805,7 +805,7 @@ void QgsAttributeForm::updateConstraints( QgsEditorWidgetWrapper *eww )


mExpressionContext.setFeature( ft ); mExpressionContext.setFeature( ft );


mExpressionContext << QgsExpressionContextUtils::formScope( ft, mContext.attributeFormModeString( mMode ) ); mExpressionContext << QgsExpressionContextUtils::formScope( ft, mContext.attributeFormModeString() );


// Recheck visibility for all containers which are controlled by this value // Recheck visibility for all containers which are controlled by this value
const QVector<ContainerInformation *> infos = mContainerInformationDependency.value( eww->field().name() ); const QVector<ContainerInformation *> infos = mContainerInformationDependency.value( eww->field().name() );
Expand All @@ -819,7 +819,7 @@ void QgsAttributeForm::updateConstraints( QgsEditorWidgetWrapper *eww )
void QgsAttributeForm::updateContainersVisibility() void QgsAttributeForm::updateContainersVisibility()
{ {


mExpressionContext << QgsExpressionContextUtils::formScope( QgsFeature( mFeature ), mContext.attributeFormModeString( mMode ) ); mExpressionContext << QgsExpressionContextUtils::formScope( QgsFeature( mFeature ), mContext.attributeFormModeString() );


const QVector<ContainerInformation *> infos = mContainerVisibilityInformation; const QVector<ContainerInformation *> infos = mContainerVisibilityInformation;


Expand Down
12 changes: 12 additions & 0 deletions src/gui/qgsattributeform.h
Expand Up @@ -46,6 +46,18 @@ class GUI_EXPORT QgsAttributeForm : public QWidget


public: public:


//! Form modes \deprecated Use QgsAttributeEditorContext::Mode instead.
enum Mode
{
SingleEditMode, //!< Single edit mode, for editing a single feature
AddFeatureMode, /*!< Add feature mode, for setting attributes for a new feature. In this mode the dialog will be editable even with an invalid feature and
will add a new feature when the form is accepted. */
MultiEditMode, //!< Multi edit mode, for editing fields of multiple features at once
SearchMode, //!< Form values are used for searching/filtering the layer
AggregateSearchMode, //!< Form is in aggregate search mode, show each widget in this mode \since QGIS 3.0
IdentifyMode //!< Identify the feature \since QGIS 3.0
};

//! Filter types //! Filter types
enum FilterType enum FilterType
{ {
Expand Down

0 comments on commit 533ab61

Please sign in to comment.