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