From c2a9ea22f39553799cc8fe0d4a4c005db16c272b Mon Sep 17 00:00:00 2001 From: thanhnv Date: Tue, 8 Sep 2026 10:16:47 +0900 Subject: [PATCH] fix(jira-knowledge): use QDialog popup instead of QFrame+Qt.Popup for macOS compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- ui/connectors_panel.py | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/ui/connectors_panel.py b/ui/connectors_panel.py index 5350e98..3f2c47e 100644 --- a/ui/connectors_panel.py +++ b/ui/connectors_panel.py @@ -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: