Skip to content
Permalink
Browse files

After creating an item with the add item tool, switch immediately to …

…select tool
  • Loading branch information
nyalldawson committed Oct 10, 2017
1 parent 3678f01 commit c0b63a677867d3682425616a6a6dc45744f49881
@@ -44,6 +44,13 @@ class QgsLayoutViewToolAddItem : QgsLayoutViewTool
virtual void deactivate();


signals:

void createdItem();
%Docstring
Emitted when an item has been created using the tool.
%End

};

/************************************************************************
@@ -236,6 +236,8 @@ QgsLayoutDesignerDialog::QgsLayoutDesignerDialog( QWidget *parent, Qt::WindowFla
mSelectTool->setAction( mActionSelectMoveItem );
mToolsActionGroup->addAction( mActionSelectMoveItem );
connect( mActionSelectMoveItem, &QAction::triggered, mSelectTool, [ = ] { mView->setTool( mSelectTool ); } );
// after creating an item with the add item tool, switch immediately to select tool
connect( mAddItemTool, &QgsLayoutViewToolAddItem::createdItem, this, [ = ] { mView->setTool( mSelectTool ); } );

//Ctrl+= should also trigger zoom in
QShortcut *ctrlEquals = new QShortcut( QKeySequence( QStringLiteral( "Ctrl+=" ) ), this );
@@ -119,6 +119,7 @@ void QgsLayoutViewToolAddItem::layoutReleaseEvent( QgsLayoutViewMouseEvent *even

layout()->addLayoutItem( item );
layout()->setSelectedItem( item );
emit createdItem();
}

void QgsLayoutViewToolAddItem::deactivate()
@@ -53,6 +53,13 @@ class GUI_EXPORT QgsLayoutViewToolAddItem : public QgsLayoutViewTool
void layoutReleaseEvent( QgsLayoutViewMouseEvent *event ) override;
void deactivate() override;

signals:

/**
* Emitted when an item has been created using the tool.
*/
void createdItem();

private:

bool mDrawing = false;

0 comments on commit c0b63a6

Please sign in to comment.
You can’t perform that action at this time.