Skip to content

Commit

Permalink
Explicitly disable remove button if no child report section is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent 01ce9bc commit b184c5e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/layout/qgsreportorganizerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ QgsReportOrganizerWidget::QgsReportOrganizerWidget( QWidget *parent, QgsLayoutDe

mButtonAddSection->setMenu( addMenu );
connect( mButtonRemoveSection, &QPushButton::clicked, this, &QgsReportOrganizerWidget::removeSection );
mButtonRemoveSection->setEnabled( false ); //disable until section clicked
}

void QgsReportOrganizerWidget::setMessageBar( QgsMessageBar *bar )
Expand Down Expand Up @@ -112,6 +113,9 @@ void QgsReportOrganizerWidget::selectionChanged( const QModelIndex &current, con
if ( !parent )
parent = mReport;

// report cannot be deleted
mButtonRemoveSection->setEnabled( parent != mReport );

delete mConfigWidget;
if ( QgsReportSectionLayout *section = dynamic_cast< QgsReportSectionLayout * >( parent ) )
{
Expand Down

0 comments on commit b184c5e

Please sign in to comment.