本文整理汇总了C++中KnobChoicePtr::getSeparators方法的典型用法代码示例。如果您正苦于以下问题:C++ KnobChoicePtr::getSeparators方法的具体用法?C++ KnobChoicePtr::getSeparators怎么用?C++ KnobChoicePtr::getSeparators使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KnobChoicePtr
的用法示例。
在下文中一共展示了KnobChoicePtr::getSeparators方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pix
void
KnobGuiChoice::onEntriesPopulated()
{
KnobChoicePtr knob = _knob.lock();
if (!knob) {
return;
}
_comboBox->clear();
std::vector<ChoiceOption> entries = knob->getEntries();
std::string pluginShortcutGroup;
EffectInstancePtr isEffect = toEffectInstance(knob->getHolder());
if (isEffect) {
PluginPtr plugin = isEffect->getNode()->getOriginalPlugin();
if (plugin) {
pluginShortcutGroup = plugin->getPluginShortcutGroup();
}
}
const std::map<int, std::string>& shortcutsMap = knob->getShortcuts();
const std::map<int, std::string>& iconsMap = knob->getIcons();
for (U32 i = 0; i < entries.size(); ++i) {
std::string shortcutID;
std::string iconFilePath;
if (!pluginShortcutGroup.empty()) {
std::map<int, std::string>::const_iterator foundShortcut = shortcutsMap.find(i);
if (foundShortcut != shortcutsMap.end()) {
shortcutID = foundShortcut->second;
}
}
std::map<int, std::string>::const_iterator foundIcon = iconsMap.find(i);
if (foundIcon != iconsMap.end()) {
iconFilePath = foundIcon->second;
}
QIcon icon;
if (!iconFilePath.empty()) {
QPixmap pix( getPixmapPathFromFilePath( QString::fromUtf8( iconFilePath.c_str() ) ) );
if (!pix.isNull()) {
pix = pix.scaled(TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), TO_DPIY(NATRON_MEDIUM_BUTTON_ICON_SIZE));
icon.addPixmap(pix);
}
}
if (!shortcutID.empty() && !pluginShortcutGroup.empty() && !_comboBox->isCascading()) {
QAction* action = new ActionWithShortcut(pluginShortcutGroup,
shortcutID,
entries[i].label,
_comboBox);
if (!icon.isNull()) {
action->setIcon(icon);
}
_comboBox->addAction(action);
} else {
_comboBox->addItem( QString::fromUtf8( entries[i].label.c_str() ), icon, QKeySequence(), QString::fromUtf8( entries[i].tooltip.c_str() ) );
}
} // for all entries
const std::vector<int>& separators = knob->getSeparators();
for (std::size_t i = 0; i < separators.size(); ++i) {
_comboBox->insertSeparator(separators[i]);
}
// the "New" menu is only added to known parameters (e.g. the choice of output channels)
if (knob->getNewOptionCallback()) {
_comboBox->addItemNew();
}
updateGUI();
} // onEntriesPopulated