Feature/jira project knowledge #8
+30
-10
@@ -191,38 +191,58 @@ class JiraConnectDialog(QDialog):
|
|||||||
def _toggle_help_popup(self) -> None:
|
def _toggle_help_popup(self) -> None:
|
||||||
"""Show/hide a floating help popup when the ? button is clicked."""
|
"""Show/hide a floating help popup when the ? button is clicked."""
|
||||||
if self._help_popup is not None and self._help_popup.isVisible():
|
if self._help_popup is not None and self._help_popup.isVisible():
|
||||||
self._help_popup.hide()
|
self._help_popup.close()
|
||||||
self._help_popup.deleteLater()
|
|
||||||
self._help_popup = None
|
self._help_popup = None
|
||||||
return
|
return
|
||||||
|
|
||||||
popup = QFrame(self)
|
# Use a small QDialog (not QFrame+Qt.Popup) — more reliable on macOS
|
||||||
popup.setWindowFlags(Qt.Popup | Qt.FramelessWindowHint)
|
popup = QDialog(self)
|
||||||
popup.setAttribute(Qt.WA_DeleteOnClose, False)
|
popup.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint)
|
||||||
|
popup.setAttribute(Qt.WA_TranslucentBackground, False)
|
||||||
popup.setStyleSheet("""
|
popup.setStyleSheet("""
|
||||||
QFrame {
|
QDialog {
|
||||||
background: #2D2D2D;
|
background: #2D2D2D;
|
||||||
border: 1px solid #5B9BD5;
|
border: 1px solid #5B9BD5;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 12px;
|
|
||||||
}
|
}
|
||||||
""")
|
""")
|
||||||
popup_layout = QVBoxLayout(popup)
|
popup_layout = QVBoxLayout(popup)
|
||||||
popup_layout.setContentsMargins(12, 10, 12, 10)
|
popup_layout.setContentsMargins(14, 12, 14, 12)
|
||||||
|
|
||||||
content = QLabel(self._help_text)
|
content = QLabel(self._help_text)
|
||||||
content.setWordWrap(True)
|
content.setWordWrap(True)
|
||||||
content.setMaximumWidth(380)
|
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.setTextFormat(Qt.RichText)
|
||||||
content.setOpenExternalLinks(True)
|
content.setOpenExternalLinks(True)
|
||||||
popup_layout.addWidget(content)
|
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
|
# 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.move(btn_global)
|
||||||
popup.show()
|
popup.show()
|
||||||
popup.raise_()
|
popup.raise_()
|
||||||
|
popup.activateWindow()
|
||||||
self._help_popup = popup
|
self._help_popup = popup
|
||||||
|
|
||||||
def _on_paste(self, text: str) -> None:
|
def _on_paste(self, text: str) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user