fix(jira-knowledge): use QDialog popup instead of QFrame+Qt.Popup for macOS compatibility

Qt.Popup flag is unreliable on macOS inside QDialog parents — popup may
appear behind the parent or not receive clicks. Replace with a small
QDialog using Qt.Tool|Qt.FramelessWindowHint which is stable on macOS.

- Add explicit close button (✕) in the popup
- Call activateWindow() to ensure popup gets focus
- Position 4px below the help button for visual separation

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
thanhnv
2026-09-08 10:16:47 +09:00
co-authored by Claude Opus 5
parent 0cb6035863
commit c2a9ea22f3
+30 -10
View File
@@ -191,38 +191,58 @@ class JiraConnectDialog(QDialog):
def _toggle_help_popup(self) -> None:
"""Show/hide a floating help popup when the ? button is clicked."""
if self._help_popup is not None and self._help_popup.isVisible():
self._help_popup.hide()
self._help_popup.deleteLater()
self._help_popup.close()
self._help_popup = None
return
popup = QFrame(self)
popup.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
popup.setAttribute(Qt.WA_DeleteOnClose, False)
# Use a small QDialog (not QFrame+Qt.Popup) — more reliable on macOS
popup = QDialog(self)
popup.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
popup.setAttribute(Qt.WA_TranslucentBackground, False)
popup.setStyleSheet("""
QFrame {
QDialog {
background: #2D2D2D;
border: 1px solid #5B9BD5;
border-radius: 8px;
padding: 12px;
}
""")
popup_layout = QVBoxLayout(popup)
popup_layout.setContentsMargins(12, 10, 12, 10)
popup_layout.setContentsMargins(14, 12, 14, 12)
content = QLabel(self._help_text)
content.setWordWrap(True)
content.setMaximumWidth(380)
content.setStyleSheet("color: #E0E0E0; font-size: 12px; background: transparent; border: none;")
content.setStyleSheet(
"color: #E0E0E0; font-size: 12px; background: transparent; border: none;"
)
content.setTextFormat(Qt.RichText)
content.setOpenExternalLinks(True)
popup_layout.addWidget(content)
# Close button row
close_row = QHBoxLayout()
close_row.addStretch(1)
close_btn = QPushButton("✕")
close_btn.setFixedSize(24, 24)
close_btn.setStyleSheet("""
QPushButton {
border: none; background: transparent; color: #999;
font-size: 14px; font-weight: bold;
}
QPushButton:hover { color: #fff; }
""")
close_btn.clicked.connect(popup.close)
close_row.addWidget(close_btn)
popup_layout.addLayout(close_row)
# Position below the help button
btn_global = self.help_icon.mapToGlobal(QPoint(0, self.help_icon.height()))
btn_global = self.help_icon.mapToGlobal(
QPoint(0, self.help_icon.height() + 4)
)
popup.move(btn_global)
popup.show()
popup.raise_()
popup.activateWindow()
self._help_popup = popup
def _on_paste(self, text: str) -> None: