QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgslayoutattributetablewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutattributetablewidget.cpp
3  ---------------------------------
4  begin : November 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
19 #include "qgslayoutatlas.h"
20 #include "qgslayout.h"
21 #include "qgslayoutframe.h"
23 #include "qgslayoutitemwidget.h"
25 #include "qgslayouttablecolumn.h"
26 #include "qgslayoutitemmap.h"
27 #include "qgsvectorlayer.h"
29 #include "qgsproject.h"
30 #include "qgsrelationmanager.h"
31 #include "qgsguiutils.h"
33 
35  : QgsLayoutItemBaseWidget( nullptr, frame ? qobject_cast< QgsLayoutItemAttributeTable* >( frame->multiFrame() ) : nullptr )
36  , mTable( frame ? qobject_cast< QgsLayoutItemAttributeTable* >( frame->multiFrame() ) : nullptr )
37  , mFrame( frame )
38 {
39  setupUi( this );
40  connect( mRefreshPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked );
41  connect( mAttributesPushButton, &QPushButton::clicked, this, &QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked );
42  connect( mMaximumRowsSpinBox, static_cast < void ( QSpinBox::* )( int ) > ( &QSpinBox::valueChanged ), this, &QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged );
43  connect( mMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged );
44  connect( mGridStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged );
45  connect( mGridColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged );
46  connect( mBackgroundColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged );
47  connect( mHeaderFontColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutAttributeTableWidget::mHeaderFontColorButton_colorChanged );
48  connect( mContentFontColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutAttributeTableWidget::mContentFontColorButton_colorChanged );
49  connect( mDrawHorizontalGrid, &QCheckBox::toggled, this, &QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled );
50  connect( mDrawVerticalGrid, &QCheckBox::toggled, this, &QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled );
51  connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled, this, &QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled );
52  connect( mShowOnlyVisibleFeaturesCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged );
53  connect( mFeatureFilterCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged );
54  connect( mFeatureFilterEdit, &QLineEdit::editingFinished, this, &QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished );
55  connect( mFeatureFilterButton, &QToolButton::clicked, this, &QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked );
56  connect( mHeaderHAlignmentComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
57  connect( mHeaderModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged );
58  connect( mWrapStringLineEdit, &QLineEdit::editingFinished, this, &QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished );
59  connect( mAddFramePushButton, &QPushButton::clicked, this, &QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked );
60  connect( mResizeModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged );
61  connect( mSourceComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged );
62  connect( mRelationsComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged );
63  connect( mEmptyModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged );
64  connect( mDrawEmptyCheckBox, &QCheckBox::toggled, this, &QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled );
65  connect( mEmptyMessageLineEdit, &QLineEdit::editingFinished, this, &QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished );
66  connect( mIntersectAtlasCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged );
67  connect( mUniqueOnlyCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged );
68  connect( mEmptyFrameCheckBox, &QCheckBox::toggled, this, &QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled );
69  connect( mHideEmptyBgCheckBox, &QCheckBox::toggled, this, &QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled );
70  connect( mWrapBehaviorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
71  connect( mAdvancedCustomizationButton, &QPushButton::clicked, this, &QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked );
72  connect( mUseConditionalStylingCheckBox, &QCheckBox::stateChanged, this, &QgsLayoutAttributeTableWidget::useConditionalStylingChanged );
73  setPanelTitle( tr( "Table Properties" ) );
74 
75  mContentFontToolButton->setMode( QgsFontButton::ModeQFont );
76  mHeaderFontToolButton->setMode( QgsFontButton::ModeQFont );
77 
78  blockAllSignals( true );
79 
80  mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
81  mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
82  mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
83 
84  mEmptyModeComboBox->addItem( tr( "Draw Headers Only" ), QgsLayoutTable::HeadersOnly );
85  mEmptyModeComboBox->addItem( tr( "Hide Entire Table" ), QgsLayoutTable::HideTable );
86  mEmptyModeComboBox->addItem( tr( "Show Set Message" ), QgsLayoutTable::ShowMessage );
87 
88  mWrapBehaviorComboBox->addItem( tr( "Truncate Text" ), QgsLayoutTable::TruncateText );
89  mWrapBehaviorComboBox->addItem( tr( "Wrap Text" ), QgsLayoutTable::WrapText );
90 
91  mHeaderModeComboBox->addItem( tr( "On First Frame" ), QgsLayoutTable::FirstFrame );
92  mHeaderModeComboBox->addItem( tr( "On All Frames" ), QgsLayoutTable::AllFrames );
93  mHeaderModeComboBox->addItem( tr( "No Header" ), QgsLayoutTable::NoHeaders );
94 
95  mHeaderHAlignmentComboBox->addItem( tr( "Follow Column Alignment" ), QgsLayoutTable::FollowColumn );
96  mHeaderHAlignmentComboBox->addItem( tr( "Left" ), QgsLayoutTable::HeaderLeft );
97  mHeaderHAlignmentComboBox->addItem( tr( "Center" ), QgsLayoutTable::HeaderCenter );
98  mHeaderHAlignmentComboBox->addItem( tr( "Right" ), QgsLayoutTable::HeaderRight );
99 
100  mSourceComboBox->addItem( tr( "Layer Features" ), QgsLayoutItemAttributeTable::LayerAttributes );
101  toggleAtlasSpecificControls( static_cast< bool >( coverageLayer() ) );
102 
103  //update relations combo when relations modified in project
104  connect( QgsProject::instance()->relationManager(), &QgsRelationManager::changed, this, &QgsLayoutAttributeTableWidget::updateRelationsCombo );
105 
106  mLayerComboBox->setFilters( QgsMapLayerProxyModel::VectorLayer );
107  connect( mLayerComboBox, &QgsMapLayerComboBox::layerChanged, this, &QgsLayoutAttributeTableWidget::changeLayer );
108 
109  mComposerMapComboBox->setCurrentLayout( mTable->layout() );
110  mComposerMapComboBox->setItemType( QgsLayoutItemRegistry::LayoutMap );
111  connect( mComposerMapComboBox, &QgsLayoutItemComboBox::itemChanged, this, &QgsLayoutAttributeTableWidget::composerMapChanged );
112 
113  mHeaderFontColorButton->setColorDialogTitle( tr( "Select Header Font Color" ) );
114  mHeaderFontColorButton->setAllowOpacity( true );
115  mHeaderFontColorButton->setContext( QStringLiteral( "composer" ) );
116  mContentFontColorButton->setColorDialogTitle( tr( "Select Content Font Color" ) );
117  mContentFontColorButton->setAllowOpacity( true );
118  mContentFontColorButton->setContext( QStringLiteral( "composer" ) );
119  mGridColorButton->setColorDialogTitle( tr( "Select Grid Color" ) );
120  mGridColorButton->setAllowOpacity( true );
121  mGridColorButton->setContext( QStringLiteral( "composer" ) );
122  mGridColorButton->setDefaultColor( Qt::black );
123  mBackgroundColorButton->setColorDialogTitle( tr( "Select Background Color" ) );
124  mBackgroundColorButton->setAllowOpacity( true );
125  mBackgroundColorButton->setContext( QStringLiteral( "composer" ) );
126  mBackgroundColorButton->setShowNoColor( true );
127  mBackgroundColorButton->setNoColorString( tr( "No Background" ) );
128 
129  updateGuiElements();
130 
131  if ( mTable )
132  {
133  connect( mTable, &QgsLayoutMultiFrame::changed, this, &QgsLayoutAttributeTableWidget::updateGuiElements );
134 
135  // repopulate relations combo box if atlas layer changes
136  connect( &mTable->layout()->reportContext(), &QgsLayoutReportContext::layerChanged,
137  this, &QgsLayoutAttributeTableWidget::atlasToggled );
138 
139  if ( QgsLayoutAtlas *atlas = layoutAtlas() )
140  {
141  connect( atlas, &QgsLayoutAtlas::toggled, this, &QgsLayoutAttributeTableWidget::atlasToggled );
142  atlasToggled();
143  }
144 
145  mLayerSourceDDBtn->registerExpressionContextGenerator( mTable );
146  }
147 
149 
150  //embed widget for general options
151  if ( mFrame )
152  {
153  //add widget for general composer item properties
154  mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, mFrame );
155  mainLayout->addWidget( mItemPropertiesWidget );
156  }
157 
158  connect( mHeaderFontToolButton, &QgsFontButton::changed, this, &QgsLayoutAttributeTableWidget::headerFontChanged );
159  connect( mContentFontToolButton, &QgsFontButton::changed, this, &QgsLayoutAttributeTableWidget::contentFontChanged );
160 }
161 
163 {
164  mIntersectAtlasCheckBox->setText( tr( "Show only features intersecting %1 feature" ).arg( string ) );
165  const int atlasFeatureIndex = mSourceComboBox->findData( QgsLayoutItemAttributeTable::AtlasFeature );
166  if ( atlasFeatureIndex != -1 )
167  {
168  mSourceComboBox->setItemText( atlasFeatureIndex, tr( "Current %1 Feature" ).arg( string ) );
169  }
170 }
171 
173 {
174  if ( mItemPropertiesWidget )
175  mItemPropertiesWidget->setMasterLayout( masterLayout );
176 }
177 
179 {
180  QgsLayoutFrame *frame = qobject_cast< QgsLayoutFrame * >( item );
181  if ( !frame )
182  return false;
183 
184  QgsLayoutMultiFrame *multiFrame = frame->multiFrame();
185  if ( !multiFrame )
186  return false;
187 
188  if ( multiFrame->type() != QgsLayoutItemRegistry::LayoutAttributeTable )
189  return false;
190 
191  if ( mTable )
192  {
193  disconnect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutAttributeTableWidget::updateGuiElements );
194  }
195 
196  mTable = qobject_cast< QgsLayoutItemAttributeTable * >( multiFrame );
197  mFrame = frame;
198  mItemPropertiesWidget->setItem( frame );
199 
200  if ( mTable )
201  {
202  connect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutAttributeTableWidget::updateGuiElements );
203  }
204 
205  updateGuiElements();
206 
207  return true;
208 }
209 
210 
211 void QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked()
212 {
213  if ( !mTable )
214  {
215  return;
216  }
217 
218  mTable->refreshAttributes();
219 }
220 
221 void QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked()
222 {
223  if ( !mTable )
224  {
225  return;
226  }
227 
228  //make deep copy of current columns, so we can restore them in case of cancellation
229  QVector<QgsLayoutTableColumn> currentColumns = mTable->columns();
230  QVector<QgsLayoutTableColumn> currentSortColumns = mTable->sortColumns();
231 
232  mTable->beginCommand( tr( "Change Table Attributes" ) );
233 
234  //temporarily block updates for the window, to stop table trying to repaint under windows (#11462)
235  window()->setUpdatesEnabled( false );
236 
237  QgsLayoutAttributeSelectionDialog d( mTable, mTable->sourceLayer(), this );
238  if ( d.exec() == QDialog::Accepted )
239  {
240  mTable->refreshAttributes();
241  //safe to unblock updates
242  window()->setUpdatesEnabled( true );
243  mTable->update();
244  mTable->endCommand();
245 
246  //clear currentColumns to free memory
247  currentColumns.clear();
248  currentSortColumns.clear();
249  }
250  else
251  {
252  //undo changes
253  mTable->setColumns( currentColumns );
254  mTable->setSortColumns( currentSortColumns );
255  window()->setUpdatesEnabled( true );
256  mTable->cancelCommand();
257  }
258 }
259 
260 void QgsLayoutAttributeTableWidget::composerMapChanged( QgsLayoutItem *item )
261 {
262  if ( !mTable )
263  {
264  return;
265  }
266 
267  mTable->beginCommand( tr( "Change Table Map" ) );
268  mTable->setMap( qobject_cast< QgsLayoutItemMap * >( item ) );
269  mTable->update();
270  mTable->endCommand();
271 }
272 
273 void QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged( int i )
274 {
275  if ( !mTable )
276  {
277  return;
278  }
279 
280  mTable->beginCommand( tr( "Change Table Rows" ), QgsLayoutMultiFrame::UndoTableMaximumFeatures );
281  mTable->setMaximumNumberOfFeatures( i );
282  mTable->update();
283  mTable->endCommand();
284 }
285 
286 void QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged( double d )
287 {
288  if ( !mTable )
289  {
290  return;
291  }
292 
293  mTable->beginCommand( tr( "Change Table Margin" ), QgsLayoutMultiFrame::UndoTableMargin );
294  mTable->setCellMargin( d );
295  mTable->endCommand();
296 }
297 
298 void QgsLayoutAttributeTableWidget::headerFontChanged()
299 {
300  if ( !mTable )
301  return;
302 
303  mTable->beginCommand( tr( "Change Table Font" ) );
304  mTable->setHeaderFont( mHeaderFontToolButton->currentFont() );
305  mTable->endCommand();
306 }
307 
308 void QgsLayoutAttributeTableWidget::mHeaderFontColorButton_colorChanged( const QColor &newColor )
309 {
310  if ( !mTable )
311  {
312  return;
313  }
314 
315  mTable->beginCommand( tr( "Change Font Color" ), QgsLayoutMultiFrame::UndoTableHeaderFontColor );
316  mTable->setHeaderFontColor( newColor );
317  mTable->endCommand();
318 }
319 
320 void QgsLayoutAttributeTableWidget::contentFontChanged()
321 {
322  if ( !mTable )
323  {
324  return;
325  }
326 
327  mTable->beginCommand( tr( "Change Table Font" ) );
328  mTable->setContentFont( mContentFontToolButton->currentFont() );
329  mTable->endCommand();
330 }
331 
332 void QgsLayoutAttributeTableWidget::mContentFontColorButton_colorChanged( const QColor &newColor )
333 {
334  if ( !mTable )
335  {
336  return;
337  }
338 
339  mTable->beginCommand( tr( "Change Font Color" ), QgsLayoutMultiFrame::UndoTableContentFontColor );
340  mTable->setContentFontColor( newColor );
341  mTable->endCommand();
342 }
343 
344 void QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged( double d )
345 {
346  if ( !mTable )
347  {
348  return;
349  }
350 
351  mTable->beginCommand( tr( "Change Table Line Width" ), QgsLayoutMultiFrame::UndoTableGridStrokeWidth );
352  mTable->setGridStrokeWidth( d );
353  mTable->endCommand();
354 }
355 
356 void QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged( const QColor &newColor )
357 {
358  if ( !mTable )
359  {
360  return;
361  }
362 
363  mTable->beginCommand( tr( "Change Table Grid Color" ), QgsLayoutMultiFrame::UndoTableGridColor );
364  mTable->setGridColor( newColor );
365  mTable->endCommand();
366 }
367 
368 void QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled( bool state )
369 {
370  if ( !mTable )
371  {
372  return;
373  }
374 
375  mTable->beginCommand( tr( "Toggle Table Grid" ) );
376  mTable->setHorizontalGrid( state );
377  mTable->endCommand();
378 }
379 
380 void QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled( bool state )
381 {
382  if ( !mTable )
383  {
384  return;
385  }
386 
387  mTable->beginCommand( tr( "Toggled Table Grid" ) );
388  mTable->setVerticalGrid( state );
389  mTable->endCommand();
390 }
391 
392 void QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled( bool state )
393 {
394  if ( !mTable )
395  {
396  return;
397  }
398 
399  mTable->beginCommand( tr( "Toggle Table Grid" ) );
400  mTable->setShowGrid( state );
401  mTable->endCommand();
402 }
403 
404 void QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged( const QColor &newColor )
405 {
406  if ( !mTable )
407  {
408  return;
409  }
410 
411  mTable->beginCommand( tr( "Change Table Color" ), QgsLayoutMultiFrame::UndoTableBackgroundColor );
412  mTable->setBackgroundColor( newColor );
413  mTable->endCommand();
414 }
415 
416 void QgsLayoutAttributeTableWidget::updateGuiElements()
417 {
418  if ( !mTable || !mFrame )
419  {
420  return;
421  }
422 
423  blockAllSignals( true );
424 
425  mSourceComboBox->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
426  mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
427 
428  //layer combo box
429  if ( mTable->vectorLayer() )
430  {
431  mLayerComboBox->setLayer( mTable->vectorLayer() );
432  if ( mTable->vectorLayer()->geometryType() == QgsWkbTypes::NullGeometry )
433  {
434  //layer has no geometry, so uncheck & disable controls which require geometry
435  mShowOnlyVisibleFeaturesCheckBox->setChecked( false );
436  mShowOnlyVisibleFeaturesCheckBox->setEnabled( false );
437  }
438  else
439  {
440  mShowOnlyVisibleFeaturesCheckBox->setEnabled( true );
441  }
442  }
443 
444  mComposerMapComboBox->setItem( mTable->map() );
445  mMaximumRowsSpinBox->setValue( mTable->maximumNumberOfFeatures() );
446  mMarginSpinBox->setValue( mTable->cellMargin() );
447  mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
448  mGridColorButton->setColor( mTable->gridColor() );
449  mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
450  mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
451  if ( mTable->showGrid() )
452  {
453  mShowGridGroupCheckBox->setChecked( true );
454  }
455  else
456  {
457  mShowGridGroupCheckBox->setChecked( false );
458  }
459  mBackgroundColorButton->setColor( mTable->backgroundColor() );
460 
461  mHeaderFontColorButton->setColor( mTable->headerFontColor() );
462  mContentFontColorButton->setColor( mTable->contentFontColor() );
463  mHeaderFontToolButton->setCurrentFont( mTable->headerFont() );
464  mContentFontToolButton->setCurrentFont( mTable->contentFont() );
465 
466  if ( mTable->displayOnlyVisibleFeatures() && mShowOnlyVisibleFeaturesCheckBox->isEnabled() )
467  {
468  mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
469  mComposerMapComboBox->setEnabled( true );
470  mComposerMapLabel->setEnabled( true );
471  }
472  else
473  {
474  mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
475  mComposerMapComboBox->setEnabled( false );
476  mComposerMapLabel->setEnabled( false );
477  }
478 
479  mUniqueOnlyCheckBox->setChecked( mTable->uniqueRowsOnly() );
480  mIntersectAtlasCheckBox->setChecked( mTable->filterToAtlasFeature() );
481  mFeatureFilterEdit->setText( mTable->featureFilter() );
482  mFeatureFilterCheckBox->setCheckState( mTable->filterFeatures() ? Qt::Checked : Qt::Unchecked );
483  mFeatureFilterEdit->setEnabled( mTable->filterFeatures() );
484  mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
485  mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );
486 
487  mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
488  mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
489 
490  mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
491  mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
492  mEmptyMessageLineEdit->setEnabled( mTable->emptyTableBehavior() == QgsLayoutTable::ShowMessage );
493  mEmptyMessageLabel->setEnabled( mTable->emptyTableBehavior() == QgsLayoutTable::ShowMessage );
494  mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
495  mWrapStringLineEdit->setText( mTable->wrapString() );
496  mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
497 
498  mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
499  mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
500 
501  mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
502  mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
503 
504  updateDataDefinedButton( mLayerSourceDDBtn );
505 
506  toggleSourceControls();
507 
508  blockAllSignals( false );
509 }
510 
511 void QgsLayoutAttributeTableWidget::atlasToggled()
512 {
513  // display/hide atlas options in source combobox depending on atlas status
514  // if there's no atlas but there IS a coverageLayer, it's a report export and we should enable the controls
515  bool atlasEnabled = ( layoutAtlas() && layoutAtlas()->enabled() ) || ( !layoutAtlas() && coverageLayer() );
516 
517 
518  toggleAtlasSpecificControls( atlasEnabled );
519 
520  if ( !mTable )
521  return;
522 
523  whileBlocking( mSourceComboBox )->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
524 
525  if ( !atlasEnabled && mTable->filterToAtlasFeature() )
526  {
527  mTable->setFilterToAtlasFeature( false );
528  }
529 }
530 
531 void QgsLayoutAttributeTableWidget::updateRelationsCombo()
532 {
533  mRelationsComboBox->blockSignals( true );
534  mRelationsComboBox->clear();
535 
536  QgsVectorLayer *atlasLayer = coverageLayer();
537  if ( atlasLayer )
538  {
539  const QList<QgsRelation> relations = QgsProject::instance()->relationManager()->referencedRelations( atlasLayer );
540  for ( const QgsRelation &relation : relations )
541  {
542  mRelationsComboBox->addItem( relation.name(), relation.id() );
543  }
544  if ( mTable )
545  {
546  mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
547  }
548  }
549 
550  mRelationsComboBox->blockSignals( false );
551 }
552 
553 void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls( const bool atlasEnabled )
554 {
555  if ( !atlasEnabled )
556  {
557  if ( mTable->source() == QgsLayoutItemAttributeTable::AtlasFeature )
558  {
560  }
561  mSourceComboBox->removeItem( mSourceComboBox->findData( QgsLayoutItemAttributeTable::AtlasFeature ) );
562  mSourceComboBox->removeItem( mSourceComboBox->findData( QgsLayoutItemAttributeTable::RelationChildren ) );
563  mRelationsComboBox->blockSignals( true );
564  mRelationsComboBox->setEnabled( false );
565  mRelationsComboBox->clear();
566  mRelationsComboBox->blockSignals( false );
567  mIntersectAtlasCheckBox->setEnabled( false );
568  }
569  else
570  {
571  if ( mSourceComboBox->findData( QgsLayoutItemAttributeTable::AtlasFeature ) == -1 )
572  {
573  //add missing atlasfeature option to combobox
574  mSourceComboBox->addItem( tr( "Current Atlas Feature" ), QgsLayoutItemAttributeTable::AtlasFeature );
575  }
576  if ( mSourceComboBox->findData( QgsLayoutItemAttributeTable::RelationChildren ) == -1 )
577  {
578  //add missing relation children option to combobox
579  mSourceComboBox->addItem( tr( "Relation Children" ), QgsLayoutItemAttributeTable::RelationChildren );
580  }
581 
582  //add relations for coverage layer
583  updateRelationsCombo();
584  mRelationsComboBox->setEnabled( true );
585  mIntersectAtlasCheckBox->setEnabled( true );
586  }
587 }
588 
589 void QgsLayoutAttributeTableWidget::blockAllSignals( bool b )
590 {
591  mSourceComboBox->blockSignals( b );
592  mLayerComboBox->blockSignals( b );
593  mComposerMapComboBox->blockSignals( b );
594  mMaximumRowsSpinBox->blockSignals( b );
595  mMarginSpinBox->blockSignals( b );
596  mGridColorButton->blockSignals( b );
597  mGridStrokeWidthSpinBox->blockSignals( b );
598  mBackgroundColorButton->blockSignals( b );
599  mDrawHorizontalGrid->blockSignals( b );
600  mDrawVerticalGrid->blockSignals( b );
601  mShowGridGroupCheckBox->blockSignals( b );
602  mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
603  mUniqueOnlyCheckBox->blockSignals( b );
604  mIntersectAtlasCheckBox->blockSignals( b );
605  mFeatureFilterEdit->blockSignals( b );
606  mFeatureFilterCheckBox->blockSignals( b );
607  mHeaderHAlignmentComboBox->blockSignals( b );
608  mHeaderModeComboBox->blockSignals( b );
609  mHeaderFontColorButton->blockSignals( b );
610  mContentFontColorButton->blockSignals( b );
611  mResizeModeComboBox->blockSignals( b );
612  mRelationsComboBox->blockSignals( b );
613  mEmptyModeComboBox->blockSignals( b );
614  mEmptyMessageLineEdit->blockSignals( b );
615  mEmptyFrameCheckBox->blockSignals( b );
616  mHideEmptyBgCheckBox->blockSignals( b );
617  mDrawEmptyCheckBox->blockSignals( b );
618  mWrapStringLineEdit->blockSignals( b );
619  mWrapBehaviorComboBox->blockSignals( b );
620  mContentFontToolButton->blockSignals( b );
621  mHeaderFontToolButton->blockSignals( b );
622 }
623 
624 void QgsLayoutAttributeTableWidget::setMaximumNumberOfFeatures( int n )
625 {
626  whileBlocking( mMaximumRowsSpinBox )->setValue( n );
627 }
628 
629 void QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged( int state )
630 {
631  if ( !mTable )
632  {
633  return;
634  }
635 
636  mTable->beginCommand( tr( "Toggle Visible Features Only" ) );
637  bool showOnlyVisibleFeatures = ( state == Qt::Checked );
638  mTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
639  mTable->update();
640  mTable->endCommand();
641 
642  //enable/disable map combobox based on state of checkbox
643  mComposerMapComboBox->setEnabled( state == Qt::Checked );
644  mComposerMapLabel->setEnabled( state == Qt::Checked );
645 }
646 
647 void QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged( int state )
648 {
649  if ( !mTable )
650  {
651  return;
652  }
653 
654  mTable->beginCommand( tr( "Toggle Table Filter Duplicates" ) );
655  mTable->setUniqueRowsOnly( state == Qt::Checked );
656  mTable->update();
657  mTable->endCommand();
658 }
659 
660 void QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled( bool checked )
661 {
662  if ( !mFrame )
663  {
664  return;
665  }
666 
667  mFrame->beginCommand( tr( "Toggle Empty Frame Mode" ) );
668  mFrame->setHidePageIfEmpty( checked );
669  mFrame->endCommand();
670 }
671 
672 void QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled( bool checked )
673 {
674  if ( !mFrame )
675  {
676  return;
677  }
678 
679  mFrame->beginCommand( tr( "Toggle Background Display" ) );
680  mFrame->setHideBackgroundIfEmpty( checked );
681  mFrame->endCommand();
682 }
683 
684 void QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged( int state )
685 {
686  if ( !mTable )
687  {
688  return;
689  }
690 
691  mTable->beginCommand( tr( "Toggle Table Atlas Filter" ) );
692  bool filterToAtlas = ( state == Qt::Checked );
693  mTable->setFilterToAtlasFeature( filterToAtlas );
694  mTable->update();
695  mTable->endCommand();
696 }
697 
698 void QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged( int state )
699 {
700  if ( !mTable )
701  {
702  return;
703  }
704 
705  if ( state == Qt::Checked )
706  {
707  mFeatureFilterEdit->setEnabled( true );
708  mFeatureFilterButton->setEnabled( true );
709  }
710  else
711  {
712  mFeatureFilterEdit->setEnabled( false );
713  mFeatureFilterButton->setEnabled( false );
714  }
715 
716  mTable->beginCommand( tr( "Toggle Table Feature Filter" ) );
717  mTable->setFilterFeatures( state == Qt::Checked );
718  mTable->update();
719  mTable->endCommand();
720 }
721 
722 void QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished()
723 {
724  if ( !mTable )
725  {
726  return;
727  }
728 
729  mTable->beginCommand( tr( "Change Table Feature Filter" ) );
730  mTable->setFeatureFilter( mFeatureFilterEdit->text() );
731  mTable->update();
732  mTable->endCommand();
733 }
734 
735 void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
736 {
737  if ( !mTable )
738  {
739  return;
740  }
741 
742  QgsExpressionContext context = mTable->createExpressionContext();
743  QgsExpressionBuilderDialog exprDlg( mTable->sourceLayer(), mFeatureFilterEdit->text(), this, QStringLiteral( "generic" ), context );
744  exprDlg.setWindowTitle( tr( "Expression Based Filter" ) );
745  if ( exprDlg.exec() == QDialog::Accepted )
746  {
747  QString expression = exprDlg.expressionText();
748  if ( !expression.isEmpty() )
749  {
750  mFeatureFilterEdit->setText( expression );
751  mTable->beginCommand( tr( "Change Table Feature Filter" ) );
752  mTable->setFeatureFilter( mFeatureFilterEdit->text() );
753  mTable->update();
754  mTable->endCommand();
755  }
756  }
757 }
758 
759 void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( int )
760 {
761  if ( !mTable )
762  {
763  return;
764  }
765 
766  mTable->beginCommand( tr( "Change Table Alignment" ) );
767  mTable->setHeaderHAlignment( static_cast< QgsLayoutTable::HeaderHAlignment >( mHeaderHAlignmentComboBox->currentData().toInt() ) );
768  mTable->endCommand();
769 }
770 
771 void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged( int )
772 {
773  if ( !mTable )
774  {
775  return;
776  }
777 
778  mTable->beginCommand( tr( "Change Table Header Mode" ) );
779  mTable->setHeaderMode( static_cast< QgsLayoutTable::HeaderMode >( mHeaderModeComboBox->currentData().toInt() ) );
780  mTable->endCommand();
781 }
782 
783 void QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished()
784 {
785  if ( !mTable )
786  {
787  return;
788  }
789 
790  mTable->beginCommand( tr( "Change Table Wrap String" ) );
791  mTable->setWrapString( mWrapStringLineEdit->text() );
792  mTable->endCommand();
793 }
794 
795 void QgsLayoutAttributeTableWidget::changeLayer( QgsMapLayer *layer )
796 {
797  if ( !mTable )
798  {
799  return;
800  }
801 
802  QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer );
803  if ( !vl )
804  {
805  return;
806  }
807 
808  mTable->beginCommand( tr( "Change Table Layer" ) );
809  mTable->setVectorLayer( vl );
810  mTable->update();
811  mTable->endCommand();
812 
814  {
815  //layer has no geometry, so uncheck & disable controls which require geometry
816  mShowOnlyVisibleFeaturesCheckBox->setChecked( false );
817  mShowOnlyVisibleFeaturesCheckBox->setEnabled( false );
818  }
819  else
820  {
821  mShowOnlyVisibleFeaturesCheckBox->setEnabled( true );
822  }
823 }
824 
825 void QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked()
826 {
827  if ( !mTable || !mFrame )
828  {
829  return;
830  }
831 
832  //create a new frame based on the current frame
833  QPointF pos = mFrame->pos();
834  //shift new frame so that it sits 10 units below current frame
835  pos.ry() += mFrame->rect().height() + 10;
836 
837  QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
838  mTable->recalculateFrameSizes();
839 
840  //set new frame as selection
841  if ( QgsLayout *layout = mTable->layout() )
842  {
843  layout->setSelectedItem( newFrame );
844  }
845 }
846 
847 void QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged( int index )
848 {
849  if ( !mTable )
850  {
851  return;
852  }
853 
854  mTable->beginCommand( tr( "Change Resize Mode" ) );
855  mTable->setResizeMode( static_cast< QgsLayoutMultiFrame::ResizeMode >( mResizeModeComboBox->itemData( index ).toInt() ) );
856  mTable->endCommand();
857 
858  mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
859 }
860 
861 void QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged( int index )
862 {
863  if ( !mTable )
864  {
865  return;
866  }
867 
868  mTable->beginCommand( tr( "Change Table Source" ) );
869  mTable->setSource( static_cast< QgsLayoutItemAttributeTable::ContentSource >( mSourceComboBox->itemData( index ).toInt() ) );
870  mTable->endCommand();
871 
872  toggleSourceControls();
873 }
874 
875 void QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged( int index )
876 {
877  if ( !mTable )
878  {
879  return;
880  }
881 
882  mTable->beginCommand( tr( "Change Table Source Relation" ) );
883  mTable->setRelationId( mRelationsComboBox->itemData( index ).toString() );
884  mTable->endCommand();
885 }
886 
887 void QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged( int index )
888 {
889  if ( !mTable )
890  {
891  return;
892  }
893 
894  mTable->beginCommand( tr( "Change Empty Table Behavior" ) );
895  mTable->setEmptyTableBehavior( static_cast< QgsLayoutTable::EmptyTableMode >( mEmptyModeComboBox->itemData( index ).toInt() ) );
896  mTable->endCommand();
897  mEmptyMessageLineEdit->setEnabled( mTable->emptyTableBehavior() == QgsLayoutTable::ShowMessage );
898  mEmptyMessageLabel->setEnabled( mTable->emptyTableBehavior() == QgsLayoutTable::ShowMessage );
899 }
900 
901 void QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged( int index )
902 {
903  if ( !mTable )
904  {
905  return;
906  }
907 
908  mTable->beginCommand( tr( "Change Table Wrap Mode" ) );
909  mTable->setWrapBehavior( static_cast< QgsLayoutTable::WrapBehavior >( mWrapBehaviorComboBox->itemData( index ).toInt() ) );
910  mTable->endCommand();
911 }
912 
913 void QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked()
914 {
915  if ( !mTable )
916  {
917  return;
918  }
919 
920  QgsLayoutTableBackgroundColorsDialog d( mTable, this );
921  d.exec();
922 }
923 
924 void QgsLayoutAttributeTableWidget::useConditionalStylingChanged( bool checked )
925 {
926  if ( !mTable )
927  {
928  return;
929  }
930 
931  mTable->beginCommand( tr( "Toggle Table Conditional Styling" ) );
932  mTable->setUseConditionalStyling( checked );
933  mTable->update();
934  mTable->endCommand();
935 }
936 
937 void QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled( bool checked )
938 {
939  if ( !mTable )
940  {
941  return;
942  }
943 
944  mTable->beginCommand( tr( "Change Show Empty Rows" ) );
945  mTable->setShowEmptyRows( checked );
946  mTable->endCommand();
947 }
948 
949 void QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished()
950 {
951  if ( !mTable )
952  {
953  return;
954  }
955 
956  mTable->beginCommand( tr( "Change Empty Table Message" ) );
957  mTable->setEmptyTableMessage( mEmptyMessageLineEdit->text() );
958  mTable->endCommand();
959 }
960 
961 void QgsLayoutAttributeTableWidget::toggleSourceControls()
962 {
963  switch ( mTable->source() )
964  {
966  mLayerComboBox->setEnabled( true );
967  mLayerComboBox->setVisible( true );
968  mLayerSourceDDBtn->setVisible( true );
969  mLayerLabel->setVisible( true );
970  mRelationsComboBox->setEnabled( false );
971  mRelationsComboBox->setVisible( false );
972  mRelationLabel->setVisible( false );
973  mMaximumRowsSpinBox->setEnabled( true );
974  mMaxNumFeaturesLabel->setEnabled( true );
975  mShowOnlyVisibleFeaturesCheckBox->setEnabled( true );
976  mComposerMapComboBox->setEnabled( mTable->displayOnlyVisibleFeatures() );
977  mComposerMapLabel->setEnabled( mTable->displayOnlyVisibleFeatures() );
978  break;
980  mLayerComboBox->setEnabled( false );
981  mLayerComboBox->setVisible( false );
982  mLayerSourceDDBtn->setVisible( false );
983  mLayerLabel->setVisible( false );
984  mRelationsComboBox->setEnabled( false );
985  mRelationsComboBox->setVisible( false );
986  mRelationLabel->setVisible( false );
987  mMaximumRowsSpinBox->setEnabled( false );
988  mMaxNumFeaturesLabel->setEnabled( false );
989  mShowOnlyVisibleFeaturesCheckBox->setEnabled( false );
990  mComposerMapComboBox->setEnabled( false );
991  mComposerMapLabel->setEnabled( false );
992  break;
994  mLayerComboBox->setEnabled( false );
995  mLayerComboBox->setVisible( false );
996  mLayerLabel->setVisible( false );
997  mLayerSourceDDBtn->setVisible( false );
998  mRelationsComboBox->setEnabled( true );
999  mRelationsComboBox->setVisible( true );
1000  mRelationLabel->setVisible( true );
1001  mMaximumRowsSpinBox->setEnabled( true );
1002  mMaxNumFeaturesLabel->setEnabled( true );
1003  mShowOnlyVisibleFeaturesCheckBox->setEnabled( true );
1004  mComposerMapComboBox->setEnabled( true );
1005  mComposerMapLabel->setEnabled( true );
1006  break;
1007  }
1008 }
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
QgsLayoutItemBaseWidget::updateDataDefinedButton
void updateDataDefinedButton(QgsPropertyOverrideButton *button)
Updates a previously registered data defined button to reflect the item's current properties.
Definition: qgslayoutitemwidget.cpp:212
QgsProject::relationManager
QgsRelationManager relationManager
Definition: qgsproject.h:103
qgslayoutitemattributetable.h
QgsLayoutTable::HeaderHAlignment
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
Definition: qgslayouttable.h:120
QgsWkbTypes::NullGeometry
@ NullGeometry
Definition: qgswkbtypes.h:145
qgslayoutattributeselectiondialog.h
QgsLayoutMultiFrame::RepeatUntilFinished
@ RepeatUntilFinished
Definition: qgslayoutmultiframe.h:106
QgsLayoutItemBaseWidget::registerDataDefinedButton
void registerDataDefinedButton(QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty property)
Registers a data defined button, setting up its initial value, connections and description.
Definition: qgslayoutitemwidget.cpp:207
QgsProject::instance
static QgsProject * instance()
Returns the QgsProject singleton instance.
Definition: qgsproject.cpp:458
QgsLayoutTable::HideTable
@ HideTable
Hides entire table if empty.
Definition: qgslayouttable.h:144
QgsLayoutObject::AttributeTableSourceLayer
@ AttributeTableSourceLayer
Attribute table source layer.
Definition: qgslayoutobject.h:193
QgsLayoutMultiFrame
Definition: qgslayoutmultiframe.h:48
QgsLayoutObject::changed
void changed()
Emitted when the object's properties change.
QgsLayoutMultiFrame::UndoTableHeaderFontColor
@ UndoTableHeaderFontColor
Table header font color.
Definition: qgslayoutmultiframe.h:119
QgsLayoutItemPropertiesWidget
Definition: qgslayoutitemwidget.h:218
QgsRelationManager::changed
void changed()
Emitted when relations are added or removed to the manager.
QgsLayoutAttributeTableWidget::setMasterLayout
void setMasterLayout(QgsMasterLayoutInterface *masterLayout) override
Sets the master layout associated with the item.
Definition: qgslayoutattributetablewidget.cpp:172
QgsLayoutItemBaseWidget::layoutAtlas
QgsLayoutAtlas * layoutAtlas() const
Returns the atlas for the layout (if available)
Definition: qgslayoutitemwidget.cpp:227
QgsLayoutItemBaseWidget::coverageLayer
QgsVectorLayer * coverageLayer() const
Returns the current layout context coverage layer (if set).
Definition: qgslayoutitemwidget.cpp:217
QgsColorButton::colorChanged
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
QgsLayoutMultiFrame::ExtendToNextPage
@ ExtendToNextPage
Creates new full page frames on the following page(s) until the entire multiframe content is visible.
Definition: qgslayoutmultiframe.h:104
QgsLayoutItemPropertiesWidget::setMasterLayout
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
Definition: qgslayoutitemwidget.cpp:381
QgsLayoutAttributeSelectionDialog
Definition: qgslayoutattributeselectiondialog.h:280
QgsMapLayerProxyModel::VectorLayer
@ VectorLayer
Definition: qgsmaplayerproxymodel.h:50
qgslayoutframe.h
qgslayoutitemwidget.h
QgsLayoutTable::FirstFrame
@ FirstFrame
Header shown on first frame only.
Definition: qgslayouttable.h:133
QgsLayoutMultiFrame::type
virtual int type() const =0
Returns unique multiframe type id.
qgslayouttablebackgroundcolorsdialog.h
QgsLayoutTable::ShowMessage
@ ShowMessage
Shows preset message instead of table contents.
Definition: qgslayouttable.h:145
QgsLayoutMultiFrame::UndoTableGridColor
@ UndoTableGridColor
Table grid color.
Definition: qgslayoutmultiframe.h:122
QgsLayoutTable::WrapText
@ WrapText
Text which doesn't fit inside the cell is wrapped. Note that this only applies to text in columns wit...
Definition: qgslayouttable.h:154
QgsRelationManager::referencedRelations
QList< QgsRelation > referencedRelations(const QgsVectorLayer *layer=nullptr) const
Gets all relations where this layer is the referenced part (i.e.
Definition: qgsrelationmanager.cpp:160
QgsLayoutAtlas::enabled
bool enabled() const
Returns whether the atlas generation is enabled.
Definition: qgslayoutatlas.h:67
QgsLayoutFrame
Definition: qgslayoutframe.h:31
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:262
QgsLayoutAttributeTableWidget::setNewItem
bool setNewItem(QgsLayoutItem *item) override
Attempts to update the widget to show the properties for the specified item.
Definition: qgslayoutattributetablewidget.cpp:178
QgsLayoutItemAttributeTable::RelationChildren
@ RelationChildren
Table shows attributes from related child features.
Definition: qgslayoutitemattributetable.h:47
QgsLayoutTableBackgroundColorsDialog
Definition: qgslayouttablebackgroundcolorsdialog.h:39
QgsExpressionBuilderDialog
Definition: qgsexpressionbuilderdialog.h:30
qgslayoutattributetablewidget.h
QgsLayoutItemAttributeTable::LayerAttributes
@ LayerAttributes
Table shows attributes from features in a vector layer.
Definition: qgslayoutitemattributetable.h:45
QgsLayoutTable::TruncateText
@ TruncateText
Text which doesn't fit inside the cell is truncated.
Definition: qgslayouttable.h:153
QgsLayoutMultiFrame::ResizeMode
ResizeMode
Specifies the behavior for creating new frames to fit the multiframe's content.
Definition: qgslayoutmultiframe.h:101
QgsLayoutTable::NoHeaders
@ NoHeaders
No headers shown for table.
Definition: qgslayouttable.h:135
QgsLayoutMultiFrame::UndoTableContentFontColor
@ UndoTableContentFontColor
Table content font color.
Definition: qgslayoutmultiframe.h:120
QgsLayoutMultiFrame::UndoTableBackgroundColor
@ UndoTableBackgroundColor
Table background color.
Definition: qgslayoutmultiframe.h:123
QgsLayoutTable::HeaderRight
@ HeaderRight
Align headers right.
Definition: qgslayouttable.h:125
QgsLayoutItemAttributeTable::ContentSource
ContentSource
Specifies the content source for the attribute table.
Definition: qgslayoutitemattributetable.h:43
QgsLayoutItemAttributeTable
Definition: qgslayoutitemattributetable.h:34
QgsLayoutTable::HeaderMode
HeaderMode
Controls where headers are shown in the table.
Definition: qgslayouttable.h:131
QgsLayoutItem
Base class for graphical items within a QgsLayout.
Definition: qgslayoutitem.h:112
QgsLayoutTable::WrapBehavior
WrapBehavior
Controls how long strings in the table are handled.
Definition: qgslayouttable.h:151
QgsLayoutMultiFrame::UndoTableMaximumFeatures
@ UndoTableMaximumFeatures
Maximum features in table.
Definition: qgslayoutmultiframe.h:117
qgsrelationmanager.h
QgsPanelWidget::setPanelTitle
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
Definition: qgspanelwidget.h:44
qgslayout.h
QgsLayoutAttributeTableWidget::setReportTypeString
void setReportTypeString(const QString &string) override
Sets the string to use to describe the current report type (e.g.
Definition: qgslayoutattributetablewidget.cpp:162
QgsLayoutTable::EmptyTableMode
EmptyTableMode
Controls how empty tables are displayed.
Definition: qgslayouttable.h:141
QgsLayoutItemBaseWidget
Definition: qgslayoutitemwidget.h:122
QgsLayoutTable::HeaderCenter
@ HeaderCenter
Align headers to center.
Definition: qgslayouttable.h:124
qgsvectorlayer.h
QgsFontButton::ModeQFont
@ ModeQFont
Configure font settings for use with QFont objects.
Definition: qgsfontbutton.h:59
QgsLayout
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:49
QgsVectorLayer
Definition: qgsvectorlayer.h:385
QgsMapLayer
Definition: qgsmaplayer.h:81
qgslayouttablecolumn.h
QgsLayoutItemAttributeTable::AtlasFeature
@ AtlasFeature
Table shows attributes from the current atlas feature.
Definition: qgslayoutitemattributetable.h:46
QgsLayoutAtlas::toggled
void toggled(bool)
Emitted when atlas is enabled or disabled.
QgsLayoutItemRegistry::LayoutMap
@ LayoutMap
Map item.
Definition: qgslayoutitemregistry.h:317
QgsRelation
Definition: qgsrelation.h:41
QgsLayoutAttributeTableWidget::QgsLayoutAttributeTableWidget
QgsLayoutAttributeTableWidget(QgsLayoutFrame *frame)
constructor
Definition: qgslayoutattributetablewidget.cpp:34
QgsLayoutItemComboBox::itemChanged
void itemChanged(QgsLayoutItem *item)
Emitted whenever the currently selected item changes.
QgsLayoutTable::HeadersOnly
@ HeadersOnly
Show header rows only.
Definition: qgslayouttable.h:143
QgsLayoutTable::FollowColumn
@ FollowColumn
Header uses the same alignment as the column.
Definition: qgslayouttable.h:122
QgsMasterLayoutInterface
Interface for master layout type objects, such as print layouts and reports.
Definition: qgsmasterlayoutinterface.h:42
qgsguiutils.h
QgsLayoutItemPropertiesWidget::setItem
void setItem(QgsLayoutItem *item)
Sets the layout item.
Definition: qgslayoutitemwidget.cpp:362
QgsLayoutReportContext::layerChanged
void layerChanged(QgsVectorLayer *layer)
Emitted when the context's layer is changed.
QgsVectorLayer::geometryType
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
Definition: qgsvectorlayer.cpp:659
QgsLayoutItemRegistry::LayoutAttributeTable
@ LayoutAttributeTable
Attribute table.
Definition: qgslayoutitemregistry.h:333
QgsLayoutTable::HeaderLeft
@ HeaderLeft
Align headers left.
Definition: qgslayouttable.h:123
QgsLayoutTable::AllFrames
@ AllFrames
Headers shown on all frames.
Definition: qgslayouttable.h:134
QgsLayoutMultiFrame::UndoTableGridStrokeWidth
@ UndoTableGridStrokeWidth
Table grid stroke width.
Definition: qgslayoutmultiframe.h:121
QgsLayoutAtlas
Definition: qgslayoutatlas.h:41
QgsLayoutMultiFrame::UndoTableMargin
@ UndoTableMargin
Table margins.
Definition: qgslayoutmultiframe.h:118
qgsproject.h
QgsLayoutFrame::multiFrame
QgsLayoutMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
Definition: qgslayoutframe.cpp:49
QgsMapLayerComboBox::layerChanged
void layerChanged(QgsMapLayer *layer)
Emitted whenever the currently selected layer changes.
QgsLayoutMultiFrame::UseExistingFrames
@ UseExistingFrames
Don't automatically create new frames, just use existing frames.
Definition: qgslayoutmultiframe.h:103
qgslayoutitemmap.h
qgsexpressionbuilderdialog.h
qgslayoutatlas.h
QgsFontButton::changed
void changed()
Emitted when the widget's text format settings are changed.