Skip to content

Commit

Permalink
fix: tag double click emits search (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
yedpodtrzitko authored Nov 24, 2024
1 parent e3cdd19 commit 911306e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tagstudio/src/qt/widgets/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ def __init__(
self.bg_button = QPushButton(self)
self.bg_button.setFlat(True)
self.bg_button.setText(tag.name)
self.bg_button.clicked.connect(self.on_click.emit)
self.bg_button.mouseDoubleClickEvent = lambda event: self.on_double_click.emit() # type: ignore

if has_edit:
edit_action = QAction("Edit", self)
edit_action.triggered.connect(on_edit_callback)
Expand All @@ -137,8 +140,6 @@ def __init__(
search_for_tag_action = QAction("Search for Tag", self)
search_for_tag_action.triggered.connect(self.on_click.emit)
self.bg_button.addAction(search_for_tag_action)
add_to_search_action = QAction("Add to Search", self)
self.bg_button.addAction(add_to_search_action)

self.inner_layout = QHBoxLayout()
self.inner_layout.setObjectName("innerLayout")
Expand Down Expand Up @@ -190,11 +191,6 @@ def __init__(
self.inner_layout.addWidget(self.remove_button)
self.inner_layout.addStretch(1)

# NOTE: Do this if you don't want the tag to stretch, like in a search.
# self.bg_button.setMaximumWidth(self.bg_button.sizeHint().width())

self.bg_button.clicked.connect(self.on_click.emit)

def enterEvent(self, event: QEnterEvent) -> None: # noqa: N802
if self.has_remove:
self.remove_button.setHidden(False)
Expand Down

0 comments on commit 911306e

Please sign in to comment.