void UIGDetailsElement::prepareButton()
{
    /* Setup toggle-button: */
    m_pButton = new UIGraphicsRotatorButton(this, "additionalHeight", !m_fClosed, true /* reflected */);
    m_pButton->setAutoHandleButtonClick(false);
    connect(m_pButton, SIGNAL(sigButtonClicked()), this, SLOT(sltToggleButtonClicked()));
    connect(m_pButton, SIGNAL(sigRotationStart()), this, SLOT(sltElementToggleStart()));
    connect(m_pButton, SIGNAL(sigRotationFinish(bool)), this, SLOT(sltElementToggleFinish(bool)));
    m_buttonSize = m_pButton->minimumSizeHint().toSize();
}
Example #2
0
void UIGraphicsRotatorButton::setToggled(bool fToggled, bool fAnimated /* = true */)
{
    /* Not during animation: */
    if (isAnimationRunning())
        return;

    /* Make sure something has changed: */
    switch (state())
    {
    case UIGraphicsRotatorButtonState_Default:
    {
        if (!fToggled)
            return;
        break;
    }
    case UIGraphicsRotatorButtonState_Rotated:
    {
        if (fToggled)
            return;
        break;
    }
    default:
        break;
    }

    /* Should be animated? */
    if (fAnimated)
    {
        /* Rotation start: */
        emit sigRotationStart();
        emit sigToAnimating();
    }
    else
    {
        if (fToggled)
            emit sigToRotated();
        else
            emit sigToDefault();
    }
}