34#include "moc_qgsattributesformmodel.cpp"
36using namespace Qt::StringLiterals;
40 if ( !layer || idx < 0 || idx >= layer->
fields().
count() )
61QgsAttributesFormData::FieldConfig::operator QVariant()
63 return QVariant::fromValue<QgsAttributesFormData::FieldConfig>( *
this );
66QgsAttributesFormData::RelationEditorConfiguration::operator QVariant()
68 return QVariant::fromValue<QgsAttributesFormData::RelationEditorConfiguration>( *
this );
73 return mContainerType;
78 mContainerType = type;
103 return mVisibilityExpression;
113 return mCollapsedExpression;
123 return mRelationEditorConfiguration;
133 return mQmlElementEditorConfiguration;
144 return mHtmlElementEditorConfiguration;
154 return mSpacerElementEditorConfiguration;
164 return mBackgroundColor;
174 return mTextElementEditorConfiguration;
203 return mChildren.at(
row ).get();
210 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
214 const auto it = std::find_if( mChildren.cbegin(), mChildren.cend(), [itemType, itemId](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
215 return item->type() == itemType && item->id() == itemId;
218 if ( it != mChildren.cend() )
226 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
229 for (
const auto &
child : std::as_const( mChildren ) )
231 if (
child->type() == itemType &&
child->id() == itemId )
234 if (
child->childCount() > 0 )
247 return static_cast< int >( mChildren.size() );
255 const auto it = std::find_if( mParent->mChildren.cbegin(), mParent->mChildren.cend(), [
this](
const std::unique_ptr< QgsAttributesFormItem > &item ) { return item.get() == this; } );
257 if ( it != mParent->mChildren.cend() )
259 return static_cast< int >( std::distance( mParent->mChildren.cbegin(), it ) );
270 if ( !item->mParent )
271 item->mParent =
this;
276 mChildren.push_back( std::move( item ) );
278 emit
addedChildren(
this, mChildren.size() - 1, mChildren.size() - 1 );
283 if ( position < 0 || position >
static_cast< int >( mChildren.size() ) || !item )
286 if ( !item->mParent )
287 item->mParent =
this;
292 mChildren.insert( mChildren.begin() + position, std::move( item ) );
299 if ( index >= 0 && index <
static_cast< int >( mChildren.size() ) )
300 mChildren.erase( mChildren.begin() + index );
320 return QVariant::fromValue( mData );
328 return QVariant::fromValue( mFieldConfigData );
345 mName = value.toString();
350 mDisplayName = value.toString();
360 mId = value.toString();
375 : QAbstractItemModel(
parent )
385 if (
index.isValid() )
406 return parentItem ? parentItem->
childCount() : 0;
419 for (
int i = 0; i < std::min( pathA.size(), pathB.size() ); i++ )
421 if ( pathA.at( i ) != pathB.at( i ) )
423 return pathA.at( i ) < pathB.at( i );
427 return pathA.size() < pathB.size();
442 if ( !hasIndex( row, column,
parent ) )
443 return QModelIndex();
447 return QModelIndex();
450 return createIndex( row, column, childItem );
452 return QModelIndex();
457 if ( !
index.isValid() )
458 return QModelIndex();
463 return ( parentItem !=
mRootItem.get() && parentItem !=
nullptr ) ? createIndex( parentItem->
row(), 0, parentItem ) : QModelIndex();
469 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
475 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
480 if ( !
index.isValid() )
484 bool result = item->
setData( role, value );
516 const QModelIndex childIndex =
index( i, 0,
parent );
517 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 = u
"%1 (%2)"_s.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 ) );
638 itemOtherWidgets->addChild( std::move( itemHtml ) );
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( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
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( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
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() << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
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 ) { return indexLessThan( a, b ); } );
843 for (
const QModelIndex &
index : std::as_const( sortedIndexes ) )
845 if (
index.isValid() )
851 stream << itemId << itemType << itemName;
855 data->setData( format, encoded );
866 return createIndex( row, 0, item );
868 return QModelIndex();
878 return createIndex( row, 0, item );
880 return QModelIndex();
890 return createIndex( row, 0, item );
892 return QModelIndex();
898 return QModelIndex();
902 return QModelIndex();
905 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
916 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Form Layout" ) : QVariant {};
921 if ( !
index.isValid() )
922 return Qt::ItemIsDropEnabled;
924 Qt::ItemFlags
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
928 flags |= Qt::ItemIsDropEnabled;
941 const auto editorElements =
mLayer->editFormConfig().tabs();
944 loadAttributeEditorElementItem( editorElement,
mRootItem.get() );
959 auto editorItem = std::make_unique< QgsAttributesFormItem >();
961 switch ( editorElement->
type() )
965 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
966 setCommonProperties( itemData );
973 const int fieldIndex =
mLayer->fields().indexOf( editorElement->
name() );
974 if ( fieldIndex != -1 )
978 QgsAttributesFormData::FieldConfig config(
mLayer, fieldIndex );
980 editorItem->setIcon(
QgsGui::instance()->editorWidgetRegistry()->icon( config.mEditorWidgetType ) );
988 const QgsAttributeEditorAction *actionEditor =
static_cast<const QgsAttributeEditorAction *
>( editorElement );
989 const QgsAction action { actionEditor->
action(
mLayer ) };
992 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
993 setCommonProperties( itemData );
995 editorItem->setData(
ItemIdRole, action.
id().toString() );
1010 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1011 setCommonProperties( itemData );
1013 const QgsAttributeEditorRelation *relationEditor =
static_cast<const QgsAttributeEditorRelation *
>( editorElement );
1014 QgsAttributesFormData::RelationEditorConfiguration relationEditorConfig;
1019 relationEditorConfig.
label = relationEditor->
label();
1022 QgsRelation relation = relationEditor->
relation();
1023 if ( relation.
id().isEmpty() )
1027 relation =
mProject->relationManager()->relation( editorElement->
name() );
1042 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1043 setCommonProperties( itemData );
1049 const QgsAttributeEditorContainer *container =
static_cast<const QgsAttributeEditorContainer *
>( editorElement );
1062 const QList<QgsAttributeEditorElement *> children = container->
children();
1063 for ( QgsAttributeEditorElement *childElement : children )
1065 loadAttributeEditorElementItem( childElement, editorItem.get() );
1072 const QgsAttributeEditorQmlElement *qmlElementEditor =
static_cast<const QgsAttributeEditorQmlElement *
>( editorElement );
1073 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1074 setCommonProperties( itemData );
1076 QgsAttributesFormData::QmlElementEditorConfiguration qmlEdConfig;
1089 const QgsAttributeEditorHtmlElement *htmlElementEditor =
static_cast<const QgsAttributeEditorHtmlElement *
>( editorElement );
1090 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1091 setCommonProperties( itemData );
1093 QgsAttributesFormData::HtmlElementEditorConfiguration htmlEdConfig;
1106 const QgsAttributeEditorTextElement *textElementEditor =
static_cast<const QgsAttributeEditorTextElement *
>( editorElement );
1107 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1108 setCommonProperties( itemData );
1110 QgsAttributesFormData::TextElementEditorConfiguration textEdConfig;
1111 textEdConfig.
text = textElementEditor->
text();
1123 const QgsAttributeEditorSpacerElement *spacerElementEditor =
static_cast<const QgsAttributeEditorSpacerElement *
>( editorElement );
1124 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1125 setCommonProperties( itemData );
1128 QgsAttributesFormData::SpacerElementEditorConfiguration spacerEdConfig;
1141 QgsDebugError( u
"Not loading invalid attribute editor type..."_s );
1146 if ( position >= 0 && position < parent->childCount() )
1148 parent->insertChild( position, std::move( editorItem ) );
1152 parent->addChild( std::move( editorItem ) );
1158 if ( !
index.isValid() )
1171 const int fieldIndex =
mLayer->fields().indexOf( item->
name() );
1172 const bool invalidField = fieldIndex == -1;
1176 bool invalidRelation =
false;
1184 case Qt::DisplayRole:
1190 if ( item->
id().isEmpty() )
1192 return tr(
"Invalid relation" );
1198 return item->
name();
1204 case Qt::ToolTipRole:
1210 return tr(
"Invalid field" );
1214 return item->
name();
1220 if ( !item->
id().isEmpty() )
1223 return tr(
"Invalid relation" );
1230 case Qt::DecorationRole:
1231 return item->
icon();
1233 case Qt::BackgroundRole:
1236 return QBrush( QColor( 140, 140, 140, 50 ) );
1241 case Qt::ForegroundRole:
1247 return QBrush( QColor( 255, 0, 0 ) );
1251 return QBrush( QColor( Qt::lightGray ) );
1257 if ( invalidRelation )
1259 return QBrush( QColor( 255, 0, 0 ) );
1263 return QBrush( QColor( Qt::lightGray ) );
1276 QFont font = QFont();
1277 font.setItalic(
true );
1286 QFont font = QFont();
1287 font.setItalic(
true );
1300 return item->
data( role );
1317 beginRemoveRows(
parent, row, row + count - 1 );
1318 for (
int r = 0; r < count; ++r )
1326 beginRemoveRows(
parent, row, row );
1335 return Qt::MoveAction;
1340 return Qt::DropAction::CopyAction | Qt::DropAction::MoveAction;
1345 return QStringList() << u
"application/x-qgsattributesformlayoutelement"_s << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
1348QModelIndexList QgsAttributesFormLayoutModel::curateIndexesForMimeData(
const QModelIndexList &indexes )
const
1350 QModelIndexList containerList;
1351 for (
const auto index : indexes )
1356 containerList <<
index;
1360 if ( containerList.size() == 0 )
1363 QModelIndexList curatedIndexes;
1366 for (
const auto index : indexes )
1369 bool redundantChild =
false;
1371 while (
parent.isValid() )
1373 if ( containerList.contains(
parent ) )
1375 redundantChild =
true;
1382 if ( !redundantChild )
1383 curatedIndexes <<
index;
1386 return curatedIndexes;
1391 if ( indexes.count() == 0 )
1395 QModelIndexList curatedIndexes;
1396 if ( indexes.count() > 1 )
1398 curatedIndexes = curateIndexesForMimeData( indexes );
1402 curatedIndexes = indexes;
1406 if ( types.isEmpty() )
1409 QMimeData *
data =
new QMimeData();
1410 const QString format = types.at( 0 );
1412 QDataStream stream( &encoded, QIODevice::WriteOnly );
1415 std::sort( curatedIndexes.begin(), curatedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) { return indexLessThan( a, b ); } );
1417 for (
const QModelIndex &
index : std::as_const( curatedIndexes ) )
1419 if (
index.isValid() )
1423 QDomElement rootElem = doc.createElement( u
"form_layout_mime"_s );
1426 rootElem.appendChild( editorElem );
1428 doc.appendChild( rootElem );
1429 stream << doc.toString( -1 );
1433 data->setData( format, encoded );
1440 bool isDropSuccessful =
false;
1446 if ( action == Qt::IgnoreAction )
1448 isDropSuccessful =
true;
1450 else if (
data->hasFormat( u
"application/x-qgsattributesformavailablewidgetsrelement"_s ) )
1452 Q_ASSERT( action == Qt::CopyAction );
1453 QByteArray itemData =
data->data( u
"application/x-qgsattributesformavailablewidgetsrelement"_s );
1454 QDataStream stream( &itemData, QIODevice::ReadOnly );
1456 while ( !stream.atEnd() )
1461 stream >> itemId >> itemTypeInt >> itemName;
1466 isDropSuccessful =
true;
1468 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1474 else if (
data->hasFormat( u
"application/x-qgsattributesformlayoutelement"_s ) )
1476 Q_ASSERT( action == Qt::MoveAction );
1477 QByteArray itemData =
data->data( u
"application/x-qgsattributesformlayoutelement"_s );
1478 QDataStream stream( &itemData, QIODevice::ReadOnly );
1480 while ( !stream.atEnd() )
1486 if ( !doc.setContent( text ) )
1488 const QDomElement rootElem = doc.documentElement();
1489 if ( rootElem.tagName() !=
"form_layout_mime"_L1 || !rootElem.hasChildNodes() )
1491 const QDomElement childElem = rootElem.firstChild().toElement();
1495 beginInsertRows(
parent, row + rows, row + rows );
1499 isDropSuccessful =
true;
1501 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1508 return isDropSuccessful;
1513 for (
int i = 0; i <
parent->childCount(); i++ )
1525 updateFieldConfigForFieldItemsRecursive( child, fieldName, config );
1532 updateFieldConfigForFieldItemsRecursive(
mRootItem.get(), fieldName, config );
1535void QgsAttributesFormLayoutModel::updateAliasForFieldItemsRecursive(
QgsAttributesFormItem *parent,
const QString &fieldName,
const QString &fieldAlias )
1537 for (
int i = 0; i <
parent->childCount(); i++ )
1543 const QModelIndex
index = createIndex( child->
row(), 0, child );
1549 updateAliasForFieldItemsRecursive( child, fieldName, fieldAlias );
1556 updateAliasForFieldItemsRecursive(
mRootItem.get(), fieldName, fieldAlias );
1559QList< QgsAddAttributeFormContainerDialog::ContainerPair > QgsAttributesFormLayoutModel::recursiveListOfContainers(
QgsAttributesFormItem *parent )
const
1561 QList< QgsAddAttributeFormContainerDialog::ContainerPair > containerList;
1562 for (
int i = 0; i <
parent->childCount(); i++ )
1572 containerList.append( recursiveListOfContainers( child ) );
1576 return containerList;
1588 switch ( indexType )
1592 const int fieldIndex =
mLayer->fields().lookupField( indexName );
1625 bool isTopLevel = !
index.parent().isValid();
1637 QModelIndex childIndex;
1645 widgetDef = container;
1653 widgetDef = element;
1661 widgetDef = element;
1669 widgetDef = element;
1677 widgetDef = element;
1699 return recursiveListOfContainers(
mRootItem.get() );
1716 parentItem->
addChild( std::move( containerItem ) );
1726 beginInsertRows(
parent, row, row );
1727 auto item = std::make_unique< QgsAttributesFormItem >();
1739 : QSortFilterProxyModel( parent )
1745 QSortFilterProxyModel::setSourceModel( mModel );
1770 if ( mFilterText.isEmpty() )
1773 QModelIndex sourceIndex = sourceModel()->index( sourceRow, 0, sourceParent );
1774 if ( !sourceIndex.isValid() )
1783 QModelIndex parent = sourceIndex.
parent();
1784 while ( parent.isValid() )
1790 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.