Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add context menu and feedback message
  • Loading branch information
YoannQDQ committed Apr 17, 2023
1 parent cb9669e commit f933a51
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/qgsmeasuredialog.cpp
Expand Up @@ -15,6 +15,7 @@
***************************************************************************/

#include "qgisapp.h"
#include "qgsmessagebar.h"
#include "qgsmeasuredialog.h"
#include "qgsmeasuretool.h"
#include "qgsdistancearea.h"
Expand Down Expand Up @@ -56,9 +57,15 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool *tool, Qt::WindowFlags f )

if ( !mMeasureArea )
{
QAction *copyAction = new QAction( tr( "Copy &All" ), this );
QPushButton *cpb = new QPushButton( tr( "Copy &All" ) );
buttonBox->addButton( cpb, QDialogButtonBox::ActionRole );
connect( cpb, &QAbstractButton::clicked, this, &QgsMeasureDialog::copyMeasurements );
connect( cpb, &QAbstractButton::clicked, copyAction, &QAction::trigger );
connect( copyAction, &QAction::triggered, this, &QgsMeasureDialog::copyMeasurements );

// Add context menu in the table
mTable->setContextMenuPolicy( Qt::ActionsContextMenu );
mTable->addAction( copyAction );
}
else
{
Expand Down Expand Up @@ -754,6 +761,9 @@ void QgsMeasureDialog::copyMeasurements()
}

clipboard->setText( text );

// Display a message to the user
QgisApp::instance()->messageBar()->pushInfo( tr( "Measure" ), tr( "Measurements copied to clipboard" ) );
}

void QgsMeasureDialog::reject()
Expand Down

0 comments on commit f933a51

Please sign in to comment.