Exemplo n.º 1
0
void
KnobGui::onLabelChanged()
{
    if (_imp->descriptionLabel) {
        KnobPtr knob = getKnob();
        if (!knob) {
            return;
        }
        const std::string& iconLabel = knob->getIconLabel();
        if ( !iconLabel.empty() ) {
            return;
        }

        std::string descriptionLabel = getDescriptionLabel();
        if (descriptionLabel.empty()) {
            _imp->descriptionLabel->hide();
        } else {
            _imp->descriptionLabel->setText_overload( QString::fromUtf8( descriptionLabel.c_str() ) );
            _imp->descriptionLabel->show();
        }
        onLabelChangedInternal();
    } else {
        onLabelChangedInternal();
    }
}
Exemplo n.º 2
0
void
KnobGui::onLabelChanged()
{
    if (_imp->descriptionLabel) {
        KnobPtr knob = getKnob();
        if (!knob) {
            return;
        }
        const std::string& iconLabel = knob->getIconLabel();
        if (!iconLabel.empty()) {
            return;
        }
        std::string descriptionLabel;
        KnobString* isStringKnob = dynamic_cast<KnobString*>(knob.get());
        bool isLabelKnob = isStringKnob && isStringKnob->isLabel();
        if (isLabelKnob) {
            descriptionLabel = isStringKnob->getValue();
        } else {
            descriptionLabel = knob->getLabel();
        }
        
        _imp->descriptionLabel->setText_overload(QString::fromUtf8(descriptionLabel.c_str()));
        onLabelChangedInternal();
    }
}