Skip to content

Commit

Permalink
Fix project retrieval for QgsReport
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent f4a99b6 commit 6db2432
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/layout/qgsabstractreportsection.cpp
Expand Up @@ -33,6 +33,9 @@ QgsAbstractReportSection::~QgsAbstractReportSection()

QgsProject *QgsAbstractReportSection::project()
{
if ( QgsReport *report = dynamic_cast< QgsReport * >( this ) )
return report->layoutProject();

QgsAbstractReportSection *current = this;
while ( QgsAbstractReportSection *parent = current->parentSection() )
{
Expand Down
1 change: 1 addition & 0 deletions tests/src/python/test_qgsreport.py
Expand Up @@ -37,6 +37,7 @@ def testGettersSetters(self):
r = QgsReport(p)

self.assertEqual(r.layoutProject(), p)
self.assertEqual(r.project(), p)

r.setHeaderEnabled(True)
self.assertTrue(r.headerEnabled())
Expand Down

0 comments on commit 6db2432

Please sign in to comment.