34#include "moc_qgsattributesformmodel.cpp"
36using namespace Qt::StringLiterals;
40 if ( !layer || idx < 0 || idx >= layer->
fields().
count() )
60QgsAttributesFormData::FieldConfig::operator QVariant()
62 return QVariant::fromValue<QgsAttributesFormData::FieldConfig>( *
this );
65QgsAttributesFormData::RelationEditorConfiguration::operator QVariant()
67 return QVariant::fromValue<QgsAttributesFormData::RelationEditorConfiguration>( *
this );
72 return mContainerType;
77 mContainerType = type;
102 return mVisibilityExpression;
112 return mCollapsedExpression;
122 return mRelationEditorConfiguration;
132 return mQmlElementEditorConfiguration;
143 return mHtmlElementEditorConfiguration;
153 return mSpacerElementEditorConfiguration;
163 return mBackgroundColor;
173 return mTextElementEditorConfiguration;
202 return mChildren.at(
row ).get();
209 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
213 const auto it = std::find_if( mChildren.cbegin(), mChildren.cend(), [itemType, itemId](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
214 return item->type() == itemType && item->id() == itemId;
217 if ( it != mChildren.cend() )
225 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
228 for (
const auto &
child : std::as_const( mChildren ) )
230 if (
child->type() == itemType &&
child->id() == itemId )
233 if (
child->childCount() > 0 )
246 return static_cast< int >( mChildren.size() );
254 const auto it = std::find_if( mParent->mChildren.cbegin(), mParent->mChildren.cend(), [
this](
const std::unique_ptr< QgsAttributesFormItem > &item ) { return item.get() == this; } );
256 if ( it != mParent->mChildren.cend() )
258 return static_cast< int >( std::distance( mParent->mChildren.cbegin(), it ) );
269 if ( !item->mParent )
270 item->mParent =
this;
275 mChildren.push_back( std::move( item ) );
277 emit
addedChildren(
this, mChildren.size() - 1, mChildren.size() - 1 );
282 if ( position < 0 || position >
static_cast< int >( mChildren.size() ) || !item )
285 if ( !item->mParent )
286 item->mParent =
this;
291 mChildren.insert( mChildren.begin() + position, std::move( item ) );
298 if ( index >= 0 && index <
static_cast< int >( mChildren.size() ) )
299 mChildren.erase( mChildren.begin() + index );
319 return QVariant::fromValue( mData );
327 return QVariant::fromValue( mFieldConfigData );
344 mName = value.toString();
349 mDisplayName = value.toString();
359 mId = value.toString();
374 : QAbstractItemModel(
parent )
384 if (
index.isValid() )
405 return parentItem ? parentItem->
childCount() : 0;
418 for (
int i = 0; i < std::min( pathA.size(), pathB.size() ); i++ )
420 if ( pathA.at( i ) != pathB.at( i ) )
422 return pathA.at( i ) < pathB.at( i );
426 return pathA.size() < pathB.size();
441 if ( !hasIndex( row, column,
parent ) )
442 return QModelIndex();
446 return QModelIndex();
449 return createIndex( row, column, childItem );
451 return QModelIndex();
456 if ( !
index.isValid() )
457 return QModelIndex();
462 return ( parentItem !=
mRootItem.get() && parentItem !=
nullptr ) ? createIndex( parentItem->
row(), 0, parentItem ) : QModelIndex();
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 ) )
530 if ( !
index.isValid() )
531 return Qt::NoItemFlags;
533 Qt::ItemFlags
flags = Qt::ItemIsEnabled;
538 flags =
flags | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable;
547 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Available Widgets" ) : QVariant {};
563 for (
int i = 0; i < fields.
size(); ++i )
567 itemData.setShowLabel(
true );
571 auto item = std::make_unique< QgsAttributesFormItem >();
580 itemFields->addChild( std::move( item ) );
583 mRootItem->addChild( std::move( itemFields ) );
589 const QList<QgsRelation> relations =
mProject->relationManager()->referencedRelations(
mLayer );
595 if ( polymorphicRelation.
isValid() )
597 name = u
"%1 (%2)"_s.arg( relation.name(), polymorphicRelation.
name() );
601 name = relation.name();
606 auto itemRelation = std::make_unique< QgsAttributesFormItem >();
609 itemRelation->setData(
ItemIdRole, relation.id() );
612 itemRelations->addChild( std::move( itemRelation ) );
615 mRootItem->addChild( std::move( itemRelations ) );
620 mRootItem->addChild( std::move( itemActions ) );
621 populateActionItems(
mLayer->actions()->actions() );
631 itemOtherWidgets->addChild( std::move( itemQml ) );
637 itemOtherWidgets->addChild( std::move( itemHtml ) );
643 itemOtherWidgets->addChild( std::move( itemText ) );
649 itemOtherWidgets->addChild( std::move( itemSpacer ) );
651 mRootItem->addChild( std::move( itemOtherWidgets ) );
661 beginRemoveRows( actionsIndex, 0, itemActions->
childCount() );
666 for (
const auto &action : std::as_const( actions ) )
668 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
676 beginInsertRows( actionsIndex, 0, count - 1 );
677 populateActionItems( actions );
682void QgsAttributesAvailableWidgetsModel::populateActionItems(
const QList<QgsAction> actions )
687 for (
const auto &action : std::as_const( actions ) )
689 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
691 const QString actionTitle { action.shortTitle().isEmpty() ? action.name() : action.shortTitle() };
693 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
696 auto itemAction = std::make_unique< QgsAttributesFormItem >();
697 itemAction->setData(
ItemIdRole, action.id().toString() );
703 itemActions->
addChild( std::move( itemAction ) );
710 if ( !
index.isValid() )
719 bool invalidRelation =
false;
727 case Qt::DisplayRole:
737 case Qt::ToolTipRole:
742 if ( !cfg.mAlias.isEmpty() )
743 return tr(
"%1 (%2)" ).arg( item->
name(), cfg.mAlias );
751 return tr(
"Invalid relation" );
757 case Qt::DecorationRole:
760 case Qt::BackgroundRole:
763 return QBrush( QColor( 140, 140, 140, 50 ) );
768 case Qt::ForegroundRole:
774 return QBrush( QColor( Qt::lightGray ) );
780 return QBrush( QColor( 255, 0, 0 ) );
792 QFont font = QFont();
793 font.setItalic(
true );
806 return item->
data( role );
815 return Qt::CopyAction;
820 return QStringList() << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
825 if ( indexes.count() == 0 )
829 if ( types.isEmpty() )
832 QMimeData *
data =
new QMimeData();
833 const QString format = types.at( 0 );
835 QDataStream stream( &encoded, QIODevice::WriteOnly );
838 QModelIndexList sortedIndexes = indexes;
840 std::sort( sortedIndexes.begin(), sortedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) { return indexLessThan( a, b ); } );
842 for (
const QModelIndex &
index : std::as_const( sortedIndexes ) )
844 if (
index.isValid() )
850 stream << itemId << itemType << itemName;
854 data->setData( format, encoded );
865 return createIndex( row, 0, item );
867 return QModelIndex();
877 return createIndex( row, 0, item );
879 return QModelIndex();
889 return createIndex( row, 0, item );
891 return QModelIndex();
897 return QModelIndex();
901 return QModelIndex();
904 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
915 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Form Layout" ) : QVariant {};
920 if ( !
index.isValid() )
921 return Qt::ItemIsDropEnabled;
923 Qt::ItemFlags
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
927 flags |= Qt::ItemIsDropEnabled;
940 const auto editorElements =
mLayer->editFormConfig().tabs();
943 loadAttributeEditorElementItem( editorElement,
mRootItem.get() );
958 auto editorItem = std::make_unique< QgsAttributesFormItem >();
960 switch ( editorElement->
type() )
964 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
965 setCommonProperties( itemData );
972 const int fieldIndex =
mLayer->fields().indexOf( editorElement->
name() );
973 if ( fieldIndex != -1 )
977 QgsAttributesFormData::FieldConfig config(
mLayer, fieldIndex );
979 editorItem->setIcon(
QgsGui::instance()->editorWidgetRegistry()->icon( config.mEditorWidgetType ) );
987 const QgsAttributeEditorAction *actionEditor =
static_cast<const QgsAttributeEditorAction *
>( editorElement );
988 const QgsAction action { actionEditor->
action(
mLayer ) };
991 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
992 setCommonProperties( itemData );
994 editorItem->setData(
ItemIdRole, action.
id().toString() );
1009 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1010 setCommonProperties( itemData );
1012 const QgsAttributeEditorRelation *relationEditor =
static_cast<const QgsAttributeEditorRelation *
>( editorElement );
1013 QgsAttributesFormData::RelationEditorConfiguration relationEditorConfig;
1018 relationEditorConfig.
label = relationEditor->
label();
1021 QgsRelation relation = relationEditor->
relation();
1022 if ( relation.
id().isEmpty() )
1026 relation =
mProject->relationManager()->relation( editorElement->
name() );
1041 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1042 setCommonProperties( itemData );
1048 const QgsAttributeEditorContainer *container =
static_cast<const QgsAttributeEditorContainer *
>( editorElement );
1061 const QList<QgsAttributeEditorElement *> children = container->
children();
1062 for ( QgsAttributeEditorElement *childElement : children )
1064 loadAttributeEditorElementItem( childElement, editorItem.get() );
1071 const QgsAttributeEditorQmlElement *qmlElementEditor =
static_cast<const QgsAttributeEditorQmlElement *
>( editorElement );
1072 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1073 setCommonProperties( itemData );
1075 QgsAttributesFormData::QmlElementEditorConfiguration qmlEdConfig;
1088 const QgsAttributeEditorHtmlElement *htmlElementEditor =
static_cast<const QgsAttributeEditorHtmlElement *
>( editorElement );
1089 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1090 setCommonProperties( itemData );
1092 QgsAttributesFormData::HtmlElementEditorConfiguration htmlEdConfig;
1105 const QgsAttributeEditorTextElement *textElementEditor =
static_cast<const QgsAttributeEditorTextElement *
>( editorElement );
1106 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1107 setCommonProperties( itemData );
1109 QgsAttributesFormData::TextElementEditorConfiguration textEdConfig;
1110 textEdConfig.
text = textElementEditor->
text();
1122 const QgsAttributeEditorSpacerElement *spacerElementEditor =
static_cast<const QgsAttributeEditorSpacerElement *
>( editorElement );
1123 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1124 setCommonProperties( itemData );
1127 QgsAttributesFormData::SpacerElementEditorConfiguration spacerEdConfig;
1140 QgsDebugError( u
"Not loading invalid attribute editor type..."_s );
1145 if ( position >= 0 && position < parent->childCount() )
1147 parent->insertChild( position, std::move( editorItem ) );
1151 parent->addChild( std::move( editorItem ) );
1157 if ( !
index.isValid() )
1170 const int fieldIndex =
mLayer->fields().indexOf( item->
name() );
1171 const bool invalidField = fieldIndex == -1;
1175 bool invalidRelation =
false;
1183 case Qt::DisplayRole:
1189 if ( item->
id().isEmpty() )
1191 return tr(
"Invalid relation" );
1197 return item->
name();
1203 case Qt::ToolTipRole:
1209 return tr(
"Invalid field" );
1213 return item->
name();
1219 if ( !item->
id().isEmpty() )
1222 return tr(
"Invalid relation" );
1229 case Qt::DecorationRole:
1230 return item->
icon();
1232 case Qt::BackgroundRole:
1235 return QBrush( QColor( 140, 140, 140, 50 ) );
1240 case Qt::ForegroundRole:
1246 return QBrush( QColor( 255, 0, 0 ) );
1250 return QBrush( QColor( Qt::lightGray ) );
1256 if ( invalidRelation )
1258 return QBrush( QColor( 255, 0, 0 ) );
1262 return QBrush( QColor( Qt::lightGray ) );
1275 QFont font = QFont();
1276 font.setItalic(
true );
1285 QFont font = QFont();
1286 font.setItalic(
true );
1299 return item->
data( role );
1316 beginRemoveRows(
parent, row, row + count - 1 );
1317 for (
int r = 0; r < count; ++r )
1325 beginRemoveRows(
parent, row, row );
1334 return Qt::MoveAction;
1339 return Qt::DropAction::CopyAction | Qt::DropAction::MoveAction;
1344 return QStringList() << u
"application/x-qgsattributesformlayoutelement"_s << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
1347QModelIndexList QgsAttributesFormLayoutModel::curateIndexesForMimeData(
const QModelIndexList &indexes )
const
1349 QModelIndexList containerList;
1350 for (
const auto index : indexes )
1355 containerList <<
index;
1359 if ( containerList.size() == 0 )
1362 QModelIndexList curatedIndexes;
1365 for (
const auto index : indexes )
1368 bool redundantChild =
false;
1370 while (
parent.isValid() )
1372 if ( containerList.contains(
parent ) )
1374 redundantChild =
true;
1381 if ( !redundantChild )
1382 curatedIndexes <<
index;
1385 return curatedIndexes;
1390 if ( indexes.count() == 0 )
1394 QModelIndexList curatedIndexes;
1395 if ( indexes.count() > 1 )
1397 curatedIndexes = curateIndexesForMimeData( indexes );
1401 curatedIndexes = indexes;
1405 if ( types.isEmpty() )
1408 QMimeData *
data =
new QMimeData();
1409 const QString format = types.at( 0 );
1411 QDataStream stream( &encoded, QIODevice::WriteOnly );
1414 std::sort( curatedIndexes.begin(), curatedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) { return indexLessThan( a, b ); } );
1416 for (
const QModelIndex &
index : std::as_const( curatedIndexes ) )
1418 if (
index.isValid() )
1422 QDomElement rootElem = doc.createElement( u
"form_layout_mime"_s );
1425 rootElem.appendChild( editorElem );
1427 doc.appendChild( rootElem );
1428 stream << doc.toString( -1 );
1432 data->setData( format, encoded );
1439 bool isDropSuccessful =
false;
1445 if ( action == Qt::IgnoreAction )
1447 isDropSuccessful =
true;
1449 else if (
data->hasFormat( u
"application/x-qgsattributesformavailablewidgetsrelement"_s ) )
1451 Q_ASSERT( action == Qt::CopyAction );
1452 QByteArray itemData =
data->data( u
"application/x-qgsattributesformavailablewidgetsrelement"_s );
1453 QDataStream stream( &itemData, QIODevice::ReadOnly );
1455 while ( !stream.atEnd() )
1460 stream >> itemId >> itemTypeInt >> itemName;
1465 isDropSuccessful =
true;
1467 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1473 else if (
data->hasFormat( u
"application/x-qgsattributesformlayoutelement"_s ) )
1475 Q_ASSERT( action == Qt::MoveAction );
1476 QByteArray itemData =
data->data( u
"application/x-qgsattributesformlayoutelement"_s );
1477 QDataStream stream( &itemData, QIODevice::ReadOnly );
1479 while ( !stream.atEnd() )
1485 if ( !doc.setContent( text ) )
1487 const QDomElement rootElem = doc.documentElement();
1488 if ( rootElem.tagName() !=
"form_layout_mime"_L1 || !rootElem.hasChildNodes() )
1490 const QDomElement childElem = rootElem.firstChild().toElement();
1494 beginInsertRows(
parent, row + rows, row + rows );
1498 isDropSuccessful =
true;
1500 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1507 return isDropSuccessful;
1512 for (
int i = 0; i <
parent->childCount(); i++ )
1524 updateFieldConfigForFieldItemsRecursive( child, fieldName, config );
1531 updateFieldConfigForFieldItemsRecursive(
mRootItem.get(), fieldName, config );
1534void QgsAttributesFormLayoutModel::updateAliasForFieldItemsRecursive(
QgsAttributesFormItem *parent,
const QString &fieldName,
const QString &fieldAlias )
1536 for (
int i = 0; i <
parent->childCount(); i++ )
1542 const QModelIndex
index = createIndex( child->
row(), 0, child );
1548 updateAliasForFieldItemsRecursive( child, fieldName, fieldAlias );
1555 updateAliasForFieldItemsRecursive(
mRootItem.get(), fieldName, fieldAlias );
1558QList< QgsAddAttributeFormContainerDialog::ContainerPair > QgsAttributesFormLayoutModel::recursiveListOfContainers(
QgsAttributesFormItem *parent )
const
1560 QList< QgsAddAttributeFormContainerDialog::ContainerPair > containerList;
1561 for (
int i = 0; i <
parent->childCount(); i++ )
1571 containerList.append( recursiveListOfContainers( child ) );
1575 return containerList;
1587 switch ( indexType )
1591 const int fieldIndex =
mLayer->fields().lookupField( indexName );
1624 bool isTopLevel = !
index.parent().isValid();
1636 QModelIndex childIndex;
1644 widgetDef = container;
1652 widgetDef = element;
1660 widgetDef = element;
1668 widgetDef = element;
1676 widgetDef = element;
1698 return recursiveListOfContainers(
mRootItem.get() );
1715 parentItem->
addChild( std::move( containerItem ) );
1725 beginInsertRows(
parent, row, row );
1726 auto item = std::make_unique< QgsAttributesFormItem >();
1738 : QSortFilterProxyModel( parent )
1744 QSortFilterProxyModel::setSourceModel( mModel );
1769 if ( mFilterText.isEmpty() )
1772 QModelIndex sourceIndex = sourceModel()->index( sourceRow, 0, sourceParent );
1773 if ( !sourceIndex.isValid() )
1782 QModelIndex parent = sourceIndex.
parent();
1783 while ( parent.isValid() )
1789 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.