33#include "moc_qgsattributesformmodel.cpp"
37 if ( !layer || idx < 0 || idx >= layer->
fields().
count() )
57QgsAttributesFormData::FieldConfig::operator QVariant()
59 return QVariant::fromValue<QgsAttributesFormData::FieldConfig>( *
this );
62QgsAttributesFormData::RelationEditorConfiguration::operator QVariant()
64 return QVariant::fromValue<QgsAttributesFormData::RelationEditorConfiguration>( *
this );
69 return mContainerType;
74 mContainerType = type;
99 return mVisibilityExpression;
109 return mCollapsedExpression;
119 return mRelationEditorConfiguration;
129 return mQmlElementEditorConfiguration;
140 return mHtmlElementEditorConfiguration;
150 return mSpacerElementEditorConfiguration;
160 return mBackgroundColor;
170 return mTextElementEditorConfiguration;
197 return mChildren.at(
row ).get();
204 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
208 const auto it = std::find_if( mChildren.cbegin(), mChildren.cend(), [itemType, itemId](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
209 return item->type() == itemType && item->id() == itemId;
212 if ( it != mChildren.cend() )
220 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
223 for (
const auto &
child : std::as_const( mChildren ) )
225 if (
child->type() == itemType &&
child->id() == itemId )
228 if (
child->childCount() > 0 )
241 return static_cast< int >( mChildren.size() );
249 const auto it = std::find_if( mParent->mChildren.cbegin(), mParent->mChildren.cend(), [
this](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
250 return item.get() == this;
253 if ( it != mParent->mChildren.cend() )
255 return static_cast< int >( std::distance( mParent->mChildren.cbegin(), it ) );
266 if ( !item->mParent )
267 item->mParent =
this;
272 mChildren.push_back( std::move( item ) );
274 emit
addedChildren(
this, mChildren.size() - 1, mChildren.size() - 1 );
279 if ( position < 0 || position >
static_cast< int >( mChildren.size() ) || !item )
282 if ( !item->mParent )
283 item->mParent =
this;
288 mChildren.insert( mChildren.begin() + position, std::move( item ) );
295 if ( index >= 0 && index <
static_cast< int >( mChildren.size() ) )
296 mChildren.erase( mChildren.begin() + index );
316 return QVariant::fromValue( mData );
324 return QVariant::fromValue( mFieldConfigData );
341 mName = value.toString();
346 mDisplayName = value.toString();
356 mId = value.toString();
371 : QAbstractItemModel(
parent )
382 if (
index.isValid() )
403 return parentItem ? parentItem->
childCount() : 0;
416 for (
int i = 0; i < std::min( pathA.size(), pathB.size() ); i++ )
418 if ( pathA.at( i ) != pathB.at( i ) )
420 return pathA.at( i ) < pathB.at( i );
424 return pathA.size() < pathB.size();
439 if ( !hasIndex( row, column,
parent ) )
440 return QModelIndex();
444 return QModelIndex();
447 return createIndex( row, column, childItem );
449 return QModelIndex();
454 if ( !
index.isValid() )
455 return QModelIndex();
460 return ( parentItem !=
mRootItem.get() && parentItem !=
nullptr )
461 ? createIndex( parentItem->
row(), 0, parentItem )
468 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
474 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
479 if ( !
index.isValid() )
483 bool result = item->
setData( role, value );
515 const QModelIndex childIndex =
index( i, 0,
parent );
516 if ( hasChildren( childIndex ) )
531 if ( !
index.isValid() )
532 return Qt::NoItemFlags;
534 Qt::ItemFlags
flags = Qt::ItemIsEnabled;
539 flags =
flags | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable;
548 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Available Widgets" ) : QVariant {};
564 for (
int i = 0; i < fields.
size(); ++i )
568 itemData.setShowLabel(
true );
572 auto item = std::make_unique< QgsAttributesFormItem >();
581 itemFields->addChild( std::move( item ) );
584 mRootItem->addChild( std::move( itemFields ) );
590 const QList<QgsRelation> relations =
mProject->relationManager()->referencedRelations(
mLayer );
596 if ( polymorphicRelation.
isValid() )
598 name = QStringLiteral(
"%1 (%2)" ).arg( relation.name(), polymorphicRelation.
name() );
602 name = relation.name();
607 auto itemRelation = std::make_unique< QgsAttributesFormItem >();
610 itemRelation->setData(
ItemIdRole, relation.id() );
613 itemRelations->addChild( std::move( itemRelation ) );
616 mRootItem->addChild( std::move( itemRelations ) );
621 mRootItem->addChild( std::move( itemActions ) );
622 populateActionItems(
mLayer->actions()->actions() );
632 itemOtherWidgets->addChild( std::move( itemQml ) );
636 auto itemHtml = std::make_unique< QgsAttributesFormItem >(
QgsAttributesFormData::HtmlWidget, itemHtmlData, QStringLiteral(
"HTML Widget" ), tr(
"HTML Widget" ) );
638 itemOtherWidgets->addChild( std::move( itemHtml ) );
642 auto itemText = std::make_unique< QgsAttributesFormItem >(
QgsAttributesFormData::TextWidget, itemTextData, QStringLiteral(
"Text Widget" ), tr(
"Text Widget" ) );
644 itemOtherWidgets->addChild( std::move( itemText ) );
650 itemOtherWidgets->addChild( std::move( itemSpacer ) );
652 mRootItem->addChild( std::move( itemOtherWidgets ) );
662 beginRemoveRows( actionsIndex, 0, itemActions->
childCount() );
667 for (
const auto &action : std::as_const( actions ) )
669 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( QStringLiteral(
"Feature" ) ) || action.actionScopes().contains( QStringLiteral(
"Layer" ) ) ) )
677 beginInsertRows( actionsIndex, 0, count - 1 );
678 populateActionItems( actions );
683void QgsAttributesAvailableWidgetsModel::populateActionItems(
const QList<QgsAction> actions )
688 for (
const auto &action : std::as_const( actions ) )
690 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( QStringLiteral(
"Feature" ) ) || action.actionScopes().contains( QStringLiteral(
"Layer" ) ) ) )
692 const QString actionTitle { action.shortTitle().isEmpty() ? action.name() : action.shortTitle() };
694 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
697 auto itemAction = std::make_unique< QgsAttributesFormItem >();
698 itemAction->setData(
ItemIdRole, action.id().toString() );
704 itemActions->
addChild( std::move( itemAction ) );
711 if ( !
index.isValid() )
720 bool invalidRelation =
false;
728 case Qt::DisplayRole:
738 case Qt::ToolTipRole:
743 if ( !cfg.mAlias.isEmpty() )
744 return tr(
"%1 (%2)" ).arg( item->
name(), cfg.mAlias );
752 return tr(
"Invalid relation" );
758 case Qt::DecorationRole:
761 case Qt::BackgroundRole:
764 return QBrush( QColor( 140, 140, 140, 50 ) );
769 case Qt::ForegroundRole:
775 return QBrush( QColor( Qt::lightGray ) );
781 return QBrush( QColor( 255, 0, 0 ) );
793 QFont font = QFont();
794 font.setItalic(
true );
807 return item->
data( role );
816 return Qt::CopyAction;
821 return QStringList() << QStringLiteral(
"application/x-qgsattributesformavailablewidgetsrelement" );
826 if ( indexes.count() == 0 )
830 if ( types.isEmpty() )
833 QMimeData *
data =
new QMimeData();
834 const QString format = types.at( 0 );
836 QDataStream stream( &encoded, QIODevice::WriteOnly );
839 QModelIndexList sortedIndexes = indexes;
841 std::sort( sortedIndexes.begin(), sortedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) {
842 return indexLessThan( a, b );
845 for (
const QModelIndex &
index : std::as_const( sortedIndexes ) )
847 if (
index.isValid() )
853 stream << itemId << itemType << itemName;
857 data->setData( format, encoded );
868 return createIndex( row, 0, item );
870 return QModelIndex();
880 return createIndex( row, 0, item );
882 return QModelIndex();
892 return createIndex( row, 0, item );
894 return QModelIndex();
900 return QModelIndex();
904 return QModelIndex();
907 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
919 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Form Layout" ) : QVariant {};
924 if ( !
index.isValid() )
925 return Qt::ItemIsDropEnabled;
927 Qt::ItemFlags
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
931 flags |= Qt::ItemIsDropEnabled;
944 const auto editorElements =
mLayer->editFormConfig().tabs();
947 loadAttributeEditorElementItem( editorElement,
mRootItem.get() );
962 auto editorItem = std::make_unique< QgsAttributesFormItem >();
964 switch ( editorElement->
type() )
968 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
969 setCommonProperties( itemData );
976 const int fieldIndex =
mLayer->fields().indexOf( editorElement->
name() );
977 if ( fieldIndex != -1 )
981 QgsAttributesFormData::FieldConfig config(
mLayer, fieldIndex );
983 editorItem->setIcon(
QgsGui::instance()->editorWidgetRegistry()->icon( config.mEditorWidgetType ) );
991 const QgsAttributeEditorAction *actionEditor =
static_cast<const QgsAttributeEditorAction *
>( editorElement );
992 const QgsAction action { actionEditor->
action(
mLayer ) };
995 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
996 setCommonProperties( itemData );
998 editorItem->setData(
ItemIdRole, action.
id().toString() );
1013 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1014 setCommonProperties( itemData );
1016 const QgsAttributeEditorRelation *relationEditor =
static_cast<const QgsAttributeEditorRelation *
>( editorElement );
1017 QgsAttributesFormData::RelationEditorConfiguration relationEditorConfig;
1022 relationEditorConfig.
label = relationEditor->
label();
1025 QgsRelation relation = relationEditor->
relation();
1026 if ( relation.
id().isEmpty() )
1030 relation =
mProject->relationManager()->relation( editorElement->
name() );
1045 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1046 setCommonProperties( itemData );
1052 const QgsAttributeEditorContainer *container =
static_cast<const QgsAttributeEditorContainer *
>( editorElement );
1065 const QList<QgsAttributeEditorElement *> children = container->
children();
1066 for ( QgsAttributeEditorElement *childElement : children )
1068 loadAttributeEditorElementItem( childElement, editorItem.get() );
1075 const QgsAttributeEditorQmlElement *qmlElementEditor =
static_cast<const QgsAttributeEditorQmlElement *
>( editorElement );
1076 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1077 setCommonProperties( itemData );
1079 QgsAttributesFormData::QmlElementEditorConfiguration qmlEdConfig;
1092 const QgsAttributeEditorHtmlElement *htmlElementEditor =
static_cast<const QgsAttributeEditorHtmlElement *
>( editorElement );
1093 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1094 setCommonProperties( itemData );
1096 QgsAttributesFormData::HtmlElementEditorConfiguration htmlEdConfig;
1109 const QgsAttributeEditorTextElement *textElementEditor =
static_cast<const QgsAttributeEditorTextElement *
>( editorElement );
1110 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1111 setCommonProperties( itemData );
1113 QgsAttributesFormData::TextElementEditorConfiguration textEdConfig;
1114 textEdConfig.
text = textElementEditor->
text();
1126 const QgsAttributeEditorSpacerElement *spacerElementEditor =
static_cast<const QgsAttributeEditorSpacerElement *
>( editorElement );
1127 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1128 setCommonProperties( itemData );
1131 QgsAttributesFormData::SpacerElementEditorConfiguration spacerEdConfig;
1144 QgsDebugError( QStringLiteral(
"Not loading invalid attribute editor type..." ) );
1149 if ( position >= 0 && position < parent->childCount() )
1151 parent->insertChild( position, std::move( editorItem ) );
1155 parent->addChild( std::move( editorItem ) );
1161 if ( !
index.isValid() )
1174 const int fieldIndex =
mLayer->fields().indexOf( item->
name() );
1175 const bool invalidField = fieldIndex == -1;
1179 bool invalidRelation =
false;
1187 case Qt::DisplayRole:
1193 if ( item->
id().isEmpty() )
1195 return tr(
"Invalid relation" );
1201 return item->
name();
1207 case Qt::ToolTipRole:
1213 return tr(
"Invalid field" );
1217 return item->
name();
1223 if ( !item->
id().isEmpty() )
1226 return tr(
"Invalid relation" );
1233 case Qt::DecorationRole:
1234 return item->
icon();
1236 case Qt::BackgroundRole:
1239 return QBrush( QColor( 140, 140, 140, 50 ) );
1244 case Qt::ForegroundRole:
1250 return QBrush( QColor( 255, 0, 0 ) );
1254 return QBrush( QColor( Qt::lightGray ) );
1260 if ( invalidRelation )
1262 return QBrush( QColor( 255, 0, 0 ) );
1266 return QBrush( QColor( Qt::lightGray ) );
1279 QFont font = QFont();
1280 font.setItalic(
true );
1289 QFont font = QFont();
1290 font.setItalic(
true );
1303 return item->
data( role );
1320 beginRemoveRows(
parent, row, row + count - 1 );
1321 for (
int r = 0; r < count; ++r )
1329 beginRemoveRows(
parent, row, row );
1338 return Qt::MoveAction;
1343 return Qt::DropAction::CopyAction | Qt::DropAction::MoveAction;
1348 return QStringList() << QStringLiteral(
"application/x-qgsattributesformlayoutelement" ) << QStringLiteral(
"application/x-qgsattributesformavailablewidgetsrelement" );
1351QModelIndexList QgsAttributesFormLayoutModel::curateIndexesForMimeData(
const QModelIndexList &indexes )
const
1353 QModelIndexList containerList;
1354 for (
const auto index : indexes )
1359 containerList <<
index;
1363 if ( containerList.size() == 0 )
1366 QModelIndexList curatedIndexes;
1369 for (
const auto index : indexes )
1372 bool redundantChild =
false;
1374 while (
parent.isValid() )
1376 if ( containerList.contains(
parent ) )
1378 redundantChild =
true;
1385 if ( !redundantChild )
1386 curatedIndexes <<
index;
1389 return curatedIndexes;
1394 if ( indexes.count() == 0 )
1398 QModelIndexList curatedIndexes;
1399 if ( indexes.count() > 1 )
1401 curatedIndexes = curateIndexesForMimeData( indexes );
1405 curatedIndexes = indexes;
1409 if ( types.isEmpty() )
1412 QMimeData *
data =
new QMimeData();
1413 const QString format = types.at( 0 );
1415 QDataStream stream( &encoded, QIODevice::WriteOnly );
1418 std::sort( curatedIndexes.begin(), curatedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) {
1419 return indexLessThan( a, b );
1422 for (
const QModelIndex &
index : std::as_const( curatedIndexes ) )
1424 if (
index.isValid() )
1428 QDomElement rootElem = doc.createElement( QStringLiteral(
"form_layout_mime" ) );
1431 rootElem.appendChild( editorElem );
1433 doc.appendChild( rootElem );
1434 stream << doc.toString( -1 );
1438 data->setData( format, encoded );
1445 bool isDropSuccessful =
false;
1451 if ( action == Qt::IgnoreAction )
1453 isDropSuccessful =
true;
1455 else if (
data->hasFormat( QStringLiteral(
"application/x-qgsattributesformavailablewidgetsrelement" ) ) )
1457 Q_ASSERT( action == Qt::CopyAction );
1458 QByteArray itemData =
data->data( QStringLiteral(
"application/x-qgsattributesformavailablewidgetsrelement" ) );
1459 QDataStream stream( &itemData, QIODevice::ReadOnly );
1461 while ( !stream.atEnd() )
1466 stream >> itemId >> itemTypeInt >> itemName;
1471 isDropSuccessful =
true;
1473 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1479 else if (
data->hasFormat( QStringLiteral(
"application/x-qgsattributesformlayoutelement" ) ) )
1481 Q_ASSERT( action == Qt::MoveAction );
1482 QByteArray itemData =
data->data( QStringLiteral(
"application/x-qgsattributesformlayoutelement" ) );
1483 QDataStream stream( &itemData, QIODevice::ReadOnly );
1485 while ( !stream.atEnd() )
1491 if ( !doc.setContent( text ) )
1493 const QDomElement rootElem = doc.documentElement();
1494 if ( rootElem.tagName() != QLatin1String(
"form_layout_mime" ) || !rootElem.hasChildNodes() )
1496 const QDomElement childElem = rootElem.firstChild().toElement();
1500 beginInsertRows(
parent, row + rows, row + rows );
1504 isDropSuccessful =
true;
1506 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1513 return isDropSuccessful;
1518 for (
int i = 0; i <
parent->childCount(); i++ )
1530 updateFieldConfigForFieldItemsRecursive( child, fieldName, config );
1537 updateFieldConfigForFieldItemsRecursive(
mRootItem.get(), fieldName, config );
1540void QgsAttributesFormLayoutModel::updateAliasForFieldItemsRecursive(
QgsAttributesFormItem *parent,
const QString &fieldName,
const QString &fieldAlias )
1542 for (
int i = 0; i <
parent->childCount(); i++ )
1548 const QModelIndex
index = createIndex( child->
row(), 0, child );
1554 updateAliasForFieldItemsRecursive( child, fieldName, fieldAlias );
1561 updateAliasForFieldItemsRecursive(
mRootItem.get(), fieldName, fieldAlias );
1564QList< QgsAddAttributeFormContainerDialog::ContainerPair > QgsAttributesFormLayoutModel::recursiveListOfContainers(
QgsAttributesFormItem *parent )
const
1566 QList< QgsAddAttributeFormContainerDialog::ContainerPair > containerList;
1567 for (
int i = 0; i <
parent->childCount(); i++ )
1577 containerList.append( recursiveListOfContainers( child ) );
1581 return containerList;
1593 switch ( indexType )
1597 const int fieldIndex =
mLayer->fields().lookupField( indexName );
1630 bool isTopLevel = !
index.parent().isValid();
1642 QModelIndex childIndex;
1650 widgetDef = container;
1658 widgetDef = element;
1666 widgetDef = element;
1674 widgetDef = element;
1682 widgetDef = element;
1704 return recursiveListOfContainers(
mRootItem.get() );
1721 parentItem->
addChild( std::move( containerItem ) );
1731 beginInsertRows(
parent, row, row );
1732 auto item = std::make_unique< QgsAttributesFormItem >();
1744 : QSortFilterProxyModel( parent )
1751 QSortFilterProxyModel::setSourceModel( mModel );
1776 if ( mFilterText.isEmpty() )
1779 QModelIndex sourceIndex = sourceModel()->index( sourceRow, 0, sourceParent );
1780 if ( !sourceIndex.isValid() )
1788 QModelIndex parent = sourceIndex.
parent();
1789 while ( parent.isValid() )
1794 parent = parent.parent();
AttributeEditorContainerType
Attribute editor container types.
@ Action
A layer action element.
@ QmlElement
A QML element.
@ HtmlElement
A HTML element.
@ TextElement
A text element.
@ SpacerElement
A spacer element.
Utility class that encapsulates an action based on vector attributes.
QString name() const
The name of the action. This may be a longer description.
bool isValid() const
Returns true if this action was a default constructed one.
QString shortTitle() const
The short title is used to label user interface elements like buttons.
QUuid id() const
Returns a unique id for this action.
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
This element will load a layer action onto the form.
const QgsAction & action(const QgsVectorLayer *layer) const
Returns the (possibly lazy loaded) action for the given layer.
A container for attribute editors, used to group them visually in the attribute form if it is set to ...
virtual void addChildElement(QgsAttributeEditorElement *element)
Add a child element to this container.
QgsOptionalExpression visibilityExpression() const
The visibility expression is used in the attribute form to show or hide this container based on an ex...
void setColumnCount(int columnCount)
Set the number of columns in this group.
void setVisibilityExpression(const QgsOptionalExpression &visibilityExpression)
The visibility expression is used in the attribute form to show or hide this container based on an ex...
QgsOptionalExpression collapsedExpression() const
The collapsed expression is used in the attribute form to set the collapsed status of the group box c...
bool collapsed() const
For group box containers returns true if this group box is collapsed.
Qgis::AttributeEditorContainerType type() const
Returns the container type.
void setType(Qgis::AttributeEditorContainerType type)
Sets the container type.
void setCollapsedExpression(const QgsOptionalExpression &collapsedExpression)
The collapsed expression is used in the attribute form to set the collapsed status of the group box o...
QList< QgsAttributeEditorElement * > children() const
Gets a list of the children elements of this container.
QColor backgroundColor() const
Returns the background color of the container.
void setCollapsed(bool collapsed)
For group box containers sets if this group box is collapsed.
int columnCount() const
Gets the number of columns in this group.
void setBackgroundColor(const QColor &backgroundColor)
Sets the background color to backgroundColor.
An abstract base class for any elements of a drag and drop form.
void setHorizontalStretch(int stretch)
Sets the horizontal stretch factor for the element.
QDomElement toDomElement(QDomDocument &doc) const
Gets the XML Dom element to save this element.
LabelStyle labelStyle() const
Returns the label style.
void setLabelStyle(const LabelStyle &labelStyle)
Sets the labelStyle.
Qgis::AttributeEditorType type() const
The type of this element.
int verticalStretch() const
Returns the vertical stretch factor for the element.
bool showLabel() const
Controls if this element should be labeled with a title (field, relation or groupname).
QString name() const
Returns the name of this element.
static QgsAttributeEditorElement * create(const QDomElement &element, const QString &layerId, const QgsFields &fields, const QgsReadWriteContext &context, QgsAttributeEditorElement *parent=nullptr)
Constructs the editor element from the given element.
void setVerticalStretch(int stretch)
Sets the vertical stretch factor for the element.
void setShowLabel(bool showLabel)
Controls if this element should be labeled with a title (field, relation or groupname).
int horizontalStretch() const
Returns the horizontal stretch factor for the element.
This element will load a field's widget onto the form.
An attribute editor widget that will represent arbitrary HTML code.
QString htmlCode() const
The Html code that will be represented within this widget.
void setHtmlCode(const QString &htmlCode)
Sets the HTML code that will be represented within this widget to htmlCode.
An attribute editor widget that will represent arbitrary QML code.
QString qmlCode() const
The QML code that will be represented within this widget.
void setQmlCode(const QString &qmlCode)
Sets the QML code that will be represented within this widget to qmlCode.
This element will load a relation editor onto the form.
void setNmRelationId(const QVariant &nmRelationId=QVariant())
Sets nmRelationId for the relation id of the second relation involved in an N:M relation.
void setRelationWidgetTypeId(const QString &relationWidgetTypeId)
Sets the relation widget type.
const QgsRelation & relation() const
Gets the id of the relation which shall be embedded.
QVariantMap relationEditorConfiguration() const
Returns the relation editor widget configuration.
void setForceSuppressFormPopup(bool forceSuppressFormPopup)
Sets force suppress form popup status to forceSuppressFormPopup.
QVariant nmRelationId() const
Determines the relation id of the second relation involved in an N:M relation.
bool forceSuppressFormPopup() const
Determines the force suppress form popup status.
QString relationWidgetTypeId() const
Returns the current relation widget type id.
void setRelationEditorConfiguration(const QVariantMap &config)
Sets the relation editor configuration.
void setLabel(const QString &label=QString())
Sets label for this element If it's empty it takes the relation id as label.
QString label() const
Determines the label of this element.
An attribute editor widget that will represent a spacer.
void setDrawLine(bool drawLine)
Sets a flag to define if the spacer element will contain an horizontal line.
bool drawLine() const
Returns true if the spacer element will contain an horizontal line.
An attribute editor widget that will represent arbitrary text code.
void setText(const QString &text)
Sets the text that will be represented within this widget to text.
QString text() const
The Text that will be represented within this widget.
Encapsulate a field in an attribute table or data source.
Qgis::FieldDomainSplitPolicy splitPolicy() const
Returns the field's split policy, which indicates how field values should be handled during a split o...
Qgis::FieldDuplicatePolicy duplicatePolicy() const
Returns the field's duplicate policy, which indicates how field values should be handled during a dup...
QgsDefaultValue defaultValueDefinition
Qgis::FieldDomainMergePolicy mergePolicy() const
Returns the field's merge policy, which indicates how field values should be handled during a merge o...
QgsFieldConstraints constraints
Container of fields for a vector layer.
QgsField field(int fieldIdx) const
Returns the field at particular index (must be in range 0..N-1).
int size() const
Returns number of items.
QgsField at(int i) const
Returns the field at particular index (must be in range 0..N-1).
QIcon iconForField(int fieldIdx, bool considerOrigin=false) const
Returns an icon corresponding to a field index, based on the field's type and source.
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories.
static QgsGui * instance()
Returns a pointer to the singleton instance.
An expression with an additional enabled flag.
A relation where the referenced (parent) layer is calculated based on fields from the referencing (ch...
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsRelationManager * relationManager
static QgsProject * instance()
Returns the QgsProject singleton instance.
A container for the context for various read/write operations on objects.
Q_INVOKABLE QgsRelation relation(const QString &id) const
Gets access to a relation by its id.
Represents a relationship between two vector layers.
Represents a vector layer which manages a vector based dataset.
QgsEditFormConfig editFormConfig
#define QgsDebugError(str)
The TabStyle struct defines color and font overrides for form fields, tabs and groups labels.