@@ -61,6 +61,8 @@ QgsLayoutLegendWidget::QgsLayoutLegendWidget( QgsLayoutItemLegend *legend )
61
61
: QgsLayoutItemBaseWidget( nullptr , legend )
62
62
, mLegend( legend )
63
63
{
64
+ Q_ASSERT ( mLegend );
65
+
64
66
setupUi ( this );
65
67
connect ( mWrapCharLineEdit , &QLineEdit::textChanged, this , &QgsLayoutLegendWidget::mWrapCharLineEdit_textChanged );
66
68
connect ( mTitleLineEdit , &QLineEdit::textChanged, this , &QgsLayoutLegendWidget::mTitleLineEdit_textChanged );
@@ -120,8 +122,7 @@ QgsLayoutLegendWidget::QgsLayoutLegendWidget( QgsLayoutItemLegend *legend )
120
122
mRasterStrokeColorButton ->setAllowOpacity ( true );
121
123
mRasterStrokeColorButton ->setContext ( QStringLiteral ( " composer " ) );
122
124
123
- if ( legend )
124
- mMapComboBox ->setCurrentLayout ( legend->layout () );
125
+ mMapComboBox ->setCurrentLayout ( legend->layout () );
125
126
mMapComboBox ->setItemType ( QgsLayoutItemRegistry::LayoutMap );
126
127
connect ( mMapComboBox , &QgsLayoutItemComboBox::itemChanged, this , &QgsLayoutLegendWidget::composerMapChanged );
127
128
@@ -131,18 +132,15 @@ QgsLayoutLegendWidget::QgsLayoutLegendWidget( QgsLayoutItemLegend *legend )
131
132
132
133
mItemTreeView ->setHeaderHidden ( true );
133
134
134
- if ( legend )
135
- {
136
- mItemTreeView ->setModel ( legend->model () );
137
- mItemTreeView ->setMenuProvider ( new QgsLayoutLegendMenuProvider ( mItemTreeView , this ) );
138
- connect ( legend, &QgsLayoutObject::changed, this , &QgsLayoutLegendWidget::setGuiElements );
135
+ mItemTreeView ->setModel ( legend->model () );
136
+ mItemTreeView ->setMenuProvider ( new QgsLayoutLegendMenuProvider ( mItemTreeView , this ) );
137
+ connect ( legend, &QgsLayoutObject::changed, this , &QgsLayoutLegendWidget::setGuiElements );
139
138
140
139
#if 0 //TODO
141
- // connect atlas state to the filter legend by atlas checkbox
142
- connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::toggled, this, &QgsLayoutLegendWidget::updateFilterLegendByAtlasButton );
143
- connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::coverageLayerChanged, this, &QgsLayoutLegendWidget::updateFilterLegendByAtlasButton );
140
+ // connect atlas state to the filter legend by atlas checkbox
141
+ connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::toggled, this, &QgsLayoutLegendWidget::updateFilterLegendByAtlasButton );
142
+ connect( &legend->composition()->atlasComposition(), &QgsAtlasComposition::coverageLayerChanged, this, &QgsLayoutLegendWidget::updateFilterLegendByAtlasButton );
144
143
#endif
145
- }
146
144
147
145
registerDataDefinedButton ( mLegendTitleDDBtn , QgsLayoutObject::LegendTitle );
148
146
registerDataDefinedButton ( mColumnsDDBtn , QgsLayoutObject::LegendColumnCount );
0 commit comments