|
| 1 | +/************************************************************************ |
| 2 | + * This file has been generated automatically from * |
| 3 | + * * |
| 4 | + * src/core/layout/qgslayoutitemattributetable.h * |
| 5 | + * * |
| 6 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 7 | + ************************************************************************/ |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +class QgsLayoutItemAttributeTable: QgsLayoutTable |
| 14 | +{ |
| 15 | +%Docstring |
| 16 | + A layout table subclass that displays attributes from a vector layer. |
| 17 | +.. versionadded:: 3.0 |
| 18 | +%End |
| 19 | + |
| 20 | +%TypeHeaderCode |
| 21 | +#include "qgslayoutitemattributetable.h" |
| 22 | +%End |
| 23 | + public: |
| 24 | + |
| 25 | + enum ContentSource |
| 26 | + { |
| 27 | + LayerAttributes, |
| 28 | + AtlasFeature, |
| 29 | + RelationChildren |
| 30 | + }; |
| 31 | + |
| 32 | + QgsLayoutItemAttributeTable( QgsLayout *layout ); |
| 33 | +%Docstring |
| 34 | + Constructor for QgsLayoutItemAttributeTable, attached to the specified ``layout``. |
| 35 | +%End |
| 36 | + |
| 37 | + virtual int type() const; |
| 38 | + |
| 39 | + virtual QString stringType() const; |
| 40 | + |
| 41 | + virtual QString displayName() const; |
| 42 | + |
| 43 | + |
| 44 | + static QgsLayoutItemAttributeTable *create( QgsLayout *layout ) /Factory/; |
| 45 | +%Docstring |
| 46 | + Returns a new QgsLayoutItemAttributeTable for the specified parent ``layout``. |
| 47 | + :rtype: QgsLayoutItemAttributeTable |
| 48 | +%End |
| 49 | + |
| 50 | + void setSource( ContentSource source ); |
| 51 | +%Docstring |
| 52 | + Sets the ``source`` for attributes to show in table body. |
| 53 | +.. seealso:: source() |
| 54 | +%End |
| 55 | + |
| 56 | + ContentSource source() const; |
| 57 | +%Docstring |
| 58 | + Returns the source for attributes shown in the table body. |
| 59 | +.. seealso:: setSource() |
| 60 | + :rtype: ContentSource |
| 61 | +%End |
| 62 | + |
| 63 | + QgsVectorLayer *sourceLayer(); |
| 64 | +%Docstring |
| 65 | + Returns the source layer for the table, considering the table source mode. For example, |
| 66 | + if the table is set to atlas feature mode, then the source layer will be the |
| 67 | + atlas coverage layer. If the table is set to layer attributes mode, then |
| 68 | + the source layer will be the user specified vector layer. |
| 69 | + :rtype: QgsVectorLayer |
| 70 | +%End |
| 71 | + |
| 72 | + void setVectorLayer( QgsVectorLayer *layer ); |
| 73 | +%Docstring |
| 74 | + Sets the vector ``layer`` from which to display feature attributes. |
| 75 | + |
| 76 | + This is only considered if the table source() is LayerAttributes. |
| 77 | + |
| 78 | +.. seealso:: vectorLayer() |
| 79 | +%End |
| 80 | + |
| 81 | + QgsVectorLayer *vectorLayer() const; |
| 82 | +%Docstring |
| 83 | + Returns the vector layer the attribute table is currently using. |
| 84 | + |
| 85 | + This is only considered if the table source() is LayerAttributes. |
| 86 | + |
| 87 | +.. seealso:: setVectorLayer() |
| 88 | +.. seealso:: sourceLayer() |
| 89 | + :rtype: QgsVectorLayer |
| 90 | +%End |
| 91 | + |
| 92 | + void setRelationId( const QString &id ); |
| 93 | +%Docstring |
| 94 | + Sets the relation ``id`` from which to display child features |
| 95 | +.. seealso:: relationId() |
| 96 | +.. seealso:: setSource() |
| 97 | +.. note:: |
| 98 | + |
| 99 | + Only used if table source() is set to RelationChildren. |
| 100 | +%End |
| 101 | + |
| 102 | + QString relationId() const; |
| 103 | +%Docstring |
| 104 | + Returns the relation id which the table displays child features from. |
| 105 | +.. seealso:: setRelationId() |
| 106 | +.. seealso:: source() |
| 107 | +.. note:: |
| 108 | + |
| 109 | + Only used if table source() is set to RelationChildren. |
| 110 | + :rtype: str |
| 111 | +%End |
| 112 | + |
| 113 | + void resetColumns(); |
| 114 | +%Docstring |
| 115 | + Resets the attribute table's columns to match the vector layer's fields. |
| 116 | +.. seealso:: setVectorLayer() |
| 117 | +%End |
| 118 | + |
| 119 | + void setMap( QgsLayoutItemMap *map ); |
| 120 | +%Docstring |
| 121 | + Sets a layout ``map`` to use to limit the extent of features shown in the |
| 122 | + attribute table. This setting only has an effect if setDisplayOnlyVisibleFeatures is |
| 123 | + set to true. Changing the map forces the table to refetch features from its |
| 124 | + vector layer, and may result in the table changing size to accommodate the new displayed |
| 125 | + feature attributes. |
| 126 | +.. seealso:: map() |
| 127 | +.. seealso:: setDisplayOnlyVisibleFeatures |
| 128 | +%End |
| 129 | + |
| 130 | + QgsLayoutItemMap *map() const; |
| 131 | +%Docstring |
| 132 | + Returns the layout map whose extents are controlling the features shown in the |
| 133 | + table. The extents of the map are only used if displayOnlyVisibleFeatures() is true. |
| 134 | +.. seealso:: setMap() |
| 135 | +.. seealso:: displayOnlyVisibleFeatures() |
| 136 | + :rtype: QgsLayoutItemMap |
| 137 | +%End |
| 138 | + |
| 139 | + void setMaximumNumberOfFeatures( int features ); |
| 140 | +%Docstring |
| 141 | + Sets the maximum number of ``features`` shown by the table. Changing this setting may result |
| 142 | + in the attribute table changing its size to accommodate the new number of rows, and requires |
| 143 | + the table to refetch features from its vector layer. |
| 144 | +.. seealso:: maximumNumberOfFeatures() |
| 145 | +%End |
| 146 | + |
| 147 | + int maximumNumberOfFeatures() const; |
| 148 | +%Docstring |
| 149 | + Returns the maximum number of features to be shown by the table. |
| 150 | +.. seealso:: setMaximumNumberOfFeatures() |
| 151 | + :rtype: int |
| 152 | +%End |
| 153 | + |
| 154 | + void setUniqueRowsOnly( bool uniqueOnly ); |
| 155 | +%Docstring |
| 156 | + Sets attribute table to only show unique rows. |
| 157 | + |
| 158 | + Set ``uniqueOnly`` to true to show only unique rows. Duplicate rows |
| 159 | + will be stripped from the table. |
| 160 | + |
| 161 | +.. seealso:: uniqueRowsOnly() |
| 162 | +%End |
| 163 | + |
| 164 | + bool uniqueRowsOnly() const; |
| 165 | +%Docstring |
| 166 | + Returns true if the table is set to show only unique rows. |
| 167 | + |
| 168 | +.. seealso:: setUniqueRowsOnly() |
| 169 | + :rtype: bool |
| 170 | +%End |
| 171 | + |
| 172 | + void setDisplayOnlyVisibleFeatures( bool visibleOnly ); |
| 173 | +%Docstring |
| 174 | + Sets the attribute table to only show features which are visible in a map item. Changing |
| 175 | + this setting forces the table to refetch features from its vector layer, and may result in |
| 176 | + the table changing size to accommodate the new displayed feature attributes. |
| 177 | + |
| 178 | +.. seealso:: displayOnlyVisibleFeatures() |
| 179 | +.. seealso:: setMap() |
| 180 | +%End |
| 181 | + |
| 182 | + bool displayOnlyVisibleFeatures() const; |
| 183 | +%Docstring |
| 184 | + Returns true if the table is set to show only features visible on a corresponding |
| 185 | + map item. |
| 186 | + |
| 187 | +.. seealso:: map() |
| 188 | +.. seealso:: setDisplayOnlyVisibleFeatures() |
| 189 | + :rtype: bool |
| 190 | +%End |
| 191 | + |
| 192 | + void setFilterToAtlasFeature( bool filterToAtlas ); |
| 193 | +%Docstring |
| 194 | + Sets attribute table to only show features which intersect the current atlas |
| 195 | + feature. |
| 196 | + |
| 197 | +.. seealso:: filterToAtlasFeature() |
| 198 | +%End |
| 199 | + |
| 200 | + bool filterToAtlasFeature() const; |
| 201 | +%Docstring |
| 202 | + Returns true if the table is set to only show features which intersect the current atlas |
| 203 | + feature. |
| 204 | + |
| 205 | +.. seealso:: setFilterToAtlasFeature() |
| 206 | + :rtype: bool |
| 207 | +%End |
| 208 | + |
| 209 | + bool filterFeatures() const; |
| 210 | +%Docstring |
| 211 | + Returns true if a feature filter is active on the attribute table. |
| 212 | + |
| 213 | +.. seealso:: setFilterFeatures() |
| 214 | +.. seealso:: featureFilter() |
| 215 | + :rtype: bool |
| 216 | +%End |
| 217 | + |
| 218 | + void setFilterFeatures( bool filter ); |
| 219 | +%Docstring |
| 220 | + Sets whether the feature filter is active for the attribute table. Changing |
| 221 | + this setting forces the table to refetch features from its vector layer, and may result in |
| 222 | + the table changing size to accommodate the new displayed feature attributes. |
| 223 | +.. seealso:: filterFeatures() |
| 224 | +.. seealso:: setFeatureFilter() |
| 225 | +%End |
| 226 | + |
| 227 | + QString featureFilter() const; |
| 228 | +%Docstring |
| 229 | + Returns the current expression used to filter features for the table. The filter is only |
| 230 | + active if filterFeatures() is true. |
| 231 | + |
| 232 | +.. seealso:: setFeatureFilter() |
| 233 | +.. seealso:: filterFeatures() |
| 234 | + :rtype: str |
| 235 | +%End |
| 236 | + |
| 237 | + void setFeatureFilter( const QString &expression ); |
| 238 | +%Docstring |
| 239 | + Sets the ``expression`` used for filtering features in the table. The filter is only |
| 240 | + active if filterFeatures() is set to true. Changing this setting forces the table |
| 241 | + to refetch features from its vector layer, and may result in |
| 242 | + the table changing size to accommodate the new displayed feature attributes. |
| 243 | + |
| 244 | +.. seealso:: featureFilter() |
| 245 | +.. seealso:: setFilterFeatures() |
| 246 | +%End |
| 247 | + |
| 248 | + void setDisplayedFields( const QStringList &fields, bool refresh = true ); |
| 249 | +%Docstring |
| 250 | + Sets the attributes to display in the table. |
| 251 | + \param fields list of fields names from the vector layer to show. |
| 252 | + Set to an empty list to show all feature attributes. |
| 253 | + \param refresh set to true to force the table to refetch features from its vector layer |
| 254 | + and immediately update the display of the table. This may result in the table changing size |
| 255 | + to accommodate the new displayed feature attributes. |
| 256 | +%End |
| 257 | + |
| 258 | + |
| 259 | + void setWrapString( const QString &wrapString ); |
| 260 | +%Docstring |
| 261 | + Sets a string to wrap the contents of the table cells by. Occurrences of this string will |
| 262 | + be replaced by a line break. |
| 263 | + \param wrapString string to replace with line break |
| 264 | +.. seealso:: wrapString() |
| 265 | +%End |
| 266 | + |
| 267 | + QString wrapString() const; |
| 268 | +%Docstring |
| 269 | + Returns the string used to wrap the contents of the table cells by. Occurrences of this string will |
| 270 | + be replaced by a line break. |
| 271 | +.. seealso:: setWrapString() |
| 272 | + :rtype: str |
| 273 | +%End |
| 274 | + |
| 275 | + |
| 276 | + virtual QgsExpressionContext createExpressionContext() const; |
| 277 | + |
| 278 | + |
| 279 | + protected: |
| 280 | + |
| 281 | + virtual bool writePropertiesToElement( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const; |
| 282 | + |
| 283 | + virtual bool readPropertiesFromElement( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ); |
| 284 | + |
| 285 | + |
| 286 | +}; |
| 287 | + |
| 288 | +/************************************************************************ |
| 289 | + * This file has been generated automatically from * |
| 290 | + * * |
| 291 | + * src/core/layout/qgslayoutitemattributetable.h * |
| 292 | + * * |
| 293 | + * Do not edit manually ! Edit header and run scripts/sipify.pl again * |
| 294 | + ************************************************************************/ |
0 commit comments