void UIPopupPaneTextPane::prepareAnimation() { /* Propagate parent signals: */ connect(parent(), SIGNAL(sigFocusEnter()), this, SLOT(sltFocusEnter())); connect(parent(), SIGNAL(sigFocusLeave()), this, SLOT(sltFocusLeave())); /* Install geometry animation for 'minimumSizeHint' property: */ m_pAnimation = UIAnimation::installPropertyAnimation(this, "minimumSizeHint", "collapsedSizeHint", "expandedSizeHint", SIGNAL(sigFocusEnter()), SIGNAL(sigFocusLeave()), m_fFocused); }
void UIPopupPaneTextPane::sltFocusLeave() { /* Ignore if already unfocused: */ if (!m_fFocused) return; /* Update focus state: */ m_fFocused = false; /* Notify listeners: */ emit sigFocusLeave(); }
bool UIPopupPane::eventFilter(QObject *pObject, QEvent *pEvent) { /* Handle events for allowed widgets only: */ if ( pObject != this && pObject != m_pMessagePane && pObject != m_pButtonPane && pObject != m_pDetailsPane) QIWithRetranslateUI<QWidget>::eventFilter(pObject, pEvent); /* Depending on event-type: */ switch (pEvent->type()) { /* Something is hovered: */ case QEvent::HoverEnter: case QEvent::Enter: { /* Hover pane if not yet hovered: */ if (!m_fHovered) { m_fHovered = true; emit sigHoverEnter(); } break; } /* Nothing is hovered: */ case QEvent::Leave: { /* Unhover pane if hovered but not focused: */ if (pObject == this && m_fHovered && !m_fFocused) { m_fHovered = false; emit sigHoverLeave(); } break; } /* Pane is clicked with mouse: */ case QEvent::MouseButtonPress: { /* Focus pane if not focused: */ if (!m_fFocused) { m_fFocused = true; emit sigFocusEnter(); /* Hover pane if not hovered: */ if (!m_fHovered) { m_fHovered = true; emit sigHoverEnter(); } /* Translate tool-tips: */ retranslateToolTips(); } break; } /* Pane is unfocused: */ case QEvent::FocusOut: { /* Unhocus pane if focused: */ if (m_fCanLooseFocus && m_fFocused) { m_fFocused = false; emit sigFocusLeave(); /* Unhover pane if hovered: */ if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); } /* Translate tool-tips: */ retranslateToolTips(); } break; } /* Default case: */ default: break; } /* Call to base-class: */ return QIWithRetranslateUI<QWidget>::eventFilter(pObject, pEvent); }
bool UIPopupPane::eventFilter(QObject *pWatched, QEvent *pEvent) { /* Depending on event-type: */ switch (pEvent->type()) { /* Something is hovered: */ case QEvent::HoverEnter: case QEvent::Enter: { /* Hover pane if not yet hovered: */ if (!m_fHovered) { m_fHovered = true; emit sigHoverEnter(); } break; } /* Nothing is hovered: */ case QEvent::Leave: { /* Unhover pane if hovered but not focused: */ if (pWatched == this && m_fHovered && !m_fFocused) { m_fHovered = false; emit sigHoverLeave(); } break; } /* Pane is clicked with mouse: */ case QEvent::MouseButtonPress: { /* Focus pane if not focused: */ if (!m_fFocused) { m_fFocused = true; emit sigFocusEnter(); /* Hover pane if not hovered: */ if (!m_fHovered) { m_fHovered = true; emit sigHoverEnter(); } /* Translate tool-tips: */ retranslateToolTips(); } break; } /* Pane is unfocused: */ case QEvent::FocusOut: { /* Unhocus pane if focused: */ if (m_fCanLooseFocus && m_fFocused) { m_fFocused = false; emit sigFocusLeave(); /* Unhover pane if hovered: */ if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); } /* Translate tool-tips: */ retranslateToolTips(); } break; } /* Default case: */ default: break; } /* Do not filter anything: */ return false; }