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