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;
200 return mChildren.at(
row ).get();
207 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
211 const auto it = std::find_if( mChildren.cbegin(), mChildren.cend(), [itemType, itemId](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
212 return item->type() == itemType && item->id() == itemId;
215 if ( it != mChildren.cend() )
223 if ( !mChildren.empty() && itemId.trimmed().isEmpty() )
226 for (
const auto &
child : std::as_const( mChildren ) )
228 if (
child->type() == itemType &&
child->id() == itemId )
231 if (
child->childCount() > 0 )
244 return static_cast< int >( mChildren.size() );
252 const auto it = std::find_if( mParent->mChildren.cbegin(), mParent->mChildren.cend(), [
this](
const std::unique_ptr< QgsAttributesFormItem > &item ) {
253 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 )
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 )
464 ? createIndex( parentItem->
row(), 0, parentItem )
471 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
477 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
482 if ( !
index.isValid() )
486 bool result = item->
setData( role, value );
518 const QModelIndex childIndex =
index( i, 0,
parent );
519 if ( hasChildren( childIndex ) )
534 if ( !
index.isValid() )
535 return Qt::NoItemFlags;
537 Qt::ItemFlags
flags = Qt::ItemIsEnabled;
542 flags =
flags | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable;
551 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Available Widgets" ) : QVariant {};
567 for (
int i = 0; i < fields.
size(); ++i )
571 itemData.setShowLabel(
true );
575 auto item = std::make_unique< QgsAttributesFormItem >();
584 itemFields->addChild( std::move( item ) );
587 mRootItem->addChild( std::move( itemFields ) );
593 const QList<QgsRelation> relations =
mProject->relationManager()->referencedRelations(
mLayer );
599 if ( polymorphicRelation.
isValid() )
601 name = u
"%1 (%2)"_s.arg( relation.name(), polymorphicRelation.
name() );
605 name = relation.name();
610 auto itemRelation = std::make_unique< QgsAttributesFormItem >();
613 itemRelation->setData(
ItemIdRole, relation.id() );
616 itemRelations->addChild( std::move( itemRelation ) );
619 mRootItem->addChild( std::move( itemRelations ) );
624 mRootItem->addChild( std::move( itemActions ) );
625 populateActionItems(
mLayer->actions()->actions() );
635 itemOtherWidgets->addChild( std::move( itemQml ) );
641 itemOtherWidgets->addChild( std::move( itemHtml ) );
647 itemOtherWidgets->addChild( std::move( itemText ) );
653 itemOtherWidgets->addChild( std::move( itemSpacer ) );
655 mRootItem->addChild( std::move( itemOtherWidgets ) );
665 beginRemoveRows( actionsIndex, 0, itemActions->
childCount() );
670 for (
const auto &action : std::as_const( actions ) )
672 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
680 beginInsertRows( actionsIndex, 0, count - 1 );
681 populateActionItems( actions );
686void QgsAttributesAvailableWidgetsModel::populateActionItems(
const QList<QgsAction> actions )
691 for (
const auto &action : std::as_const( actions ) )
693 if ( action.isValid() && action.runable() && ( action.actionScopes().contains( u
"Feature"_s ) || action.actionScopes().contains( u
"Layer"_s ) ) )
695 const QString actionTitle { action.shortTitle().isEmpty() ? action.name() : action.shortTitle() };
697 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
700 auto itemAction = std::make_unique< QgsAttributesFormItem >();
701 itemAction->setData(
ItemIdRole, action.id().toString() );
707 itemActions->
addChild( std::move( itemAction ) );
714 if ( !
index.isValid() )
723 bool invalidRelation =
false;
731 case Qt::DisplayRole:
741 case Qt::ToolTipRole:
746 if ( !cfg.mAlias.isEmpty() )
747 return tr(
"%1 (%2)" ).arg( item->
name(), cfg.mAlias );
755 return tr(
"Invalid relation" );
761 case Qt::DecorationRole:
764 case Qt::BackgroundRole:
767 return QBrush( QColor( 140, 140, 140, 50 ) );
772 case Qt::ForegroundRole:
778 return QBrush( QColor( Qt::lightGray ) );
784 return QBrush( QColor( 255, 0, 0 ) );
796 QFont font = QFont();
797 font.setItalic(
true );
810 return item->
data( role );
819 return Qt::CopyAction;
824 return QStringList() << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
829 if ( indexes.count() == 0 )
833 if ( types.isEmpty() )
836 QMimeData *
data =
new QMimeData();
837 const QString format = types.at( 0 );
839 QDataStream stream( &encoded, QIODevice::WriteOnly );
842 QModelIndexList sortedIndexes = indexes;
844 std::sort( sortedIndexes.begin(), sortedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) {
845 return indexLessThan( a, b );
848 for (
const QModelIndex &
index : std::as_const( sortedIndexes ) )
850 if (
index.isValid() )
856 stream << itemId << itemType << itemName;
860 data->setData( format, encoded );
871 return createIndex( row, 0, item );
873 return QModelIndex();
883 return createIndex( row, 0, item );
885 return QModelIndex();
895 return createIndex( row, 0, item );
897 return QModelIndex();
903 return QModelIndex();
907 return QModelIndex();
910 return item ? createIndex( item->
row(), 0, item ) : QModelIndex();
922 return orientation == Qt::Horizontal && role == Qt::DisplayRole ? tr(
"Form Layout" ) : QVariant {};
927 if ( !
index.isValid() )
928 return Qt::ItemIsDropEnabled;
930 Qt::ItemFlags
flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
934 flags |= Qt::ItemIsDropEnabled;
947 const auto editorElements =
mLayer->editFormConfig().tabs();
950 loadAttributeEditorElementItem( editorElement,
mRootItem.get() );
965 auto editorItem = std::make_unique< QgsAttributesFormItem >();
967 switch ( editorElement->
type() )
971 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
972 setCommonProperties( itemData );
979 const int fieldIndex =
mLayer->fields().indexOf( editorElement->
name() );
980 if ( fieldIndex != -1 )
984 QgsAttributesFormData::FieldConfig config(
mLayer, fieldIndex );
986 editorItem->setIcon(
QgsGui::instance()->editorWidgetRegistry()->icon( config.mEditorWidgetType ) );
994 const QgsAttributeEditorAction *actionEditor =
static_cast<const QgsAttributeEditorAction *
>( editorElement );
995 const QgsAction action { actionEditor->
action(
mLayer ) };
998 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
999 setCommonProperties( itemData );
1001 editorItem->setData(
ItemIdRole, action.
id().toString() );
1016 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1017 setCommonProperties( itemData );
1019 const QgsAttributeEditorRelation *relationEditor =
static_cast<const QgsAttributeEditorRelation *
>( editorElement );
1020 QgsAttributesFormData::RelationEditorConfiguration relationEditorConfig;
1025 relationEditorConfig.
label = relationEditor->
label();
1028 QgsRelation relation = relationEditor->
relation();
1029 if ( relation.
id().isEmpty() )
1033 relation =
mProject->relationManager()->relation( editorElement->
name() );
1048 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1049 setCommonProperties( itemData );
1055 const QgsAttributeEditorContainer *container =
static_cast<const QgsAttributeEditorContainer *
>( editorElement );
1068 const QList<QgsAttributeEditorElement *> children = container->
children();
1069 for ( QgsAttributeEditorElement *childElement : children )
1071 loadAttributeEditorElementItem( childElement, editorItem.get() );
1078 const QgsAttributeEditorQmlElement *qmlElementEditor =
static_cast<const QgsAttributeEditorQmlElement *
>( editorElement );
1079 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1080 setCommonProperties( itemData );
1082 QgsAttributesFormData::QmlElementEditorConfiguration qmlEdConfig;
1095 const QgsAttributeEditorHtmlElement *htmlElementEditor =
static_cast<const QgsAttributeEditorHtmlElement *
>( editorElement );
1096 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1097 setCommonProperties( itemData );
1099 QgsAttributesFormData::HtmlElementEditorConfiguration htmlEdConfig;
1112 const QgsAttributeEditorTextElement *textElementEditor =
static_cast<const QgsAttributeEditorTextElement *
>( editorElement );
1113 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1114 setCommonProperties( itemData );
1116 QgsAttributesFormData::TextElementEditorConfiguration textEdConfig;
1117 textEdConfig.
text = textElementEditor->
text();
1129 const QgsAttributeEditorSpacerElement *spacerElementEditor =
static_cast<const QgsAttributeEditorSpacerElement *
>( editorElement );
1130 QgsAttributesFormData::AttributeFormItemData itemData = QgsAttributesFormData::AttributeFormItemData();
1131 setCommonProperties( itemData );
1134 QgsAttributesFormData::SpacerElementEditorConfiguration spacerEdConfig;
1147 QgsDebugError( u
"Not loading invalid attribute editor type..."_s );
1152 if ( position >= 0 && position < parent->childCount() )
1154 parent->insertChild( position, std::move( editorItem ) );
1158 parent->addChild( std::move( editorItem ) );
1164 if ( !
index.isValid() )
1177 const int fieldIndex =
mLayer->fields().indexOf( item->
name() );
1178 const bool invalidField = fieldIndex == -1;
1182 bool invalidRelation =
false;
1190 case Qt::DisplayRole:
1196 if ( item->
id().isEmpty() )
1198 return tr(
"Invalid relation" );
1204 return item->
name();
1210 case Qt::ToolTipRole:
1216 return tr(
"Invalid field" );
1220 return item->
name();
1226 if ( !item->
id().isEmpty() )
1229 return tr(
"Invalid relation" );
1236 case Qt::DecorationRole:
1237 return item->
icon();
1239 case Qt::BackgroundRole:
1242 return QBrush( QColor( 140, 140, 140, 50 ) );
1247 case Qt::ForegroundRole:
1253 return QBrush( QColor( 255, 0, 0 ) );
1257 return QBrush( QColor( Qt::lightGray ) );
1263 if ( invalidRelation )
1265 return QBrush( QColor( 255, 0, 0 ) );
1269 return QBrush( QColor( Qt::lightGray ) );
1282 QFont font = QFont();
1283 font.setItalic(
true );
1292 QFont font = QFont();
1293 font.setItalic(
true );
1306 return item->
data( role );
1323 beginRemoveRows(
parent, row, row + count - 1 );
1324 for (
int r = 0; r < count; ++r )
1332 beginRemoveRows(
parent, row, row );
1341 return Qt::MoveAction;
1346 return Qt::DropAction::CopyAction | Qt::DropAction::MoveAction;
1351 return QStringList() << u
"application/x-qgsattributesformlayoutelement"_s << u
"application/x-qgsattributesformavailablewidgetsrelement"_s;
1354QModelIndexList QgsAttributesFormLayoutModel::curateIndexesForMimeData(
const QModelIndexList &indexes )
const
1356 QModelIndexList containerList;
1357 for (
const auto index : indexes )
1362 containerList <<
index;
1366 if ( containerList.size() == 0 )
1369 QModelIndexList curatedIndexes;
1372 for (
const auto index : indexes )
1375 bool redundantChild =
false;
1377 while (
parent.isValid() )
1379 if ( containerList.contains(
parent ) )
1381 redundantChild =
true;
1388 if ( !redundantChild )
1389 curatedIndexes <<
index;
1392 return curatedIndexes;
1397 if ( indexes.count() == 0 )
1401 QModelIndexList curatedIndexes;
1402 if ( indexes.count() > 1 )
1404 curatedIndexes = curateIndexesForMimeData( indexes );
1408 curatedIndexes = indexes;
1412 if ( types.isEmpty() )
1415 QMimeData *
data =
new QMimeData();
1416 const QString format = types.at( 0 );
1418 QDataStream stream( &encoded, QIODevice::WriteOnly );
1421 std::sort( curatedIndexes.begin(), curatedIndexes.end(), [
this](
const QModelIndex &a,
const QModelIndex &b ) {
1422 return indexLessThan( a, b );
1425 for (
const QModelIndex &
index : std::as_const( curatedIndexes ) )
1427 if (
index.isValid() )
1431 QDomElement rootElem = doc.createElement( u
"form_layout_mime"_s );
1434 rootElem.appendChild( editorElem );
1436 doc.appendChild( rootElem );
1437 stream << doc.toString( -1 );
1441 data->setData( format, encoded );
1448 bool isDropSuccessful =
false;
1454 if ( action == Qt::IgnoreAction )
1456 isDropSuccessful =
true;
1458 else if (
data->hasFormat( u
"application/x-qgsattributesformavailablewidgetsrelement"_s ) )
1460 Q_ASSERT( action == Qt::CopyAction );
1461 QByteArray itemData =
data->data( u
"application/x-qgsattributesformavailablewidgetsrelement"_s );
1462 QDataStream stream( &itemData, QIODevice::ReadOnly );
1464 while ( !stream.atEnd() )
1469 stream >> itemId >> itemTypeInt >> itemName;
1474 isDropSuccessful =
true;
1476 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1482 else if (
data->hasFormat( u
"application/x-qgsattributesformlayoutelement"_s ) )
1484 Q_ASSERT( action == Qt::MoveAction );
1485 QByteArray itemData =
data->data( u
"application/x-qgsattributesformlayoutelement"_s );
1486 QDataStream stream( &itemData, QIODevice::ReadOnly );
1488 while ( !stream.atEnd() )
1494 if ( !doc.setContent( text ) )
1496 const QDomElement rootElem = doc.documentElement();
1497 if ( rootElem.tagName() !=
"form_layout_mime"_L1 || !rootElem.hasChildNodes() )
1499 const QDomElement childElem = rootElem.firstChild().toElement();
1503 beginInsertRows(
parent, row + rows, row + rows );
1507 isDropSuccessful =
true;
1509 QModelIndex addedIndex =
index( row + rows, 0,
parent );
1516 return isDropSuccessful;
1521 for (
int i = 0; i <
parent->childCount(); i++ )
1533 updateFieldConfigForFieldItemsRecursive( child, fieldName, config );
1540 updateFieldConfigForFieldItemsRecursive(
mRootItem.get(), fieldName, config );
1543void QgsAttributesFormLayoutModel::updateAliasForFieldItemsRecursive(
QgsAttributesFormItem *parent,
const QString &fieldName,
const QString &fieldAlias )
1545 for (
int i = 0; i <
parent->childCount(); i++ )
1551 const QModelIndex
index = createIndex( child->
row(), 0, child );
1557 updateAliasForFieldItemsRecursive( child, fieldName, fieldAlias );
1564 updateAliasForFieldItemsRecursive(
mRootItem.get(), fieldName, fieldAlias );
1567QList< QgsAddAttributeFormContainerDialog::ContainerPair > QgsAttributesFormLayoutModel::recursiveListOfContainers(
QgsAttributesFormItem *parent )
const
1569 QList< QgsAddAttributeFormContainerDialog::ContainerPair > containerList;
1570 for (
int i = 0; i <
parent->childCount(); i++ )
1580 containerList.append( recursiveListOfContainers( child ) );
1584 return containerList;
1596 switch ( indexType )
1600 const int fieldIndex =
mLayer->fields().lookupField( indexName );
1633 bool isTopLevel = !
index.parent().isValid();
1645 QModelIndex childIndex;
1653 widgetDef = container;
1661 widgetDef = element;
1669 widgetDef = element;
1677 widgetDef = element;
1685 widgetDef = element;
1707 return recursiveListOfContainers(
mRootItem.get() );
1724 parentItem->
addChild( std::move( containerItem ) );
1734 beginInsertRows(
parent, row, row );
1735 auto item = std::make_unique< QgsAttributesFormItem >();
1747 : QSortFilterProxyModel( parent )
1754 QSortFilterProxyModel::setSourceModel( mModel );
1779 if ( mFilterText.isEmpty() )
1782 QModelIndex sourceIndex = sourceModel()->index( sourceRow, 0, sourceParent );
1783 if ( !sourceIndex.isValid() )
1791 QModelIndex parent = sourceIndex.
parent();
1792 while ( parent.isValid() )
1797 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.