Skip to content

Commit

Permalink
Correctly report selected status to items model
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 6, 2017
1 parent 62a5679 commit 683a869
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/core/layout/qgslayoutitem.sip
Expand Up @@ -108,6 +108,11 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
.. seealso:: uuid()
%End

virtual void setSelected( bool selected );
%Docstring
Sets whether the item should be selected.
%End

void setLocked( const bool locked );
%Docstring
Sets whether the item is ``locked``, preventing mouse interactions with the item.
Expand Down
10 changes: 10 additions & 0 deletions src/core/layout/qgslayoutitem.cpp
Expand Up @@ -96,6 +96,16 @@ void QgsLayoutItem::setId( const QString &id )
#endif
}

void QgsLayoutItem::setSelected( bool selected )
{
QGraphicsRectItem::setSelected( selected );
//inform model that id data has changed
if ( mLayout )
{
mLayout->itemsModel()->updateItemSelectStatus( this );
}
}

void QgsLayoutItem::setLocked( const bool locked )
{
if ( locked == mIsLocked )
Expand Down
5 changes: 5 additions & 0 deletions src/core/layout/qgslayoutitem.h
Expand Up @@ -128,6 +128,11 @@ class CORE_EXPORT QgsLayoutItem : public QgsLayoutObject, public QGraphicsRectIt
*/
virtual void setId( const QString &id );

/**
* Sets whether the item should be selected.
*/
virtual void setSelected( bool selected );

/**
* Sets whether the item is \a locked, preventing mouse interactions with the item.
* \see isLocked()
Expand Down

0 comments on commit 683a869

Please sign in to comment.