mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
allow to copy all line measurements at once (fix #20498)
This commit is contained in:
parent
0348ab0dd6
commit
c942185947
@ -27,6 +27,7 @@
|
||||
#include "qgssettings.h"
|
||||
#include "qgsgui.h"
|
||||
|
||||
#include <QClipboard>
|
||||
#include <QCloseEvent>
|
||||
#include <QLocale>
|
||||
#include <QPushButton>
|
||||
@ -55,6 +56,13 @@ QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool *tool, Qt::WindowFlags f )
|
||||
buttonBox->addButton( cb, QDialogButtonBox::ActionRole );
|
||||
connect( cb, &QAbstractButton::clicked, this, &QgsMeasureDialog::openConfigTab );
|
||||
|
||||
if ( !mMeasureArea )
|
||||
{
|
||||
QPushButton *cpb = new QPushButton( tr( "Copy &All" ) );
|
||||
buttonBox->addButton( cpb, QDialogButtonBox::ActionRole );
|
||||
connect( cpb, &QAbstractButton::clicked, this, &QgsMeasureDialog::copyMeasurements );
|
||||
}
|
||||
|
||||
repopulateComboBoxUnits( mMeasureArea );
|
||||
if ( mMeasureArea )
|
||||
{
|
||||
@ -646,6 +654,18 @@ double QgsMeasureDialog::convertArea( double area, QgsUnitTypes::AreaUnit toUnit
|
||||
return mDa.convertAreaMeasurement( area, toUnit );
|
||||
}
|
||||
|
||||
void QgsMeasureDialog::copyMeasurements()
|
||||
{
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
QString text;
|
||||
QTreeWidgetItemIterator it( mTable );
|
||||
while ( *it )
|
||||
{
|
||||
text += ( *it )->text( 0 ) + QStringLiteral( "\n" );
|
||||
it++;
|
||||
}
|
||||
clipboard->setText( text );
|
||||
}
|
||||
|
||||
void QgsMeasureDialog::reject()
|
||||
{
|
||||
|
@ -70,6 +70,9 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
|
||||
//! Open configuration tab
|
||||
void openConfigTab();
|
||||
|
||||
//! Copy measurements to the clipboard
|
||||
void copyMeasurements();
|
||||
|
||||
void crsChanged();
|
||||
|
||||
void projChanged();
|
||||
|
Loading…
x
Reference in New Issue
Block a user