QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
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
20#include "qgsguiutils.h"
21#include "qgslayout.h"
22#include "qgslayoutatlas.h"
23#include "qgslayoutframe.h"
25#include "qgslayoutitemwidget.h"
29#include "qgsprintlayout.h"
30
31#include "moc_qgslayoutmanualtablewidget.cpp"
32
33QPointer<QgsTableEditorDialog> QgsLayoutManualTableWidget::sEditorDialog = nullptr;
34
36 : QgsLayoutItemBaseWidget( nullptr, frame ? qobject_cast<QgsLayoutItemManualTable *>( frame->multiFrame() ) : nullptr )
37 , mTable( frame ? qobject_cast<QgsLayoutItemManualTable *>( frame->multiFrame() ) : nullptr )
38 , mFrame( frame )
39{
40 setupUi( this );
41
42 connect( mSetContentsButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::setTableContents );
43 connect( mMarginSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutManualTableWidget::mMarginSpinBox_valueChanged );
44 connect( mGridStrokeWidthSpinBox, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), this, &QgsLayoutManualTableWidget::mGridStrokeWidthSpinBox_valueChanged );
45 connect( mGridColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutManualTableWidget::mGridColorButton_colorChanged );
46 connect( mBackgroundColorButton, &QgsColorButton::colorChanged, this, &QgsLayoutManualTableWidget::mBackgroundColorButton_colorChanged );
47 connect( mDrawHorizontalGrid, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawHorizontalGrid_toggled );
48 connect( mDrawVerticalGrid, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawVerticalGrid_toggled );
49 connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled, this, &QgsLayoutManualTableWidget::mShowGridGroupCheckBox_toggled );
50 connect( mHeaderHAlignmentComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
51 connect( mHeaderModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mHeaderModeComboBox_currentIndexChanged );
52 connect( mAddFramePushButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::mAddFramePushButton_clicked );
53 connect( mResizeModeComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mResizeModeComboBox_currentIndexChanged );
54 connect( mDrawEmptyCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mDrawEmptyCheckBox_toggled );
55 connect( mEmptyFrameCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mEmptyFrameCheckBox_toggled );
56 connect( mHideEmptyBgCheckBox, &QCheckBox::toggled, this, &QgsLayoutManualTableWidget::mHideEmptyBgCheckBox_toggled );
57 connect( mWrapBehaviorComboBox, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsLayoutManualTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
58 connect( mAdvancedCustomizationButton, &QPushButton::clicked, this, &QgsLayoutManualTableWidget::mAdvancedCustomizationButton_clicked );
59 setPanelTitle( tr( "Table Properties" ) );
60
61 mContentFontToolButton->setMode( QgsFontButton::ModeTextRenderer );
62 mHeaderFontToolButton->setMode( QgsFontButton::ModeTextRenderer );
63
64 mContentFontToolButton->registerExpressionContextGenerator( this );
65 mHeaderFontToolButton->registerExpressionContextGenerator( this );
66
67 blockAllSignals( true );
68
69 mResizeModeComboBox->addItem( tr( "Use Existing Frames" ), QgsLayoutMultiFrame::UseExistingFrames );
70 mResizeModeComboBox->addItem( tr( "Extend to Next Page" ), QgsLayoutMultiFrame::ExtendToNextPage );
71 mResizeModeComboBox->addItem( tr( "Repeat Until Finished" ), QgsLayoutMultiFrame::RepeatUntilFinished );
72
73 mWrapBehaviorComboBox->addItem( tr( "Truncate Text" ), QgsLayoutTable::TruncateText );
74 mWrapBehaviorComboBox->addItem( tr( "Wrap Text" ), QgsLayoutTable::WrapText );
75
76 mHeaderModeComboBox->addItem( tr( "On First Frame" ), QgsLayoutTable::FirstFrame );
77 mHeaderModeComboBox->addItem( tr( "On All Frames" ), QgsLayoutTable::AllFrames );
78 mHeaderModeComboBox->addItem( tr( "No Header" ), QgsLayoutTable::NoHeaders );
79
80 mHeaderHAlignmentComboBox->addItem( tr( "Follow Column Alignment" ), QgsLayoutTable::FollowColumn );
81 mHeaderHAlignmentComboBox->addItem( tr( "Left" ), QgsLayoutTable::HeaderLeft );
82 mHeaderHAlignmentComboBox->addItem( tr( "Center" ), QgsLayoutTable::HeaderCenter );
83 mHeaderHAlignmentComboBox->addItem( tr( "Right" ), QgsLayoutTable::HeaderRight );
84
85 mGridColorButton->setColorDialogTitle( tr( "Select Grid Color" ) );
86 mGridColorButton->setAllowOpacity( true );
87 mGridColorButton->setContext( QStringLiteral( "composer" ) );
88 mGridColorButton->setDefaultColor( Qt::black );
89 mBackgroundColorButton->setColorDialogTitle( tr( "Select Background Color" ) );
90 mBackgroundColorButton->setAllowOpacity( true );
91 mBackgroundColorButton->setContext( QStringLiteral( "composer" ) );
92 mBackgroundColorButton->setShowNoColor( true );
93 mBackgroundColorButton->setNoColorString( tr( "No Background" ) );
94
95 updateGuiElements();
96
97 if ( mTable )
98 {
99 connect( mTable, &QgsLayoutMultiFrame::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
100 }
101
102 //embed widget for general options
103 if ( mFrame )
104 {
105 //add widget for general composer item properties
106 mItemPropertiesWidget = new QgsLayoutItemPropertiesWidget( this, mFrame );
107 mainLayout->addWidget( mItemPropertiesWidget );
108 }
109
110 connect( mHeaderFontToolButton, &QgsFontButton::changed, this, &QgsLayoutManualTableWidget::headerFontChanged );
111 connect( mContentFontToolButton, &QgsFontButton::changed, this, &QgsLayoutManualTableWidget::contentFontChanged );
112}
113
115{
116 if ( mItemPropertiesWidget )
117 mItemPropertiesWidget->setMasterLayout( masterLayout );
118}
119
121{
122 QgsExpressionContext context;
123
124 // frames include their parent multiframe's context, so prefer that if possible
125 if ( mFrame )
126 context = mFrame->createExpressionContext();
127 else if ( mTable )
128 context = mTable->createExpressionContext();
129
130 auto cellScope = std::make_unique<QgsExpressionContextScope>();
131 cellScope->setVariable( QStringLiteral( "row_number" ), 1, true );
132 cellScope->setVariable( QStringLiteral( "column_number" ), 1, true );
133 context.appendScope( cellScope.release() );
134
135 context.setHighlightedVariables( { QStringLiteral( "row_number" ), QStringLiteral( "column_number" ) } );
136
137 return context;
138}
139
141{
142 QgsLayoutFrame *frame = qobject_cast<QgsLayoutFrame *>( item );
143 if ( !frame )
144 return false;
145
146 QgsLayoutMultiFrame *multiFrame = frame->multiFrame();
147 if ( !multiFrame )
148 return false;
149
150 if ( multiFrame->type() != QgsLayoutItemRegistry::LayoutManualTable )
151 return false;
152
153 if ( mTable )
154 {
155 disconnect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
156 }
157 if ( sEditorDialog && sEditorDialog->table() != mTable )
158 {
159 sEditorDialog->close();
160 }
161
162 mTable = qobject_cast<QgsLayoutItemManualTable *>( multiFrame );
163 mFrame = frame;
164 mItemPropertiesWidget->setItem( frame );
165
166 if ( mTable )
167 {
168 connect( mTable, &QgsLayoutObject::changed, this, &QgsLayoutManualTableWidget::updateGuiElements );
169 }
170
171 updateGuiElements();
172
173 return true;
174}
175
177{
178 QgsLayoutItemManualTable *table = frame ? qobject_cast<QgsLayoutItemManualTable *>( frame->multiFrame() ) : nullptr;
179 if ( !table )
180 {
181 return;
182 }
183
184 if ( sEditorDialog )
185 {
186 // Dialog already exists, and linked to the same table => display it
187 if ( sEditorDialog->table() == table )
188 {
189 // the unholy quadfecta
190 sEditorDialog->show();
191 sEditorDialog->raise();
192 if ( parent )
193 {
194 sEditorDialog->setWindowState( parent->windowState() & ~Qt::WindowMinimized );
195 }
196 sEditorDialog->activateWindow();
197 return;
198 }
199 // Otherwise, close (and delete) the dialog
200 sEditorDialog->close();
201 }
202
203 sEditorDialog = new QgsTableEditorDialog( parent );
204 sEditorDialog->setTable( table );
205
206 connect( frame, &QgsLayoutFrame::destroyed, sEditorDialog, &QMainWindow::close );
207 auto updateName = [frame] { sEditorDialog->setWindowTitle( QString( "%1 - %2 " ).arg( tr( "Table Designer" ) ).arg( frame->displayName() ) ); };
208 connect( frame, &QgsLayoutFrame::changed, sEditorDialog, updateName );
209 updateName();
210
211 if ( parent )
212 connect( parent, &QWidget::destroyed, sEditorDialog, &QMainWindow::close );
213
214 connect( sEditorDialog, &QgsTableEditorDialog::tableChanged, table, [table] {
215 table->beginCommand( tr( "Change Table Contents" ) );
216 table->setTableContents( sEditorDialog->tableContents() );
217
218 const QVariantList headerText = sEditorDialog->tableHeaders();
219 if ( sEditorDialog->includeTableHeader() )
220 {
221 QgsLayoutTableColumns headers;
222 for ( const QVariant &h : headerText )
223 {
224 headers << QgsLayoutTableColumn( h.toString() );
225 }
226 table->setHeaders( headers );
227 }
228
229 const int rowCount = table->tableContents().size();
230 QList<double> rowHeights;
231 rowHeights.reserve( rowCount );
232 for ( int row = 0; row < rowCount; ++row )
233 {
234 rowHeights << sEditorDialog->tableRowHeight( row );
235 }
236 table->setRowHeights( rowHeights );
237
238 if ( !table->tableContents().empty() )
239 {
240 const int columnCount = table->tableContents().at( 0 ).size();
241 QList<double> columnWidths;
242 columnWidths.reserve( columnCount );
243 for ( int col = 0; col < columnCount; ++col )
244 {
245 columnWidths << sEditorDialog->tableColumnWidth( col );
246 }
247 table->setColumnWidths( columnWidths );
248 }
249
250 table->endCommand();
251 } );
252
253 connect( sEditorDialog, &QgsTableEditorDialog::includeHeaderChanged, table, [table]( bool included ) {
254 table->beginCommand( tr( "Change Table Header" ) );
255 table->setIncludeTableHeader( included );
256 table->endCommand();
257 } );
258 sEditorDialog->show();
259}
260
261void QgsLayoutManualTableWidget::setTableContents()
262{
263 openTableDesigner( mFrame, this );
264}
265
266void QgsLayoutManualTableWidget::mMarginSpinBox_valueChanged( double d )
267{
268 if ( !mTable )
269 {
270 return;
271 }
272
273 mTable->beginCommand( tr( "Change Table Margin" ), QgsLayoutMultiFrame::UndoTableMargin );
274 mTable->setCellMargin( d );
275 mTable->endCommand();
276}
277
278void QgsLayoutManualTableWidget::contentFontChanged()
279{
280 if ( !mTable )
281 {
282 return;
283 }
284
285 mTable->beginCommand( tr( "Change Table Font" ) );
286 mTable->setContentTextFormat( mContentFontToolButton->textFormat() );
287 mTable->endCommand();
288}
289
290void QgsLayoutManualTableWidget::mGridStrokeWidthSpinBox_valueChanged( double d )
291{
292 if ( !mTable )
293 {
294 return;
295 }
296
297 mTable->beginCommand( tr( "Change Table Line Width" ), QgsLayoutMultiFrame::UndoTableGridStrokeWidth );
298 mTable->setGridStrokeWidth( d );
299 mTable->endCommand();
300}
301
302void QgsLayoutManualTableWidget::mGridColorButton_colorChanged( const QColor &newColor )
303{
304 if ( !mTable )
305 {
306 return;
307 }
308
309 mTable->beginCommand( tr( "Change Table Grid Color" ), QgsLayoutMultiFrame::UndoTableGridColor );
310 mTable->setGridColor( newColor );
311 mTable->endCommand();
312}
313
314void QgsLayoutManualTableWidget::mDrawHorizontalGrid_toggled( bool state )
315{
316 if ( !mTable )
317 {
318 return;
319 }
320
321 mTable->beginCommand( tr( "Toggle Table Grid" ) );
322 mTable->setHorizontalGrid( state );
323 mTable->endCommand();
324}
325
326void QgsLayoutManualTableWidget::mDrawVerticalGrid_toggled( bool state )
327{
328 if ( !mTable )
329 {
330 return;
331 }
332
333 mTable->beginCommand( tr( "Toggled Table Grid" ) );
334 mTable->setVerticalGrid( state );
335 mTable->endCommand();
336}
337
338void QgsLayoutManualTableWidget::mShowGridGroupCheckBox_toggled( bool state )
339{
340 if ( !mTable )
341 {
342 return;
343 }
344
345 mTable->beginCommand( tr( "Toggle Table Grid" ) );
346 mTable->setShowGrid( state );
347 mTable->endCommand();
348}
349
350void QgsLayoutManualTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged( int )
351{
352 if ( !mTable )
353 {
354 return;
355 }
356
357 mTable->beginCommand( tr( "Change Table Alignment" ) );
358 mTable->setHeaderHAlignment( static_cast<QgsLayoutTable::HeaderHAlignment>( mHeaderHAlignmentComboBox->currentData().toInt() ) );
359 mTable->endCommand();
360}
361
362void QgsLayoutManualTableWidget::mHeaderModeComboBox_currentIndexChanged( int )
363{
364 if ( !mTable )
365 {
366 return;
367 }
368
369 mTable->beginCommand( tr( "Change Table Header Mode" ) );
370 mTable->setHeaderMode( static_cast<QgsLayoutTable::HeaderMode>( mHeaderModeComboBox->currentData().toInt() ) );
371 mTable->endCommand();
372}
373
374void QgsLayoutManualTableWidget::mBackgroundColorButton_colorChanged( const QColor &newColor )
375{
376 if ( !mTable )
377 {
378 return;
379 }
380
381 mTable->beginCommand( tr( "Change Table Color" ), QgsLayoutMultiFrame::UndoTableBackgroundColor );
382 mTable->setBackgroundColor( newColor );
383 mTable->endCommand();
384}
385
386void QgsLayoutManualTableWidget::headerFontChanged()
387{
388 if ( !mTable )
389 return;
390
391 mTable->beginCommand( tr( "Change Table Font" ) );
392 mTable->setHeaderTextFormat( mHeaderFontToolButton->textFormat() );
393 mTable->endCommand();
394}
395
396void QgsLayoutManualTableWidget::updateGuiElements()
397{
398 if ( !mTable || !mFrame )
399 {
400 return;
401 }
402
403 blockAllSignals( true );
404
405 mMarginSpinBox->setValue( mTable->cellMargin() );
406 mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
407 mGridColorButton->setColor( mTable->gridColor() );
408 mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
409 mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
410 if ( mTable->showGrid() )
411 {
412 mShowGridGroupCheckBox->setChecked( true );
413 }
414 else
415 {
416 mShowGridGroupCheckBox->setChecked( false );
417 }
418 mBackgroundColorButton->setColor( mTable->backgroundColor() );
419
420 mHeaderFontToolButton->setTextFormat( mTable->headerTextFormat() );
421 mContentFontToolButton->setTextFormat( mTable->contentTextFormat() );
422
423 mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
424 mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
425
426 mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
427 mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
428
429 mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
430 mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
431
432 mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
433 mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
434
435 blockAllSignals( false );
436}
437
438void QgsLayoutManualTableWidget::blockAllSignals( bool b )
439{
440 mMarginSpinBox->blockSignals( b );
441 mGridColorButton->blockSignals( b );
442 mGridStrokeWidthSpinBox->blockSignals( b );
443 mBackgroundColorButton->blockSignals( b );
444 mDrawHorizontalGrid->blockSignals( b );
445 mDrawVerticalGrid->blockSignals( b );
446 mShowGridGroupCheckBox->blockSignals( b );
447 mResizeModeComboBox->blockSignals( b );
448 mEmptyFrameCheckBox->blockSignals( b );
449 mHideEmptyBgCheckBox->blockSignals( b );
450 mDrawEmptyCheckBox->blockSignals( b );
451 mWrapBehaviorComboBox->blockSignals( b );
452 mContentFontToolButton->blockSignals( b );
453 mHeaderHAlignmentComboBox->blockSignals( b );
454 mHeaderModeComboBox->blockSignals( b );
455 mHeaderFontToolButton->blockSignals( b );
456}
457
458void QgsLayoutManualTableWidget::mEmptyFrameCheckBox_toggled( bool checked )
459{
460 if ( !mFrame )
461 {
462 return;
463 }
464
465 mFrame->beginCommand( tr( "Toggle Empty Frame Mode" ) );
466 mFrame->setHidePageIfEmpty( checked );
467 mFrame->endCommand();
468}
469
470void QgsLayoutManualTableWidget::mHideEmptyBgCheckBox_toggled( bool checked )
471{
472 if ( !mFrame )
473 {
474 return;
475 }
476
477 mFrame->beginCommand( tr( "Toggle Background Display" ) );
478 mFrame->setHideBackgroundIfEmpty( checked );
479 mFrame->endCommand();
480}
481
482void QgsLayoutManualTableWidget::mAddFramePushButton_clicked()
483{
484 if ( !mTable || !mFrame )
485 {
486 return;
487 }
488
489 //create a new frame based on the current frame
490 QPointF pos = mFrame->pos();
491 //shift new frame so that it sits 10 units below current frame
492 pos.ry() += mFrame->rect().height() + 10;
493
494 QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
495 mTable->recalculateFrameSizes();
496
497 //set new frame as selection
498 if ( QgsLayout *layout = mTable->layout() )
499 {
500 layout->setSelectedItem( newFrame );
501 }
502}
503
504void QgsLayoutManualTableWidget::mResizeModeComboBox_currentIndexChanged( int index )
505{
506 if ( !mTable )
507 {
508 return;
509 }
510
511 mTable->beginCommand( tr( "Change Resize Mode" ) );
512 mTable->setResizeMode( static_cast<QgsLayoutMultiFrame::ResizeMode>( mResizeModeComboBox->itemData( index ).toInt() ) );
513 mTable->endCommand();
514
515 mAddFramePushButton->setEnabled( mTable->resizeMode() == QgsLayoutMultiFrame::UseExistingFrames );
516}
517
518void QgsLayoutManualTableWidget::mWrapBehaviorComboBox_currentIndexChanged( int index )
519{
520 if ( !mTable )
521 {
522 return;
523 }
524
525 mTable->beginCommand( tr( "Change Table Wrap Mode" ) );
526 mTable->setWrapBehavior( static_cast<QgsLayoutTable::WrapBehavior>( mWrapBehaviorComboBox->itemData( index ).toInt() ) );
527 mTable->endCommand();
528}
529
530void QgsLayoutManualTableWidget::mAdvancedCustomizationButton_clicked()
531{
532 if ( !mTable )
533 {
534 return;
535 }
536
537 QgsLayoutTableBackgroundColorsDialog d( mTable, this );
538
539 d.exec();
540}
541
542void QgsLayoutManualTableWidget::mDrawEmptyCheckBox_toggled( bool checked )
543{
544 if ( !mTable )
545 {
546 return;
547 }
548
549 mTable->beginCommand( tr( "Change Show Empty Rows" ) );
550 mTable->setShowEmptyRows( checked );
551 mTable->endCommand();
552}
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.
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.
QString displayName() const override
Gets item display name.
QgsLayoutItemBaseWidget(QWidget *parent SIP_TRANSFERTHIS, QgsLayoutObject *layoutObject)
Constructor for QgsLayoutItemBaseWidget, linked with the specified layoutObject.
A layout table subclass that displays manually entered (and formatted) content.
void setColumnWidths(const QList< double > &widths)
Sets the list of column widths (in millimeters) to use when rendering the table.
void setIncludeTableHeader(bool included)
Sets whether the table includes a header row.
void setHeaders(const QgsLayoutTableColumns &headers)
Replaces the headers in the table with a specified list of QgsLayoutTableColumns.
void setTableContents(const QgsTableContents &contents)
Sets the contents of the table.
void setRowHeights(const QList< double > &heights)
Sets the list of row heights (in millimeters) to use when rendering the table.
QgsTableContents tableContents() const
Returns the contents of the table.
A widget for controlling the common properties of layout items (e.g.
@ LayoutManualTable
Manual (fixed) table.
Base class for graphical items within a QgsLayout.
static void openTableDesigner(QgsLayoutFrame *frame, QWidget *parent=nullptr)
Creates and open the table editor dialog.
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.
void endCommand()
Completes the current item command and push it onto the layout's undo stack.
void beginCommand(const QString &commandText, UndoCommand command=UndoNone)
Starts new undo command for this item.
@ 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.
Stores properties of a column 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.
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.
QVector< QgsLayoutTableColumn > QgsLayoutTableColumns
List of column definitions for a QgsLayoutTable.