Update indentation

This commit is contained in:
Nyall Dawson 2017-11-24 14:57:39 +10:00
parent 6ec96d6d8e
commit 32834e9bf1
10 changed files with 233 additions and 193 deletions

View File

@ -221,9 +221,9 @@ class QgsLayoutItemHtml: QgsLayoutMultiFrame
%Docstring %Docstring
Recalculates the frame sizes for the current viewport dimensions Recalculates the frame sizes for the current viewport dimensions
%End %End
void refreshExpressionContext();
void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
protected: protected:

View File

@ -266,6 +266,12 @@ class QgsLayoutMultiFrame: QgsLayoutObject, QgsLayoutUndoObjectInterface
public slots: public slots:
virtual void refresh();
%Docstring
Refreshes the multiframe, causing a recalculation of any property overrides.
%End
void update(); void update();
%Docstring %Docstring
Forces a redraw of all child frames. Forces a redraw of all child frames.
@ -290,6 +296,14 @@ class QgsLayoutMultiFrame: QgsLayoutObject, QgsLayoutUndoObjectInterface
.. seealso:: recalculateFrameSizes .. seealso:: recalculateFrameSizes
%End %End
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
%Docstring
Refreshes a data defined ``property`` for the multi frame by reevaluating the property's value
and redrawing the item with this new value. If ``property`` is set to
QgsLayoutObject.AllProperties then all data defined properties for the item will be
refreshed.
%End
signals: signals:
void changed(); void changed();

View File

@ -31,6 +31,7 @@ class APP_EXPORT QgsCrashHandler
{ {
public: public:
/** /**
* This class doesn't need to be created by anyone as is only used to handle * This class doesn't need to be created by anyone as is only used to handle
* crashes in the application. * crashes in the application.

View File

@ -224,9 +224,8 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame
//! Recalculates the frame sizes for the current viewport dimensions //! Recalculates the frame sizes for the current viewport dimensions
void recalculateFrameSizes() override; void recalculateFrameSizes() override;
void refreshExpressionContext();
void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ); void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties ) override;
protected: protected:
@ -273,6 +272,8 @@ class CORE_EXPORT QgsLayoutItemHtml: public QgsLayoutMultiFrame
//! Calculates the max width of frames in the html multiframe //! Calculates the max width of frames in the html multiframe
double maxFrameWidth() const; double maxFrameWidth() const;
void refreshExpressionContext();
}; };
#endif // QGSLAYOUTITEMHTML_H #endif // QGSLAYOUTITEMHTML_H

View File

@ -233,6 +233,11 @@ void QgsLayoutMultiFrame::recalculateFrameRects()
} }
} }
void QgsLayoutMultiFrame::refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty )
{
}
QgsLayoutFrame *QgsLayoutMultiFrame::createNewFrame( QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size ) QgsLayoutFrame *QgsLayoutMultiFrame::createNewFrame( QgsLayoutFrame *currentFrame, QPointF pos, QSizeF size )
{ {
if ( !currentFrame ) if ( !currentFrame )
@ -289,6 +294,12 @@ void QgsLayoutMultiFrame::cancelCommand()
mLayout->undoStack()->cancelCommand(); mLayout->undoStack()->cancelCommand();
} }
void QgsLayoutMultiFrame::refresh()
{
QgsLayoutObject::refresh();
refreshDataDefinedProperty();
}
void QgsLayoutMultiFrame::handleFrameRemoval() void QgsLayoutMultiFrame::handleFrameRemoval()
{ {
if ( mBlockUpdates ) if ( mBlockUpdates )

View File

@ -278,6 +278,11 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject, public QgsLayoutU
public slots: public slots:
/**
* Refreshes the multiframe, causing a recalculation of any property overrides.
*/
void refresh() override;
/** /**
* Forces a redraw of all child frames. * Forces a redraw of all child frames.
*/ */
@ -302,6 +307,14 @@ class CORE_EXPORT QgsLayoutMultiFrame: public QgsLayoutObject, public QgsLayoutU
*/ */
void recalculateFrameRects(); void recalculateFrameRects();
/**
* Refreshes a data defined \a property for the multi frame by reevaluating the property's value
* and redrawing the item with this new value. If \a property is set to
* QgsLayoutObject::AllProperties then all data defined properties for the item will be
* refreshed.
*/
virtual void refreshDataDefinedProperty( const QgsLayoutObject::DataDefinedProperty property = QgsLayoutObject::AllProperties );
signals: signals:
/** /**

View File

@ -201,7 +201,7 @@ class TestQgsLayoutPageCollection(unittest.TestCase):
# add a page # add a page
page = QgsLayoutItemPage(l) page = QgsLayoutItemPage(l)
page.setPageSize(QgsLayoutSize(10,10)) page.setPageSize(QgsLayoutSize(10, 10))
collection.addPage(page) collection.addPage(page)
self.assertEqual(collection.pageCount(), 1) self.assertEqual(collection.pageCount(), 1)