eric7/WebBrowser/QtHelp/HelpIndexWidget.py

branch
eric7
changeset 8704
e4042abf2a5b
parent 8693
d51660d6f1b9
child 8881
54e42bc2437a
diff -r 3f1f67a9b179 -r e4042abf2a5b eric7/WebBrowser/QtHelp/HelpIndexWidget.py
--- a/eric7/WebBrowser/QtHelp/HelpIndexWidget.py	Wed Oct 20 19:44:20 2021 +0200
+++ b/eric7/WebBrowser/QtHelp/HelpIndexWidget.py	Wed Oct 20 19:45:22 2021 +0200
@@ -8,6 +8,7 @@
 """
 
 from PyQt6.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl, QEvent
+from PyQt6.QtGui import QGuiApplication, QClipboard
 from PyQt6.QtHelp import QHelpLink
 from PyQt6.QtWidgets import (
     QWidget, QVBoxLayout, QHBoxLayout, QLabel, QLineEdit, QMenu, QDialog,
@@ -241,7 +242,8 @@
                 newBackgroundTab = menu.addAction(
                     self.tr("Open Link in Background Tab"))
                 newWindow = menu.addAction(self.tr("Open Link in New Window"))
-            # TODO: add link to copy the URL
+            menu.addSeparator()
+            copyLink = menu.addAction(self.tr("Copy URL to Clipboard"))
             menu.move(self.__index.mapToGlobal(pos))
             
             act = menu.exec()
@@ -263,3 +265,9 @@
                         self.newBackgroundTab.emit(link)
                     elif not self.__internal and act == newWindow:
                         self.newWindow.emit(link)
+                    elif act == copyLink:
+                        # copy the URL to both clipboard areas
+                        QGuiApplication.clipboard().setText(
+                            link.toString(), QClipboard.Mode.Clipboard)
+                        QGuiApplication.clipboard().setText(
+                            link.toString(), QClipboard.Mode.Selection)

eric ide

mercurial