Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Marble
Commits
2d9d2635
Commit
2d9d2635
authored
Aug 30, 2021
by
Sergey Alirzaev
Committed by
Johannes Zarl-Zierl
Oct 16, 2021
Browse files
Allow copying coordinates as a geo: URL
parent
8aadc3eb
Pipeline
#89235
passed with stage
in 5 minutes and 27 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
src/lib/marble/MarbleWidgetPopupMenu.cpp
View file @
2d9d2635
...
...
@@ -72,6 +72,7 @@ public:
QAction
*
m_directionsToHereAction
;
QAction
*
const
m_copyCoordinateAction
;
QAction
*
const
m_copyGeoAction
;
QAction
*
m_rmbExtensionPoint
;
...
...
@@ -108,6 +109,7 @@ MarbleWidgetPopupMenu::Private::Private( MarbleWidget *widget, const MarbleModel
m_directionsFromHereAction
(
nullptr
),
m_directionsToHereAction
(
nullptr
),
m_copyCoordinateAction
(
new
QAction
(
QIcon
(
QStringLiteral
(
":/icons/copy-coordinates.png"
)),
tr
(
"Copy Coordinates"
),
parent
)),
m_copyGeoAction
(
new
QAction
(
QIcon
(
QStringLiteral
(
":/icons/copy-coordinates.png"
)),
tr
(
"Copy geo: URL"
),
parent
)),
m_rmbExtensionPoint
(
nullptr
),
m_runnerManager
(
model
)
{
...
...
@@ -145,6 +147,7 @@ MarbleWidgetPopupMenu::Private::Private( MarbleWidget *widget, const MarbleModel
m_rmbMenu
.
addAction
(
addBookmark
);
if
(
!
smallScreen
)
{
m_rmbMenu
.
addAction
(
m_copyCoordinateAction
);
m_rmbMenu
.
addAction
(
m_copyGeoAction
);
}
m_rmbMenu
.
addAction
(
QIcon
(
QStringLiteral
(
":/icons/addressbook-details.png"
)),
tr
(
"&Address Details"
),
parent
,
SLOT
(
startReverseGeocoding
()));
m_rmbMenu
.
addSeparator
();
...
...
@@ -162,6 +165,7 @@ MarbleWidgetPopupMenu::Private::Private( MarbleWidget *widget, const MarbleModel
parent
->
connect
(
addBookmark
,
SIGNAL
(
triggered
()),
SLOT
(
addBookmark
())
);
parent
->
connect
(
aboutDialogAction
,
SIGNAL
(
triggered
()),
SLOT
(
slotAboutDialog
())
);
parent
->
connect
(
m_copyCoordinateAction
,
SIGNAL
(
triggered
()),
SLOT
(
slotCopyCoordinates
())
);
parent
->
connect
(
m_copyGeoAction
,
SIGNAL
(
triggered
()),
SLOT
(
slotCopyGeo
())
);
parent
->
connect
(
m_infoDialogAction
,
SIGNAL
(
triggered
()),
SLOT
(
slotInfoDialog
())
);
parent
->
connect
(
fullscreenAction
,
SIGNAL
(
triggered
(
bool
)),
parent
,
SLOT
(
toggleFullscreen
(
bool
))
);
...
...
@@ -618,6 +622,7 @@ void MarbleWidgetPopupMenu::showRmbMenu( int xpos, int ypos )
QPoint
curpos
=
QPoint
(
xpos
,
ypos
);
d
->
m_copyCoordinateAction
->
setData
(
curpos
);
d
->
m_copyGeoAction
->
setData
(
curpos
);
bool
const
showDirectionButtons
=
d
->
m_widget
->
routingLayer
()
&&
d
->
m_widget
->
routingLayer
()
->
isInteractive
();
d
->
m_directionsFromHereAction
->
setVisible
(
showDirectionButtons
);
...
...
@@ -786,6 +791,22 @@ void MarbleWidgetPopupMenu::slotCopyCoordinates()
}
}
void
MarbleWidgetPopupMenu
::
slotCopyGeo
()
{
const
GeoDataCoordinates
coordinates
=
d
->
mouseCoordinates
(
d
->
m_copyCoordinateAction
);
if
(
coordinates
.
isValid
()
)
{
const
qreal
latitude_degrees
=
coordinates
.
latitude
(
GeoDataCoordinates
::
Degree
);
const
qreal
longitude_degrees
=
coordinates
.
longitude
(
GeoDataCoordinates
::
Degree
);
QMimeData
*
const
myMimeData
=
new
QMimeData
();
QList
<
QUrl
>
urls
=
{
QUrl
(
QString
(
"geo:%1,%2"
).
arg
(
latitude_degrees
,
0
,
'f'
,
10
).
arg
(
longitude_degrees
,
0
,
'f'
,
10
))
};
myMimeData
->
setUrls
(
urls
);
QClipboard
*
const
clipboard
=
QApplication
::
clipboard
();
clipboard
->
setMimeData
(
myMimeData
);
}
}
void
MarbleWidgetPopupMenu
::
slotAboutDialog
()
{
QPointer
<
MarbleAboutDialog
>
dialog
=
new
MarbleAboutDialog
(
d
->
m_widget
);
...
...
src/lib/marble/MarbleWidgetPopupMenu.h
View file @
2d9d2635
...
...
@@ -54,6 +54,7 @@ private Q_SLOTS:
void
resetMenu
();
void
slotInfoDialog
();
void
slotCopyCoordinates
();
void
slotCopyGeo
();
void
slotAboutDialog
();
private
Q_SLOTS
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment