QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgslayoutmanualtablewidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutmanualtablewidget.h
3  ---------------------------------
4  begin : January 2020
5  copyright : (C) 2020 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"
22 #include "qgslayoutitemwidget.h"
24 #include "qgslayouttablecolumn.h"
25 #include "qgsguiutils.h"
27 
29  : QgsLayoutItemBaseWidget( nullptr, frame ? qobject_cast< QgsLayoutItemManualTable* >( frame->multiFrame() ) : nullptr )
30  , mTable( frame ? qobject_cast< QgsLayoutItemManualTable* >( frame->multiFrame() ) : nullptr )
31  , mFrame( frame )
32 {
33  setupUi( this );
34 
35  connect( mSetContentsButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::setTableContents );
36  connect( mMarginSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutManualTableWidget::mMarginSpinBox_valueChanged );
37  connect( mGridStrokeWidthSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutManualTableWidget::mGridStrokeWidthSpinBox_valueChanged );
38  connect( mGridColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutManualTableWidget::mGridColorButton_colorChanged );
39  connect( mBackgroundColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutManualTableWidget::mBackgroundColorButton_colorChanged );
40  connect( mDrawHorizontalGrid, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawHorizontalGrid_toggled );
41  connect( mDrawVerticalGrid, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawVerticalGrid_toggled );
42  connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled, this, &QgsLayoutManualTableWidget::mShowGridGroupCheckBox_toggled );
43  connect( mHeaderHAlignmentComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
44  connect( mHeaderModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mHeaderModeComboBox_currentIndexChanged );
45  connect( mAddFramePushButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::mAddFramePushButton_clicked );
46  connect( mResizeModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mResizeModeComboBox_currentIndexChanged );
47  connect( mDrawEmptyCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawEmptyCheckBox_toggled );
48  connect( mEmptyFrameCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mEmptyFrameCheckBox_toggled );
49  connect( mHideEmptyBgCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mHideEmptyBgCheckBox_toggled );
50  connect( mWrapBehaviorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
51  connect( mAdvancedCustomizationButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::mAdvancedCustomizationButton_clicked );
52  setPanelTitle( tr( "Table Properties" ) );
53 
54  mContentFontToolButton->setMode( QgsFontButton::ModeTextRenderer );
55  mHeaderFontToolButton->setMode( QgsFontButton::ModeTextRenderer );
56 
57  mContentFontToolButton->registerExpressionContextGenerator( this );
58  mHeaderFontToolButton->registerExpressionContextGenerator( this );
59 
60  blockAllSignals( true );
61 
62  mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
63  mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
64  mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
65 
66  mWrapBehaviorComboBox->addItem( tr( "Truncate Text" ), QgsLayoutTable::TruncateText );
67  mWrapBehaviorComboBox->addItem( tr( "Wrap Text" ), QgsLayoutTable::WrapText );
68 
69  mHeaderModeComboBox->addItem( tr( "On First Frame" ), QgsLayoutTable::FirstFrame );
70  mHeaderModeComboBox->addItem( tr( "On All Frames" ), QgsLayoutTable::AllFrames );
71  mHeaderModeComboBox->addItem( tr( "No Header" ), QgsLayoutTable::NoHeaders );
72 
73  mHeaderHAlignmentComboBox->addItem( tr( "Follow Column Alignment" ), QgsLayoutTable::FollowColumn );
74  mHeaderHAlignmentComboBox->addItem( tr( "Left" ), QgsLayoutTable::HeaderLeft );
75  mHeaderHAlignmentComboBox->addItem( tr( "Center" ), QgsLayoutTable::HeaderCenter );
76  mHeaderHAlignmentComboBox->addItem( tr( "Right" ), QgsLayoutTable::HeaderRight );
77 
78  mGridColorButton->setColorDialogTitle( tr( "Select Grid Color" ) );
79  mGridColorButton->setAllowOpacity( true );
80  mGridColorButton->setContext( QStringLiteral( "composer" ) );
81  mGridColorButton->setDefaultColor( Qt::black );
82  mBackgroundColorButton->setColorDialogTitle( tr( "Select Background Color" ) );
83  mBackgroundColorButton->setAllowOpacity( true );
84  mBackgroundColorButton->setContext( QStringLiteral( "composer" ) );
85  mBackgroundColorButton->setShowNoColor( true );
86  mBackgroundColorButton->setNoColorString( tr( "No Background" ) );
87 
88  updateGuiElements();
89 
90  if ( mTable )
91  {
92  connect( mTable, &QgsLayoutMultiFrame::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
93  }
94 
95  //embed widget for general options
96  if ( mFrame )
97  {
98  //add widget for general composer item properties
99  mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, mFrame );
100  mainLayout->addWidget( mItemPropertiesWidget );
101  }
102 
103  connect( mHeaderFontToolButton, &QgsFontButton::changed, this, &QgsLayoutManualTableWidget::headerFontChanged );
104  connect( mContentFontToolButton, &QgsFontButton::changed, this, &QgsLayoutManualTableWidget::contentFontChanged );
105 }
106 
108 {
109  if ( mItemPropertiesWidget )
110  mItemPropertiesWidget->setMasterLayout( masterLayout );
111 }
112 
114 {
115  QgsExpressionContext context;
116 
117  // frames include their parent multiframe's context, so prefer that if possible
118  if ( mFrame )
119  context = mFrame->createExpressionContext();
120  else if ( mTable )
121  context = mTable->createExpressionContext();
122 
123  std::unique_ptr< QgsExpressionContextScope > cellScope = std::make_unique< QgsExpressionContextScope >();
124  cellScope->setVariable( QStringLiteral( "row_number" ), 1, true );
125  cellScope->setVariable( QStringLiteral( "column_number" ), 1, true );
126  context.appendScope( cellScope.release() );
127 
128  context.setHighlightedVariables( { QStringLiteral( "row_number" ),
129  QStringLiteral( "column_number" )} );
130 
131  return context;
132 }
133 
135 {
136  QgsLayoutFrame *frame = qobject_cast< QgsLayoutFrame * >( item );
137  if ( !frame )
138  return false;
139 
140  QgsLayoutMultiFrame *multiFrame = frame->multiFrame();
141  if ( !multiFrame )
142  return false;
143 
144  if ( multiFrame->type() != QgsLayoutItemRegistry::LayoutManualTable )
145  return false;
146 
147  if ( mTable )
148  {
149  disconnect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
150  }
151  if ( mEditorDialog )
152  {
153  mEditorDialog->close();
154  }
155 
156  mTable = qobject_cast< QgsLayoutItemManualTable * >( multiFrame );
157  mFrame = frame;
158  mItemPropertiesWidget->setItem( frame );
159 
160  if ( mTable )
161  {
162  connect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
163  }
164 
165  updateGuiElements();
166 
167  return true;
168 }
169 
170 void QgsLayoutManualTableWidget::setTableContents()
171 {
172  if ( !mTable )
173  {
174  return;
175  }
176 
177  if ( mEditorDialog )
178  {
179  // the unholy quadfecta
180  mEditorDialog->show();
181  mEditorDialog->raise();
182  mEditorDialog->setWindowState( windowState() & ~Qt::WindowMinimized );
183  mEditorDialog->activateWindow();
184  }
185  else
186  {
187  mEditorDialog = new QgsTableEditorDialog( this );
188  mEditorDialog->registerExpressionContextGenerator( mTable );
189  connect( this, &QWidget::destroyed, mEditorDialog, &QMainWindow::close );
190 
191  mEditorDialog->setIncludeTableHeader( mTable->includeTableHeader() );
192  mEditorDialog->setTableContents( mTable->tableContents() );
193 
194  int row = 0;
195  const QList< double > rowHeights = mTable->rowHeights();
196  for ( const double height : rowHeights )
197  {
198  mEditorDialog->setTableRowHeight( row, height );
199  row++;
200  }
201  int col = 0;
202  const QList< double > columnWidths = mTable->columnWidths();
203  QVariantList headers;
204  headers.reserve( columnWidths.size() );
205  for ( const double width : columnWidths )
206  {
207  mEditorDialog->setTableColumnWidth( col, width );
208  headers << ( col < mTable->headers().count() ? mTable->headers().value( col ).heading() : QVariant() );
209  col++;
210  }
211  mEditorDialog->setTableHeaders( headers );
212 
213  connect( mEditorDialog, &QgsTableEditorDialog::tableChanged, this, [ = ]
214  {
215  if ( mTable )
216  {
217  mTable->beginCommand( tr( "Change Table Contents" ) );
218  mTable->setTableContents( mEditorDialog->tableContents() );
219 
220  const QVariantList headerText = mEditorDialog->tableHeaders();
221  if ( mEditorDialog->includeTableHeader() )
222  {
223  QgsLayoutTableColumns headers;
224  for ( const QVariant &h : headerText )
225  {
226  headers << QgsLayoutTableColumn( h.toString() );
227  }
228  mTable->setHeaders( headers );
229  }
230 
231  const int rowCount = mTable->tableContents().size();
232  QList< double > rowHeights;
233  rowHeights.reserve( rowCount );
234  for ( int row = 0; row < rowCount; ++row )
235  {
236  rowHeights << mEditorDialog->tableRowHeight( row );
237  }
238  mTable->setRowHeights( rowHeights );
239 
240  if ( !mTable->tableContents().empty() )
241  {
242  const int columnCount = mTable->tableContents().at( 0 ).size();
243  QList< double > columnWidths;
244  columnWidths.reserve( columnCount );
245  for ( int col = 0; col < columnCount; ++col )
246  {
247  columnWidths << mEditorDialog->tableColumnWidth( col );
248  }
249  mTable->setColumnWidths( columnWidths );
250  }
251 
252  mTable->endCommand();
253  }
254  } );
255 
256  connect( mEditorDialog, &QgsTableEditorDialog::includeHeaderChanged, this, [ = ]( bool included )
257  {
258  if ( mTable )
259  {
260  mTable->beginCommand( tr( "Change Table Header" ) );
261  mTable->setIncludeTableHeader( included );
262  mTable->endCommand();
263  }
264  } );
265  mEditorDialog->show();
266  }
267 }
268 
269 void QgsLayoutManualTableWidget::mMarginSpinBox_valueChanged( double d )
270 {
271  if ( !mTable )
272  {
273  return;
274  }
275 
276  mTable->beginCommand( tr( "Change Table Margin" ), QgsLayoutMultiFrame::UndoTableMargin );
277  mTable->setCellMargin( d );
278  mTable->endCommand();
279 }
280 
281 void QgsLayoutManualTableWidget::contentFontChanged()
282 {
283  if ( !mTable )
284  {
285  return;
286  }
287 
288  mTable->beginCommand( tr( "Change Table Font" ) );
289  mTable->setContentTextFormat( mContentFontToolButton->textFormat() );
290  mTable->endCommand();
291 }
292 
293 void QgsLayoutManualTableWidget::mGridStrokeWidthSpinBox_valueChanged( double d )
294 {
295  if ( !mTable )
296  {
297  return;
298  }
299 
300  mTable->beginCommand( tr( "Change Table Line Width" ), QgsLayoutMultiFrame::UndoTableGridStrokeWidth );
301  mTable->setGridStrokeWidth( d );
302  mTable->endCommand();
303 }
304 
305 void QgsLayoutManualTableWidget::mGridColorButton_colorChanged( const QColor &newColor )
306 {
307  if ( !mTable )
308  {
309  return;
310  }
311 
312  mTable->beginCommand( tr( "Change Table Grid Color" ), QgsLayoutMultiFrame::UndoTableGridColor );
313  mTable->setGridColor( newColor );
314  mTable->endCommand();
315 }
316 
317 void QgsLayoutManualTableWidget::mDrawHorizontalGrid_toggled( bool state )
318 {
319  if ( !mTable )
320  {
321  return;
322  }
323 
324  mTable->beginCommand( tr( "Toggle Table Grid" ) );
325  mTable->setHorizontalGrid( state );
326  mTable->endCommand();
327 }
328 
329 void QgsLayoutManualTableWidget::mDrawVerticalGrid_toggled( bool state )
330 {
331  if ( !mTable )
332  {
333  return;
334  }
335 
336  mTable->beginCommand( tr( "Toggled Table Grid" ) );
337  mTable->setVerticalGrid( state );
338  mTable->endCommand();
339 }
340 
341 void QgsLayoutManualTableWidget::mShowGridGroupCheckBox_toggled( bool state )
342 {
343  if ( !mTable )
344  {
345  return;
346  }
347 
348  mTable->beginCommand( tr( "Toggle Table Grid" ) );
349  mTable->setShowGrid( state );
350  mTable->endCommand();
351 }
352 
353 void QgsLayoutManualTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( int )
354 {
355  if ( !mTable )
356  {
357  return;
358  }
359 
360  mTable->beginCommand( tr( "Change Table Alignment" ) );
361  mTable->setHeaderHAlignment( static_cast< QgsLayoutTable::HeaderHAlignment >( mHeaderHAlignmentComboBox->currentData().toInt() ) );
362  mTable->endCommand();
363 }
364 
365 void QgsLayoutManualTableWidget::mHeaderModeComboBox_currentIndexChanged( int )
366 {
367  if ( !mTable )
368  {
369  return;
370  }
371 
372  mTable->beginCommand( tr( "Change Table Header Mode" ) );
373  mTable->setHeaderMode( static_cast< QgsLayoutTable::HeaderMode >( mHeaderModeComboBox->currentData().toInt() ) );
374  mTable->endCommand();
375 }
376 
377 void QgsLayoutManualTableWidget::mBackgroundColorButton_colorChanged( const QColor &newColor )
378 {
379  if ( !mTable )
380  {
381  return;
382  }
383 
384  mTable->beginCommand( tr( "Change Table Color" ), QgsLayoutMultiFrame::UndoTableBackgroundColor );
385  mTable->setBackgroundColor( newColor );
386  mTable->endCommand();
387 }
388 
389 void QgsLayoutManualTableWidget::headerFontChanged()
390 {
391  if ( !mTable )
392  return;
393 
394  mTable->beginCommand( tr( "Change Table Font" ) );
395  mTable->setHeaderTextFormat( mHeaderFontToolButton->textFormat() );
396  mTable->endCommand();
397 }
398 
399 void QgsLayoutManualTableWidget::updateGuiElements()
400 {
401  if ( !mTable || !mFrame )
402  {
403  return;
404  }
405 
406  blockAllSignals( true );
407 
408  mMarginSpinBox->setValue( mTable->cellMargin() );
409  mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
410  mGridColorButton->setColor( mTable->gridColor() );
411  mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
412  mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
413  if ( mTable->showGrid() )
414  {
415  mShowGridGroupCheckBox->setChecked( true );
416  }
417  else
418  {
419  mShowGridGroupCheckBox->setChecked( false );
420  }
421  mBackgroundColorButton->setColor( mTable->backgroundColor() );
422 
423  mHeaderFontToolButton->setTextFormat( mTable->headerTextFormat() );
424  mContentFontToolButton->setTextFormat( mTable->contentTextFormat() );
425 
426  mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
427  mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
428 
429  mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
430  mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
431 
432  mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
433  mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
434 
435  mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
436  mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
437 
438  blockAllSignals( false );
439 }
440 
441 void QgsLayoutManualTableWidget::blockAllSignals( bool b )
442 {
443  mMarginSpinBox->blockSignals( b );
444  mGridColorButton->blockSignals( b );
445  mGridStrokeWidthSpinBox->blockSignals( b );
446  mBackgroundColorButton->blockSignals( b );
447  mDrawHorizontalGrid->blockSignals( b );
448  mDrawVerticalGrid->blockSignals( b );
449  mShowGridGroupCheckBox->blockSignals( b );
450  mResizeModeComboBox->blockSignals( b );
451  mEmptyFrameCheckBox->blockSignals( b );
452  mHideEmptyBgCheckBox->blockSignals( b );
453  mDrawEmptyCheckBox->blockSignals( b );
454  mWrapBehaviorComboBox->blockSignals( b );
455  mContentFontToolButton->blockSignals( b );
456  mHeaderHAlignmentComboBox->blockSignals( b );
457  mHeaderModeComboBox->blockSignals( b );
458  mHeaderFontToolButton->blockSignals( b );
459 }
460 
461 void QgsLayoutManualTableWidget::mEmptyFrameCheckBox_toggled( bool checked )
462 {
463  if ( !mFrame )
464  {
465  return;
466  }
467 
468  mFrame->beginCommand( tr( "Toggle Empty Frame Mode" ) );
469  mFrame->setHidePageIfEmpty( checked );
470  mFrame->endCommand();
471 }
472 
473 void QgsLayoutManualTableWidget::mHideEmptyBgCheckBox_toggled( bool checked )
474 {
475  if ( !mFrame )
476  {
477  return;
478  }
479 
480  mFrame->beginCommand( tr( "Toggle Background Display" ) );
481  mFrame->setHideBackgroundIfEmpty( checked );
482  mFrame->endCommand();
483 }
484 
485 void QgsLayoutManualTableWidget::mAddFramePushButton_clicked()
486 {
487  if ( !mTable || !mFrame )
488  {
489  return;
490  }
491 
492  //create a new frame based on the current frame
493  QPointF pos = mFrame->pos();
494  //shift new frame so that it sits 10 units below current frame
495  pos.ry() += mFrame->rect().height() + 10;
496 
497  QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
498  mTable->recalculateFrameSizes();
499 
500  //set new frame as selection
501  if ( QgsLayout *layout = mTable->layout() )
502  {
503  layout->setSelectedItem( newFrame );
504  }
505 }
506 
507 void QgsLayoutManualTableWidget::mResizeModeComboBox_currentIndexChanged( int index )
508 {
509  if ( !mTable )
510  {
511  return;
512  }
513 
514  mTable->beginCommand( tr( "Change Resize Mode" ) );
515  mTable->setResizeMode( static_cast< QgsLayoutMultiFrame::ResizeMode >( mResizeModeComboBox->itemData( index ).toInt() ) );
516  mTable->endCommand();
517 
518  mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
519 }
520 
521 void QgsLayoutManualTableWidget::mWrapBehaviorComboBox_currentIndexChanged( int index )
522 {
523  if ( !mTable )
524  {
525  return;
526  }
527 
528  mTable->beginCommand( tr( "Change Table Wrap Mode" ) );
529  mTable->setWrapBehavior( static_cast< QgsLayoutTable::WrapBehavior >( mWrapBehaviorComboBox->itemData( index ).toInt() ) );
530  mTable->endCommand();
531 }
532 
533 void QgsLayoutManualTableWidget::mAdvancedCustomizationButton_clicked()
534 {
535  if ( !mTable )
536  {
537  return;
538  }
539 
540  QgsLayoutTableBackgroundColorsDialog d( mTable, this );
541 
542  d.exec();
543 }
544 
545 void QgsLayoutManualTableWidget::mDrawEmptyCheckBox_toggled( bool checked )
546 {
547  if ( !mTable )
548  {
549  return;
550  }
551 
552  mTable->beginCommand( tr( "Change Show Empty Rows" ) );
553  mTable->setShowEmptyRows( checked );
554  mTable->endCommand();
555 }
556 
void colorChanged(const QColor &color)
Emitted whenever a new color is set for the button.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
@ ModeTextRenderer
Configure font settings for use with QgsTextRenderer.
Definition: qgsfontbutton.h:61
void changed()
Emitted when the widget's text format settings are changed.
Base class for frame items, which form a layout multiframe item.
QgsLayoutMultiFrame * multiFrame() const
Returns the parent multiframe for the frame.
A base class for property widgets for layout items.
A layout table subclass that displays manually entered (and formatted) content.
A widget for controlling the common properties of layout items (e.g.
void setMasterLayout(QgsMasterLayoutInterface *masterLayout)
Sets the master layout associated with the item.
void setItem(QgsLayoutItem *item)
Sets the layout item.
@ LayoutManualTable
Manual (fixed) table.
Base class for graphical items within a QgsLayout.
void setMasterLayout(QgsMasterLayoutInterface *masterLayout) override
Sets the master layout associated with the item.
bool setNewItem(QgsLayoutItem *item) override
Attempts to update the widget to show the properties for the specified item.
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
QgsLayoutManualTableWidget(QgsLayoutFrame *frame)
constructor
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
virtual int type() const =0
Returns unique multiframe type id.
ResizeMode
Specifies the behavior for creating new frames to fit the multiframe's content.
@ UseExistingFrames
Don't automatically create new frames, just use existing frames.
@ ExtendToNextPage
Creates new full page frames on the following page(s) until the entire multiframe content is visible.
@ UndoTableBackgroundColor
Table background color.
@ UndoTableGridStrokeWidth
Table grid stroke width.
@ UndoTableGridColor
Table grid color.
@ UndoTableMargin
Table margins.
void changed()
Emitted when the object's properties change.
A dialog for customization of the cell background colors for a QgsLayoutTable.
HeaderMode
Controls where headers are shown in the table.
@ FirstFrame
Header shown on first frame only.
@ AllFrames
Headers shown on all frames.
@ NoHeaders
No headers shown for table.
WrapBehavior
Controls how long strings in the table are handled.
@ WrapText
Text which doesn't fit inside the cell is wrapped. Note that this only applies to text in columns wit...
@ TruncateText
Text which doesn't fit inside the cell is truncated.
HeaderHAlignment
Controls how headers are horizontally aligned in a table.
@ HeaderRight
Align headers right.
@ HeaderLeft
Align headers left.
@ HeaderCenter
Align headers to center.
@ FollowColumn
Header uses the same alignment as the column.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:51
Interface for master layout type objects, such as print layouts and reports.
void setPanelTitle(const QString &panelTitle)
Set the title of the panel when shown in the interface.
A reusable window for editing simple spreadsheet-style tables.
void includeHeaderChanged(bool included)
Emitted whenever the "include table header" setting is changed.
void tableChanged()
Emitted whenever the table contents are changed.