Skip to content

Commit cbbf680

Browse files
committed
복사시 링크 복사 기능 추가
1 parent bbf03c5 commit cbbf680

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

main.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ def filtering(self, keyword) -> None:
438438
# print(keyword)
439439

440440
def keyPressEvent(self, event: PyQt5.QtGui.QKeyEvent) -> None:
441+
global parser
442+
441443
# Ctrl + C 누른 경우 Table의 내용 복사
442444
# https://stackoverflow.com/questions/60715462/how-to-copy-and-paste-multiple-cells-in-qtablewidget-in-pyqt5
443445
if event.key() == Qt.Key.Key_C and (event.modifiers() & Qt.KeyboardModifier.ControlModifier): # type: ignore
@@ -447,6 +449,16 @@ def keyPressEvent(self, event: PyQt5.QtGui.QKeyEvent) -> None:
447449
copy_text = ''
448450
max_column = copied_cells[-1].column()
449451
for c in copied_cells:
452+
# 링크도 복사
453+
if c.column() == 0 and parser:
454+
all_link = parser.get_link_list()
455+
article_id = self.articleView.item(c.row(), 0).text()
456+
457+
target_link = all_link[article_id]
458+
# print(all_link, article_id)
459+
# print(target_link)
460+
copy_text += (target_link + '\t')
461+
450462
copy_text += self.articleView.item(c.row(), c.column()).text()
451463
if c.column() == max_column:
452464
copy_text += '\n'

0 commit comments

Comments
 (0)