Feature/jira project knowledge #8
+30
-10
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user