void UIGChooserItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) { if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); } }
void UIGChooserItem::setHovered(bool fHovered) { m_fHovered = fHovered; if (m_fHovered) emit sigHoverEnter(); else emit sigHoverLeave(); }
void UIRuntimeMiniToolBar::sltHoverLeave() { /* Mark as 'unhovered' if necessary: */ if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); } }
void UIGChooserItem::hoverLeaveEvent(QGraphicsSceneHoverEvent*) { if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); #if QT_VERSION >= 0x050000 update(); #endif /* QT_VERSION >= 0x050000 */ } }
void UIPopupPane::prepareAnimation() { /* Install 'show' animation for 'minimumSizeHint' property: */ connect(this, SIGNAL(sigToShow()), this, SIGNAL(sigShow()), Qt::QueuedConnection); m_pShowAnimation = UIAnimation::installPropertyAnimation(this, "minimumSizeHint", "hiddenSizeHint", "shownSizeHint", SIGNAL(sigShow()), SIGNAL(sigHide())); connect(m_pShowAnimation, SIGNAL(sigStateEnteredFinal()), this, SLOT(sltMarkAsShown())); /* Install 'hover' animation for 'opacity' property: */ UIAnimation::installPropertyAnimation(this, "opacity", "defaultOpacity", "hoveredOpacity", SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()), m_fHovered); }
void UIGDetailsElement::hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent) { /* Update hover state: */ if (m_fHovered) { m_fHovered = false; emit sigHoverLeave(); } /* Update name-hover state: */ handleHoverEvent(pEvent); }
UIGraphicsZoomButton::UIGraphicsZoomButton(QIGraphicsWidget *pParent, const QIcon &icon, int iDirection) : UIGraphicsButton(pParent, icon) , m_iIndent(4) , m_iDirection(iDirection) , m_iAnimationDuration(200) , m_pStateMachine(0) , m_pForwardAnimation(0) , m_pBackwardAnimation(0) , m_fStateDefault(true) { /* Setup: */ setAcceptHoverEvents(true); /* Create state machine: */ m_pStateMachine = new QStateMachine(this); /* Create 'default' state: */ QState *pStateDefault = new QState(m_pStateMachine); pStateDefault->assignProperty(this, "stateDefault", true); /* Create 'zoomed' state: */ QState *pStateZoomed = new QState(m_pStateMachine); pStateZoomed->assignProperty(this, "stateDefault", false); /* Initial state is 'default': */ m_pStateMachine->setInitialState(pStateDefault); /* Zoom animation: */ m_pForwardAnimation = new QPropertyAnimation(this, "geometry", this); m_pForwardAnimation->setDuration(m_iAnimationDuration); /* Unzoom animation: */ m_pBackwardAnimation = new QPropertyAnimation(this, "geometry", this); m_pBackwardAnimation->setDuration(m_iAnimationDuration); /* Add state transitions: */ QSignalTransition *pDefaultToZoomed = pStateDefault->addTransition(this, SIGNAL(sigHoverEnter()), pStateZoomed); pDefaultToZoomed->addAnimation(m_pForwardAnimation); QSignalTransition *pZoomedToDefault = pStateZoomed->addTransition(this, SIGNAL(sigHoverLeave()), pStateDefault); pZoomedToDefault->addAnimation(m_pBackwardAnimation); /* Start state-machine: */ m_pStateMachine->start(); }
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); }
void UIRuntimeMiniToolBar::prepare() { /* Allow any size: */ setMinimumSize(1, 1); /* Make sure we have no focus: */ setFocusPolicy(Qt::NoFocus); /* Prepare mdi-area: */ m_pMdiArea = new QMdiArea; { /* Configure own background: */ QPalette pal = m_pMdiArea->palette(); pal.setColor(QPalette::Window, QColor(Qt::transparent)); m_pMdiArea->setPalette(pal); /* Configure viewport background: */ m_pMdiArea->setBackground(QColor(Qt::transparent)); /* Layout mdi-area according parent-widget: */ QVBoxLayout *pMainLayout = new QVBoxLayout(this); pMainLayout->setContentsMargins(0, 0, 0, 0); pMainLayout->addWidget(m_pMdiArea); /* Make sure we have no focus: */ m_pMdiArea->setFocusPolicy(Qt::NoFocus); m_pMdiArea->viewport()->setFocusPolicy(Qt::NoFocus); } /* Prepare mini-toolbar: */ m_pToolbar = new UIMiniToolBar; { /* Propagate known options to child: */ m_pToolbar->setAutoHide(m_fAutoHide); m_pToolbar->setAlignment(m_alignment); m_pToolbar->setIntegrationMode(m_integrationMode); /* Configure own background: */ QPalette pal = m_pToolbar->palette(); pal.setColor(QPalette::Window, palette().color(QPalette::Window)); m_pToolbar->setPalette(pal); /* Configure child connections: */ connect(m_pToolbar, SIGNAL(sigResized()), this, SLOT(sltHandleToolbarResize())); connect(m_pToolbar, SIGNAL(sigAutoHideToggled()), this, SLOT(sltAutoHideToggled())); connect(m_pToolbar, SIGNAL(sigMinimizeAction()), this, SIGNAL(sigMinimizeAction())); connect(m_pToolbar, SIGNAL(sigExitAction()), this, SIGNAL(sigExitAction())); connect(m_pToolbar, SIGNAL(sigCloseAction()), this, SIGNAL(sigCloseAction())); /* Add child to mdi-area: */ m_pEmbeddedToolbar = m_pMdiArea->addSubWindow(m_pToolbar, Qt::Window | Qt::FramelessWindowHint); /* Make sure we have no focus: */ m_pToolbar->setFocusPolicy(Qt::NoFocus); m_pEmbeddedToolbar->setFocusPolicy(Qt::NoFocus); } /* Prepare hover-enter/leave timers: */ m_pHoverEnterTimer = new QTimer(this); { m_pHoverEnterTimer->setSingleShot(true); m_pHoverEnterTimer->setInterval(50); connect(m_pHoverEnterTimer, SIGNAL(timeout()), this, SLOT(sltHoverEnter())); } m_pHoverLeaveTimer = new QTimer(this); { m_pHoverLeaveTimer->setSingleShot(true); m_pHoverLeaveTimer->setInterval(500); connect(m_pHoverLeaveTimer, SIGNAL(timeout()), this, SLOT(sltHoverLeave())); } /* Install 'auto-hide' animation to 'toolbarPosition' property: */ m_pAnimation = UIAnimation::installPropertyAnimation(this, "toolbarPosition", "hiddenToolbarPosition", "shownToolbarPosition", SIGNAL(sigHoverEnter()), SIGNAL(sigHoverLeave()), true); /* Integrate if necessary: */ integrate(); /* Adjust geometry finally: */ adjustGeometry(); }
UIGChooserItem::UIGChooserItem(UIGChooserItem *pParent, bool fTemporary) : m_fRoot(!pParent) , m_fTemporary(fTemporary) , m_pParent(pParent) , m_iPreviousMinimumWidthHint(0) , m_iPreviousMinimumHeightHint(0) , m_dragTokenPlace(DragToken_Off) , m_fHovered(false) , m_pHighlightMachine(0) , m_pForwardAnimation(0) , m_pBackwardAnimation(0) , m_iAnimationDuration(400) , m_iDefaultDarkness(100) , m_iHighlightDarkness(90) , m_iAnimationDarkness(m_iDefaultDarkness) , m_iDragTokenDarkness(110) { /* Basic item setup: */ setOwnedByLayout(false); setAcceptDrops(true); setFocusPolicy(Qt::NoFocus); setFlag(QGraphicsItem::ItemIsSelectable, false); setAcceptHoverEvents(!isRoot()); /* Non-root item? */ if (!isRoot()) { /* Create state machine: */ m_pHighlightMachine = new QStateMachine(this); /* Create 'default' state: */ QState *pStateDefault = new QState(m_pHighlightMachine); /* Create 'highlighted' state: */ QState *pStateHighlighted = new QState(m_pHighlightMachine); /* Forward animation: */ m_pForwardAnimation = new QPropertyAnimation(this, "animationDarkness", this); m_pForwardAnimation->setDuration(m_iAnimationDuration); m_pForwardAnimation->setStartValue(m_iDefaultDarkness); m_pForwardAnimation->setEndValue(m_iHighlightDarkness); /* Backward animation: */ m_pBackwardAnimation = new QPropertyAnimation(this, "animationDarkness", this); m_pBackwardAnimation->setDuration(m_iAnimationDuration); m_pBackwardAnimation->setStartValue(m_iHighlightDarkness); m_pBackwardAnimation->setEndValue(m_iDefaultDarkness); /* Add state transitions: */ QSignalTransition *pDefaultToHighlighted = pStateDefault->addTransition(this, SIGNAL(sigHoverEnter()), pStateHighlighted); pDefaultToHighlighted->addAnimation(m_pForwardAnimation); QSignalTransition *pHighlightedToDefault = pStateHighlighted->addTransition(this, SIGNAL(sigHoverLeave()), pStateDefault); pHighlightedToDefault->addAnimation(m_pBackwardAnimation); /* Initial state is 'default': */ m_pHighlightMachine->setInitialState(pStateDefault); /* Start state-machine: */ m_pHighlightMachine->start(); } }
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; }
void UIGraphicsZoomButton::hoverLeaveEvent(QGraphicsSceneHoverEvent*) { emit sigHoverLeave(); }
void UIGDetailsElement::prepareElement() { /* Initialization: */ m_nameFont = font(); m_nameFont.setWeight(QFont::Bold); m_textFont = font(); /* Create highlight machine: */ m_pHighlightMachine = new QStateMachine(this); /* Create 'default' state: */ QState *pStateDefault = new QState(m_pHighlightMachine); /* Create 'highlighted' state: */ QState *pStateHighlighted = new QState(m_pHighlightMachine); /* Forward animation: */ m_pForwardAnimation = new QPropertyAnimation(this, "animationDarkness", this); m_pForwardAnimation->setDuration(m_iAnimationDuration); m_pForwardAnimation->setStartValue(m_iDefaultDarkness); m_pForwardAnimation->setEndValue(m_iHighlightDarkness); /* Backward animation: */ m_pBackwardAnimation = new QPropertyAnimation(this, "animationDarkness", this); m_pBackwardAnimation->setDuration(m_iAnimationDuration); m_pBackwardAnimation->setStartValue(m_iHighlightDarkness); m_pBackwardAnimation->setEndValue(m_iDefaultDarkness); /* Add state transitions: */ QSignalTransition *pDefaultToHighlighted = pStateDefault->addTransition(this, SIGNAL(sigHoverEnter()), pStateHighlighted); pDefaultToHighlighted->addAnimation(m_pForwardAnimation); QSignalTransition *pHighlightedToDefault = pStateHighlighted->addTransition(this, SIGNAL(sigHoverLeave()), pStateDefault); pHighlightedToDefault->addAnimation(m_pBackwardAnimation); /* Initial state is 'default': */ m_pHighlightMachine->setInitialState(pStateDefault); /* Start state-machine: */ m_pHighlightMachine->start(); connect(this, SIGNAL(sigToggleElement(DetailsElementType, bool)), model(), SLOT(sltToggleElements(DetailsElementType, bool))); connect(this, SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&)), model(), SIGNAL(sigLinkClicked(const QString&, const QString&, const QString&))); }