Fix help banner visibility
- Show banner on showEvent (when flow view becomes visible) - Show banner on mouse enter event - Raise banner to front to ensure visibility - Recalculate size before positioning Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
fb879d09ea
commit
827f0f9eef
|
|
@ -317,28 +317,41 @@ class FlowGraphWidget(QWidget):
|
||||||
else:
|
else:
|
||||||
super().keyPressEvent(event)
|
super().keyPressEvent(event)
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
"""Handle widget becoming visible."""
|
||||||
|
super().showEvent(event)
|
||||||
|
# Show help banner when flow view becomes visible
|
||||||
|
QTimer.singleShot(100, self._show_help_banner)
|
||||||
|
|
||||||
def eventFilter(self, obj, event):
|
def eventFilter(self, obj, event):
|
||||||
"""Filter events from the graph widget to catch F key and focus."""
|
"""Filter events from the graph widget to catch F key and focus."""
|
||||||
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_F:
|
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_F:
|
||||||
self.fit_all_nodes()
|
self.fit_all_nodes()
|
||||||
return True # Event handled
|
return True # Event handled
|
||||||
elif event.type() == QEvent.FocusIn:
|
elif event.type() == QEvent.Enter:
|
||||||
|
# Show banner when mouse enters the graph area
|
||||||
self._show_help_banner()
|
self._show_help_banner()
|
||||||
return super().eventFilter(obj, event)
|
return super().eventFilter(obj, event)
|
||||||
|
|
||||||
def _show_help_banner(self):
|
def _show_help_banner(self):
|
||||||
"""Show the help banner with fade effect."""
|
"""Show the help banner with fade effect."""
|
||||||
if not self._help_banner:
|
if not self._help_banner or not self._graph:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Make sure size is calculated
|
||||||
|
self._help_banner.adjustSize()
|
||||||
|
|
||||||
# Position at top center of the graph widget
|
# Position at top center of the graph widget
|
||||||
parent_width = self._graph.widget.width()
|
parent_width = self._graph.widget.width()
|
||||||
banner_width = self._help_banner.width()
|
banner_width = self._help_banner.width()
|
||||||
x = (parent_width - banner_width) // 2
|
x = max(10, (parent_width - banner_width) // 2)
|
||||||
self._help_banner.move(x, 10)
|
self._help_banner.move(x, 10)
|
||||||
|
|
||||||
# Show and start auto-hide timer
|
# Raise to front and show
|
||||||
|
self._help_banner.raise_()
|
||||||
self._help_banner.show()
|
self._help_banner.show()
|
||||||
|
|
||||||
|
# Start auto-hide timer
|
||||||
self._hide_timer.start(3000) # Hide after 3 seconds
|
self._hide_timer.start(3000) # Hide after 3 seconds
|
||||||
|
|
||||||
def _fade_out_banner(self):
|
def _fade_out_banner(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue