40 connect( mRefreshPushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked );
41 connect( mAttributesPushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked );
42 connect( mMaximumRowsSpinBox,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged );
43 connect( mMarginSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged );
44 connect( mGridStrokeWidthSpinBox,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged );
46 connect( mBackgroundColorButton, &
QgsColorButton::colorChanged,
this, &QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged );
47 connect( mDrawHorizontalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled );
48 connect( mDrawVerticalGrid, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled );
49 connect( mShowGridGroupCheckBox, &QgsCollapsibleGroupBoxBasic::toggled,
this, &QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled );
50 connect( mShowOnlyVisibleFeaturesCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged );
51 connect( mFeatureFilterCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged );
52 connect( mFeatureFilterEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished );
53 connect( mFeatureFilterButton, &QToolButton::clicked,
this, &QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked );
54 connect( mHeaderHAlignmentComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged );
55 connect( mHeaderModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged );
56 connect( mWrapStringLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished );
57 connect( mAddFramePushButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked );
58 connect( mResizeModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged );
59 connect( mSourceComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged );
60 connect( mRelationsComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged );
61 connect( mEmptyModeComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged );
62 connect( mDrawEmptyCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled );
63 connect( mEmptyMessageLineEdit, &QLineEdit::editingFinished,
this, &QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished );
64 connect( mIntersectAtlasCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged );
65 connect( mUniqueOnlyCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged );
66 connect( mEmptyFrameCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled );
67 connect( mHideEmptyBgCheckBox, &QCheckBox::toggled,
this, &QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled );
68 connect( mWrapBehaviorComboBox,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, &QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged );
69 connect( mAdvancedCustomizationButton, &QPushButton::clicked,
this, &QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked );
70 connect( mUseConditionalStylingCheckBox, &QCheckBox::stateChanged,
this, &QgsLayoutAttributeTableWidget::useConditionalStylingChanged );
76 mContentFontToolButton->registerExpressionContextGenerator(
this );
77 mContentFontToolButton->setLayer( mTable->sourceLayer() );
78 mHeaderFontToolButton->registerExpressionContextGenerator(
this );
79 mHeaderFontToolButton->setLayer( mTable->sourceLayer() );
81 blockAllSignals(
true );
104 toggleAtlasSpecificControls(
static_cast< bool >(
coverageLayer() ) );
112 mComposerMapComboBox->setCurrentLayout( mTable->layout() );
116 mGridColorButton->setColorDialogTitle( tr(
"Select Grid Color" ) );
117 mGridColorButton->setAllowOpacity(
true );
118 mGridColorButton->setContext( QStringLiteral(
"composer" ) );
119 mGridColorButton->setDefaultColor( Qt::black );
120 mBackgroundColorButton->setColorDialogTitle( tr(
"Select Background Color" ) );
121 mBackgroundColorButton->setAllowOpacity(
true );
122 mBackgroundColorButton->setContext( QStringLiteral(
"composer" ) );
123 mBackgroundColorButton->setShowNoColor(
true );
124 mBackgroundColorButton->setNoColorString( tr(
"No Background" ) );
134 this, &QgsLayoutAttributeTableWidget::atlasToggled );
142 mLayerSourceDDBtn->registerExpressionContextGenerator( mTable );
152 mainLayout->addWidget( mItemPropertiesWidget );
155 connect( mHeaderFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::headerFontChanged );
156 connect( mContentFontToolButton, &
QgsFontButton::changed,
this, &QgsLayoutAttributeTableWidget::contentFontChanged );
161 mIntersectAtlasCheckBox->setText( tr(
"Show only features intersecting %1 feature" ).arg(
string ) );
163 if ( atlasFeatureIndex != -1 )
165 mSourceComboBox->setItemText( atlasFeatureIndex, tr(
"Current %1 Feature" ).arg(
string ) );
171 if ( mItemPropertiesWidget )
181 context = mFrame->createExpressionContext();
183 context = mTable->createExpressionContext();
185 std::unique_ptr< QgsExpressionContextScope > cellScope = std::make_unique< QgsExpressionContextScope >();
186 cellScope->setVariable( QStringLiteral(
"row_number" ), 1,
true );
187 cellScope->setVariable( QStringLiteral(
"column_number" ), 1,
true );
191 QStringLiteral(
"column_number" )} );
214 mTable = qobject_cast< QgsLayoutItemAttributeTable * >( multiFrame );
216 mItemPropertiesWidget->
setItem( frame );
229 void QgsLayoutAttributeTableWidget::mRefreshPushButton_clicked()
236 mTable->refreshAttributes();
239 void QgsLayoutAttributeTableWidget::mAttributesPushButton_clicked()
247 QVector<QgsLayoutTableColumn> currentColumns = mTable->columns();
248 QVector<QgsLayoutTableColumn> currentSortColumns = mTable->sortColumns();
250 mTable->beginCommand( tr(
"Change Table Attributes" ) );
253 window()->setUpdatesEnabled(
false );
256 if ( d.exec() == QDialog::Accepted )
258 mTable->refreshAttributes();
260 window()->setUpdatesEnabled(
true );
262 mTable->endCommand();
265 currentColumns.clear();
266 currentSortColumns.clear();
271 mTable->setColumns( currentColumns );
272 mTable->setSortColumns( currentSortColumns );
273 window()->setUpdatesEnabled(
true );
274 mTable->cancelCommand();
278 void QgsLayoutAttributeTableWidget::composerMapChanged(
QgsLayoutItem *item )
285 mTable->beginCommand( tr(
"Change Table Map" ) );
286 mTable->setMap( qobject_cast< QgsLayoutItemMap * >( item ) );
288 mTable->endCommand();
291 void QgsLayoutAttributeTableWidget::mMaximumRowsSpinBox_valueChanged(
int i )
299 mTable->setMaximumNumberOfFeatures( i );
301 mTable->endCommand();
304 void QgsLayoutAttributeTableWidget::mMarginSpinBox_valueChanged(
double d )
312 mTable->setCellMargin( d );
313 mTable->endCommand();
316 void QgsLayoutAttributeTableWidget::headerFontChanged()
321 mTable->beginCommand( tr(
"Change Table Text Format" ) );
322 mTable->setHeaderTextFormat( mHeaderFontToolButton->textFormat() );
323 mTable->endCommand();
326 void QgsLayoutAttributeTableWidget::contentFontChanged()
333 mTable->beginCommand( tr(
"Change Table Text Format" ) );
334 mTable->setContentTextFormat( mContentFontToolButton->textFormat() );
335 mTable->endCommand();
338 void QgsLayoutAttributeTableWidget::mGridStrokeWidthSpinBox_valueChanged(
double d )
346 mTable->setGridStrokeWidth( d );
347 mTable->endCommand();
350 void QgsLayoutAttributeTableWidget::mGridColorButton_colorChanged(
const QColor &newColor )
358 mTable->setGridColor( newColor );
359 mTable->endCommand();
362 void QgsLayoutAttributeTableWidget::mDrawHorizontalGrid_toggled(
bool state )
369 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
370 mTable->setHorizontalGrid( state );
371 mTable->endCommand();
374 void QgsLayoutAttributeTableWidget::mDrawVerticalGrid_toggled(
bool state )
381 mTable->beginCommand( tr(
"Toggled Table Grid" ) );
382 mTable->setVerticalGrid( state );
383 mTable->endCommand();
386 void QgsLayoutAttributeTableWidget::mShowGridGroupCheckBox_toggled(
bool state )
393 mTable->beginCommand( tr(
"Toggle Table Grid" ) );
394 mTable->setShowGrid( state );
395 mTable->endCommand();
398 void QgsLayoutAttributeTableWidget::mBackgroundColorButton_colorChanged(
const QColor &newColor )
406 mTable->setBackgroundColor( newColor );
407 mTable->endCommand();
410 void QgsLayoutAttributeTableWidget::updateGuiElements()
412 if ( !mTable || !mFrame )
417 blockAllSignals(
true );
419 mSourceComboBox->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
420 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
423 if ( mTable->vectorLayer() )
425 mLayerComboBox->setLayer( mTable->vectorLayer() );
429 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
430 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
431 mComposerMapComboBox->setEnabled(
false );
432 mComposerMapLabel->setEnabled(
false );
433 mIntersectAtlasCheckBox->setEnabled(
false );
437 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
438 mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
439 mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
444 mComposerMapComboBox->setItem( mTable->map() );
445 mMaximumRowsSpinBox->setValue( mTable->maximumNumberOfFeatures() );
446 mMarginSpinBox->setValue( mTable->cellMargin() );
447 mGridStrokeWidthSpinBox->setValue( mTable->gridStrokeWidth() );
448 mGridColorButton->setColor( mTable->gridColor() );
449 mDrawHorizontalGrid->setChecked( mTable->horizontalGrid() );
450 mDrawVerticalGrid->setChecked( mTable->verticalGrid() );
451 if ( mTable->showGrid() )
453 mShowGridGroupCheckBox->setChecked(
true );
457 mShowGridGroupCheckBox->setChecked(
false );
459 mBackgroundColorButton->setColor( mTable->backgroundColor() );
461 mHeaderFontToolButton->setTextFormat( mTable->headerTextFormat() );
462 mContentFontToolButton->setTextFormat( mTable->contentTextFormat() );
464 if ( mTable->displayOnlyVisibleFeatures() && mShowOnlyVisibleFeaturesCheckBox->isEnabled() )
466 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Checked );
467 mComposerMapComboBox->setEnabled(
true );
468 mComposerMapLabel->setEnabled(
true );
472 mShowOnlyVisibleFeaturesCheckBox->setCheckState( Qt::Unchecked );
473 mComposerMapComboBox->setEnabled(
false );
474 mComposerMapLabel->setEnabled(
false );
477 mUniqueOnlyCheckBox->setChecked( mTable->uniqueRowsOnly() );
478 mIntersectAtlasCheckBox->setChecked( mTable->filterToAtlasFeature() );
479 mFeatureFilterEdit->setText( mTable->featureFilter() );
480 mFeatureFilterCheckBox->setCheckState( mTable->filterFeatures() ? Qt::Checked : Qt::Unchecked );
481 mFeatureFilterEdit->setEnabled( mTable->filterFeatures() );
482 mFeatureFilterButton->setEnabled( mTable->filterFeatures() );
483 mUseConditionalStylingCheckBox->setChecked( mTable->useConditionalStyling() );
485 mHeaderHAlignmentComboBox->setCurrentIndex( mHeaderHAlignmentComboBox->findData( mTable->headerHAlignment() ) );
486 mHeaderModeComboBox->setCurrentIndex( mHeaderModeComboBox->findData( mTable->headerMode() ) );
488 mEmptyModeComboBox->setCurrentIndex( mEmptyModeComboBox->findData( mTable->emptyTableBehavior() ) );
489 mEmptyMessageLineEdit->setText( mTable->emptyTableMessage() );
492 mDrawEmptyCheckBox->setChecked( mTable->showEmptyRows() );
493 mWrapStringLineEdit->setText( mTable->wrapString() );
494 mWrapBehaviorComboBox->setCurrentIndex( mWrapBehaviorComboBox->findData( mTable->wrapBehavior() ) );
496 mResizeModeComboBox->setCurrentIndex( mResizeModeComboBox->findData( mTable->resizeMode() ) );
499 mEmptyFrameCheckBox->setChecked( mFrame->hidePageIfEmpty() );
500 mHideEmptyBgCheckBox->setChecked( mFrame->hideBackgroundIfEmpty() );
504 toggleSourceControls();
506 blockAllSignals(
false );
509 void QgsLayoutAttributeTableWidget::atlasToggled()
516 toggleAtlasSpecificControls( atlasEnabled );
521 whileBlocking( mSourceComboBox )->setCurrentIndex( mSourceComboBox->findData( mTable->source() ) );
523 if ( !atlasEnabled && mTable->filterToAtlasFeature() )
525 mTable->setFilterToAtlasFeature(
false );
529 void QgsLayoutAttributeTableWidget::updateRelationsCombo()
531 mRelationsComboBox->blockSignals(
true );
532 mRelationsComboBox->clear();
540 mRelationsComboBox->addItem( relation.name(), relation.id() );
544 mRelationsComboBox->setCurrentIndex( mRelationsComboBox->findData( mTable->relationId() ) );
548 mRelationsComboBox->blockSignals(
false );
551 void QgsLayoutAttributeTableWidget::toggleAtlasSpecificControls(
const bool atlasEnabled )
561 mRelationsComboBox->blockSignals(
true );
562 mRelationsComboBox->setEnabled(
false );
563 mRelationsComboBox->clear();
564 mRelationsComboBox->blockSignals(
false );
565 mIntersectAtlasCheckBox->setEnabled(
false );
581 updateRelationsCombo();
582 mRelationsComboBox->setEnabled(
true );
583 mIntersectAtlasCheckBox->setEnabled( mTable->layout()->reportContext().layer() && mTable->layout()->reportContext().layer()->geometryType() !=
QgsWkbTypes::NullGeometry );
587 void QgsLayoutAttributeTableWidget::blockAllSignals(
bool b )
589 mSourceComboBox->blockSignals( b );
590 mLayerComboBox->blockSignals( b );
591 mComposerMapComboBox->blockSignals( b );
592 mMaximumRowsSpinBox->blockSignals( b );
593 mMarginSpinBox->blockSignals( b );
594 mGridColorButton->blockSignals( b );
595 mGridStrokeWidthSpinBox->blockSignals( b );
596 mBackgroundColorButton->blockSignals( b );
597 mDrawHorizontalGrid->blockSignals( b );
598 mDrawVerticalGrid->blockSignals( b );
599 mShowGridGroupCheckBox->blockSignals( b );
600 mShowOnlyVisibleFeaturesCheckBox->blockSignals( b );
601 mUniqueOnlyCheckBox->blockSignals( b );
602 mIntersectAtlasCheckBox->blockSignals( b );
603 mFeatureFilterEdit->blockSignals( b );
604 mFeatureFilterCheckBox->blockSignals( b );
605 mHeaderHAlignmentComboBox->blockSignals( b );
606 mHeaderModeComboBox->blockSignals( b );
607 mResizeModeComboBox->blockSignals( b );
608 mRelationsComboBox->blockSignals( b );
609 mEmptyModeComboBox->blockSignals( b );
610 mEmptyMessageLineEdit->blockSignals( b );
611 mEmptyFrameCheckBox->blockSignals( b );
612 mHideEmptyBgCheckBox->blockSignals( b );
613 mDrawEmptyCheckBox->blockSignals( b );
614 mWrapStringLineEdit->blockSignals( b );
615 mWrapBehaviorComboBox->blockSignals( b );
616 mContentFontToolButton->blockSignals( b );
617 mHeaderFontToolButton->blockSignals( b );
620 void QgsLayoutAttributeTableWidget::setMaximumNumberOfFeatures(
int n )
625 void QgsLayoutAttributeTableWidget::mShowOnlyVisibleFeaturesCheckBox_stateChanged(
int state )
632 mTable->beginCommand( tr(
"Toggle Visible Features Only" ) );
633 const bool showOnlyVisibleFeatures = ( state == Qt::Checked );
634 mTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures );
636 mTable->endCommand();
639 mComposerMapComboBox->setEnabled( state == Qt::Checked );
640 mComposerMapLabel->setEnabled( state == Qt::Checked );
643 void QgsLayoutAttributeTableWidget::mUniqueOnlyCheckBox_stateChanged(
int state )
650 mTable->beginCommand( tr(
"Toggle Table Filter Duplicates" ) );
651 mTable->setUniqueRowsOnly( state == Qt::Checked );
653 mTable->endCommand();
656 void QgsLayoutAttributeTableWidget::mEmptyFrameCheckBox_toggled(
bool checked )
663 mFrame->beginCommand( tr(
"Toggle Empty Frame Mode" ) );
664 mFrame->setHidePageIfEmpty( checked );
665 mFrame->endCommand();
668 void QgsLayoutAttributeTableWidget::mHideEmptyBgCheckBox_toggled(
bool checked )
675 mFrame->beginCommand( tr(
"Toggle Background Display" ) );
676 mFrame->setHideBackgroundIfEmpty( checked );
677 mFrame->endCommand();
680 void QgsLayoutAttributeTableWidget::mIntersectAtlasCheckBox_stateChanged(
int state )
687 mTable->beginCommand( tr(
"Toggle Table Atlas Filter" ) );
688 const bool filterToAtlas = ( state == Qt::Checked );
689 mTable->setFilterToAtlasFeature( filterToAtlas );
691 mTable->endCommand();
694 void QgsLayoutAttributeTableWidget::mFeatureFilterCheckBox_stateChanged(
int state )
701 if ( state == Qt::Checked )
703 mFeatureFilterEdit->setEnabled(
true );
704 mFeatureFilterButton->setEnabled(
true );
708 mFeatureFilterEdit->setEnabled(
false );
709 mFeatureFilterButton->setEnabled(
false );
712 mTable->beginCommand( tr(
"Toggle Table Feature Filter" ) );
713 mTable->setFilterFeatures( state == Qt::Checked );
715 mTable->endCommand();
718 void QgsLayoutAttributeTableWidget::mFeatureFilterEdit_editingFinished()
725 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
726 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
728 mTable->endCommand();
731 void QgsLayoutAttributeTableWidget::mFeatureFilterButton_clicked()
739 QgsExpressionBuilderDialog exprDlg( mTable->sourceLayer(), mFeatureFilterEdit->text(),
this, QStringLiteral(
"generic" ), context );
740 exprDlg.setWindowTitle( tr(
"Expression Based Filter" ) );
741 if ( exprDlg.exec() == QDialog::Accepted )
743 const QString expression = exprDlg.expressionText();
744 if ( !expression.isEmpty() )
746 mFeatureFilterEdit->setText( expression );
747 mTable->beginCommand( tr(
"Change Table Feature Filter" ) );
748 mTable->setFeatureFilter( mFeatureFilterEdit->text() );
750 mTable->endCommand();
755 void QgsLayoutAttributeTableWidget::mHeaderHAlignmentComboBox_currentIndexChanged(
int )
762 mTable->beginCommand( tr(
"Change Table Alignment" ) );
764 mTable->endCommand();
767 void QgsLayoutAttributeTableWidget::mHeaderModeComboBox_currentIndexChanged(
int )
774 mTable->beginCommand( tr(
"Change Table Header Mode" ) );
776 mTable->endCommand();
779 void QgsLayoutAttributeTableWidget::mWrapStringLineEdit_editingFinished()
786 mTable->beginCommand( tr(
"Change Table Wrap String" ) );
787 mTable->setWrapString( mWrapStringLineEdit->text() );
788 mTable->endCommand();
791 void QgsLayoutAttributeTableWidget::changeLayer(
QgsMapLayer *layer )
804 mTable->beginCommand( tr(
"Change Table Layer" ) );
805 mTable->setVectorLayer( vl );
807 mTable->endCommand();
809 mContentFontToolButton->setLayer( vl );
810 mHeaderFontToolButton->setLayer( vl );
815 mShowOnlyVisibleFeaturesCheckBox->setChecked(
false );
816 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
false );
817 mComposerMapComboBox->setEnabled(
false );
818 mComposerMapLabel->setEnabled(
false );
819 mIntersectAtlasCheckBox->setEnabled(
false );
823 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
824 mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
825 mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
830 void QgsLayoutAttributeTableWidget::mAddFramePushButton_clicked()
832 if ( !mTable || !mFrame )
838 QPointF pos = mFrame->pos();
840 pos.ry() += mFrame->rect().height() + 10;
842 QgsLayoutFrame *newFrame = mTable->createNewFrame( mFrame, pos, mFrame->rect().size() );
843 mTable->recalculateFrameSizes();
846 if (
QgsLayout *layout = mTable->layout() )
848 layout->setSelectedItem( newFrame );
852 void QgsLayoutAttributeTableWidget::mResizeModeComboBox_currentIndexChanged(
int index )
859 mTable->beginCommand( tr(
"Change Resize Mode" ) );
861 mTable->endCommand();
866 void QgsLayoutAttributeTableWidget::mSourceComboBox_currentIndexChanged(
int index )
873 mTable->beginCommand( tr(
"Change Table Source" ) );
875 mTable->endCommand();
877 toggleSourceControls();
880 void QgsLayoutAttributeTableWidget::mRelationsComboBox_currentIndexChanged(
int index )
887 mTable->beginCommand( tr(
"Change Table Source Relation" ) );
888 mTable->setRelationId( mRelationsComboBox->itemData( index ).toString() );
889 mTable->endCommand();
892 void QgsLayoutAttributeTableWidget::mEmptyModeComboBox_currentIndexChanged(
int index )
899 mTable->beginCommand( tr(
"Change Empty Table Behavior" ) );
901 mTable->endCommand();
906 void QgsLayoutAttributeTableWidget::mWrapBehaviorComboBox_currentIndexChanged(
int index )
913 mTable->beginCommand( tr(
"Change Table Wrap Mode" ) );
915 mTable->endCommand();
918 void QgsLayoutAttributeTableWidget::mAdvancedCustomizationButton_clicked()
929 void QgsLayoutAttributeTableWidget::useConditionalStylingChanged(
bool checked )
936 mTable->beginCommand( tr(
"Toggle Table Conditional Styling" ) );
937 mTable->setUseConditionalStyling( checked );
939 mTable->endCommand();
942 void QgsLayoutAttributeTableWidget::mDrawEmptyCheckBox_toggled(
bool checked )
949 mTable->beginCommand( tr(
"Change Show Empty Rows" ) );
950 mTable->setShowEmptyRows( checked );
951 mTable->endCommand();
954 void QgsLayoutAttributeTableWidget::mEmptyMessageLineEdit_editingFinished()
961 mTable->beginCommand( tr(
"Change Empty Table Message" ) );
962 mTable->setEmptyTableMessage( mEmptyMessageLineEdit->text() );
963 mTable->endCommand();
966 void QgsLayoutAttributeTableWidget::toggleSourceControls()
968 switch ( mTable->source() )
971 mLayerComboBox->setEnabled(
true );
972 mLayerComboBox->setVisible(
true );
973 mLayerSourceDDBtn->setVisible(
true );
974 mLayerLabel->setVisible(
true );
975 mRelationsComboBox->setEnabled(
false );
976 mRelationsComboBox->setVisible(
false );
977 mRelationLabel->setVisible(
false );
978 mMaximumRowsSpinBox->setEnabled(
true );
979 mMaxNumFeaturesLabel->setEnabled(
true );
980 mShowOnlyVisibleFeaturesCheckBox->setEnabled( mTable->vectorLayer() && mTable->vectorLayer()->geometryType() !=
QgsWkbTypes::NullGeometry );
981 mShowOnlyVisibleFeaturesCheckBox->setChecked( mTable->vectorLayer() && mTable->vectorLayer()->geometryType() !=
QgsWkbTypes::NullGeometry && mTable->displayOnlyVisibleFeatures() );
982 mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
983 mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
984 mIntersectAtlasCheckBox->setEnabled( mTable->vectorLayer() && mTable->vectorLayer()->geometryType() !=
QgsWkbTypes::NullGeometry
988 mLayerComboBox->setEnabled(
false );
989 mLayerComboBox->setVisible(
false );
990 mLayerSourceDDBtn->setVisible(
false );
991 mLayerLabel->setVisible(
false );
992 mRelationsComboBox->setEnabled(
false );
993 mRelationsComboBox->setVisible(
false );
994 mRelationLabel->setVisible(
false );
995 mMaximumRowsSpinBox->setEnabled(
false );
996 mMaxNumFeaturesLabel->setEnabled(
false );
997 mShowOnlyVisibleFeaturesCheckBox->setEnabled( mTable->sourceLayer() && mTable->sourceLayer()->geometryType() !=
QgsWkbTypes::NullGeometry );
998 mShowOnlyVisibleFeaturesCheckBox->setChecked( mTable->sourceLayer() && mTable->sourceLayer()->geometryType() !=
QgsWkbTypes::NullGeometry && mTable->displayOnlyVisibleFeatures() );
999 mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
1000 mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
1001 mIntersectAtlasCheckBox->setEnabled(
false );
1004 mLayerComboBox->setEnabled(
false );
1005 mLayerComboBox->setVisible(
false );
1006 mLayerLabel->setVisible(
false );
1007 mLayerSourceDDBtn->setVisible(
false );
1008 mRelationsComboBox->setEnabled(
true );
1009 mRelationsComboBox->setVisible(
true );
1010 mRelationLabel->setVisible(
true );
1011 mMaximumRowsSpinBox->setEnabled(
true );
1012 mMaxNumFeaturesLabel->setEnabled(
true );
1014 mShowOnlyVisibleFeaturesCheckBox->setEnabled(
true );
1015 mComposerMapComboBox->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );
1016 mComposerMapLabel->setEnabled( mShowOnlyVisibleFeaturesCheckBox->isChecked() );