mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Fix missing page shadows
This commit is contained in:
parent
54acc80d14
commit
b594ecd7c5
@ -91,8 +91,9 @@ will be set to true if string could be successfully interpreted as a
|
||||
page orientation.
|
||||
%End
|
||||
|
||||
virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
|
||||
virtual QRectF boundingRect() const;
|
||||
|
||||
virtual void attemptResize( const QgsLayoutSize &size, bool includesFrame = false );
|
||||
|
||||
virtual QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = 0 ) /Factory/;
|
||||
|
||||
|
@ -32,10 +32,11 @@ QgsLayoutItemPage::QgsLayoutItemPage( QgsLayout *layout )
|
||||
setFlag( QGraphicsItem::ItemIsMovable, false );
|
||||
setZValue( QgsLayout::ZPage );
|
||||
|
||||
// use a hidden pen to specify the amount the page "bleeds" outside it's scene bounds,
|
||||
// (it's a lot easier than reimplementing boundingRect() just to handle this)
|
||||
QPen shadowPen( QBrush( Qt::transparent ), layout->pageCollection()->pageShadowWidth() * 2 );
|
||||
setPen( shadowPen );
|
||||
connect( this, &QgsLayoutItem::sizePositionChanged, this, [ = ]
|
||||
{
|
||||
mBoundingRect = QRectF();
|
||||
prepareGeometryChange();
|
||||
} );
|
||||
|
||||
QFont font;
|
||||
QFontMetrics fm( font );
|
||||
@ -123,6 +124,17 @@ QgsLayoutItemPage::Orientation QgsLayoutItemPage::decodePageOrientation( const Q
|
||||
return Landscape;
|
||||
}
|
||||
|
||||
QRectF QgsLayoutItemPage::boundingRect() const
|
||||
{
|
||||
if ( mBoundingRect.isNull() )
|
||||
{
|
||||
double shadowWidth = mLayout->pageCollection()->pageShadowWidth();
|
||||
mBoundingRect = rect();
|
||||
mBoundingRect.adjust( 0, 0, shadowWidth, shadowWidth );
|
||||
}
|
||||
return mBoundingRect;
|
||||
}
|
||||
|
||||
void QgsLayoutItemPage::attemptResize( const QgsLayoutSize &size, bool includesFrame )
|
||||
{
|
||||
QgsLayoutItem::attemptResize( size, includesFrame );
|
||||
|
@ -121,8 +121,8 @@ class CORE_EXPORT QgsLayoutItemPage : public QgsLayoutItem
|
||||
*/
|
||||
static QgsLayoutItemPage::Orientation decodePageOrientation( const QString &string, bool *ok SIP_OUT = nullptr );
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
void attemptResize( const QgsLayoutSize &size, bool includesFrame = false ) override;
|
||||
|
||||
QgsAbstractLayoutUndoCommand *createCommand( const QString &text, int id, QUndoCommand *parent = nullptr ) override SIP_FACTORY;
|
||||
|
||||
public slots:
|
||||
@ -140,6 +140,7 @@ class CORE_EXPORT QgsLayoutItemPage : public QgsLayoutItem
|
||||
double mMaximumShadowWidth = -1;
|
||||
|
||||
std::unique_ptr< QgsLayoutItemPageGrid > mGrid;
|
||||
mutable QRectF mBoundingRect;
|
||||
|
||||
friend class TestQgsLayoutPage;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user