Skip to content

Commit

Permalink
add copy button
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian committed Jun 2, 2024
1 parent 603b7a8 commit 63e63d4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/qgsabout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "qgsauthmethodregistry.h"
#include "qgsproviderregistry.h"
#include "qgslogger.h"
#include <QClipboard>
#include <QDesktopServices>
#include <QFile>
#include <QTextStream>
Expand All @@ -43,6 +44,7 @@ QgsAbout::QgsAbout( QWidget *parent )
setupUi( this );
connect( btnQgisUser, &QPushButton::clicked, this, &QgsAbout::btnQgisUser_clicked );
connect( btnQgisHome, &QPushButton::clicked, this, &QgsAbout::btnQgisHome_clicked );
connect( btnCopyToClipboard, &QPushButton::clicked, this, &QgsAbout::btnCopyToClipboard_clicked );
if constexpr( QSysInfo::WordSize != 64 )
{
// 64 bit is the current standard. Only specify word size if it is not 64.
Expand Down Expand Up @@ -271,6 +273,12 @@ void QgsAbout::setPluginInfo()
txtProviders->setText( myString );
}

void QgsAbout::btnCopyToClipboard_clicked()
{
QString markdown = txtVersion->toHtml();
QGuiApplication::clipboard()->setText( markdown );
}

void QgsAbout::btnQgisUser_clicked()
{
openUrl( QStringLiteral( "https://lists.osgeo.org/mailman/listinfo/qgis-user" ) );
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsabout.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class APP_EXPORT QgsAbout : public QgsOptionsDialogBase, private Ui::QgsAbout
void init();

private slots:
void btnCopyToClipboard_clicked();
void btnQgisUser_clicked();
void btnQgisHome_clicked();
void openUrl( const QUrl &url );
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsabout.ui
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnCopyToClipboard">
<property name="text">
<string>Copy to Clipboard</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
Expand Down

0 comments on commit 63e63d4

Please sign in to comment.