本文整理汇总了C++中KnobChoicePtr::getActiveEntryText_mt_safe方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobChoicePtr::getActiveEntryText_mt_safe方法的具体用法?C++ KnobChoicePtr::getActiveEntryText_mt_safe怎么用?C++ KnobChoicePtr::getActiveEntryText_mt_safe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobChoicePtr
的用法示例。
在下文中一共展示了KnobChoicePtr::getActiveEntryText_mt_safe方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
void
KnobGuiChoice::updateGUI(int /*dimension*/)
{
///we don't use setCurrentIndex because the signal emitted by combobox will call onCurrentIndexChanged and
///change the internal value of the knob again...
///The slot connected to onCurrentIndexChanged is reserved to catch user interaction with the combobox.
///This function is called in response to an internal change.
KnobChoicePtr knob = _knob.lock();
std::string activeEntry = knob->getActiveEntryText_mt_safe();
if ( !activeEntry.empty() ) {
bool activeIndexPresent = knob->isActiveEntryPresentInEntries();
if (!activeIndexPresent) {
QString error = tr("The value set to this parameter no longer exist in the menu. Right click and press Refresh Menu to update the menu and then pick a new value.");
setWarningValue( KnobGui::eKnobWarningChoiceMenuOutOfDate, GuiUtils::convertFromPlainText(error, Qt::WhiteSpaceNormal) );
} else {
setWarningValue( KnobGui::eKnobWarningChoiceMenuOutOfDate, QString() );
}
}
if ( _comboBox->isCascading() || activeEntry.empty() ) {
_comboBox->setCurrentIndex_no_emit( knob->getValue() );
} else {
_comboBox->setCurrentText( QString::fromUtf8( activeEntry.c_str() ) );
}
}
示例2: tr
void
OneViewNode::initializeKnobs()
{
KnobPagePtr page = AppManager::createKnob<KnobPage>( shared_from_this(), tr("Controls") );
page->setName("controls");
KnobChoicePtr viewKnob = AppManager::createKnob<KnobChoice>( shared_from_this(), tr("View") );
viewKnob->setName("view");
viewKnob->setHintToolTip( tr("View to take from the input") );
page->addKnob(viewKnob);
const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames();
std::string currentView = viewKnob->getActiveEntryText_mt_safe();
viewKnob->populateChoices(views);
_imp->viewKnob = viewKnob;
}
示例3: QIcon
void
KnobGuiChoice::onEntryAppended(const QString& entry,
const QString& help)
{
KnobChoicePtr knob = _knob.lock();
if ( knob->getHostCanAddOptions() &&
( ( knob->getName() == kNatronOfxParamOutputChannels) || ( knob->getName() == kOutputChannelsKnobName) ) ) {
_comboBox->insertItem(_comboBox->count() - 1, entry, QIcon(), QKeySequence(), help);
} else {
_comboBox->addItem(entry, QIcon(), QKeySequence(), help);
}
int activeIndex = knob->getValue();
if (activeIndex >= 0) {
_comboBox->setCurrentIndex_no_emit(activeIndex);
} else {
_comboBox->setCurrentText( QString::fromUtf8( knob->getActiveEntryText_mt_safe().c_str() ) );
}
}
示例4: getApp
void
OneViewNode::onProjectViewsChanged()
{
const std::vector<std::string>& views = getApp()->getProject()->getProjectViewNames();
KnobChoicePtr viewKnob = _imp->viewKnob.lock();
std::string currentView = viewKnob->getActiveEntryText_mt_safe();
viewKnob->populateChoices(views);
bool foundView = false;
for (std::size_t i = 0; i < views.size(); ++i) {
if (views[i] == currentView) {
foundView = true;
viewKnob->setValue(i);
break;
}
}
if (!foundView) {
viewKnob->setValue(0);
}
}