本文整理汇总了C++中ToolButton::getMenuIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolButton::getMenuIcon方法的具体用法?C++ ToolButton::getMenuIcon怎么用?C++ ToolButton::getMenuIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToolButton
的用法示例。
在下文中一共展示了ToolButton::getMenuIcon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pix
//.........这里部分代码省略.........
menu->setTitle( pluginsToolButton->getLabel() );
menu->setIcon(menuIcon);
pluginsToolButton->setMenu(menu);
pluginsToolButton->setAction( menu->menuAction() );
} else {
// This is a leaf (plug-in)
assert(internalPlugin);
assert(parentToolButton);
// If this is the highest major version for this plug-in use normal label, otherwise also append the major version
bool isHighestMajorVersionForPlugin = internalPlugin->getIsHighestMajorVersion();
std::string pluginLabel = !isHighestMajorVersionForPlugin ? internalPlugin->getLabelVersionMajorEncoded() : internalPlugin->getLabelWithoutSuffix();
QKeySequence defaultNodeShortcut;
QString shortcutGroup = QString::fromUtf8(kShortcutGroupNodes);
std::vector<std::string> groupingSplit = internalPlugin->getPropertyN<std::string>(kNatronPluginPropGrouping);
for (std::size_t j = 0; j < groupingSplit.size(); ++j) {
shortcutGroup.push_back( QLatin1Char('/') );
shortcutGroup.push_back(QString::fromUtf8(groupingSplit[j].c_str()));
}
{
// If the plug-in has a shortcut get it
std::list<QKeySequence> keybinds = getKeybind(shortcutGroup, QString::fromUtf8(internalPlugin->getPluginID().c_str()));
if (!keybinds.empty()) {
defaultNodeShortcut = keybinds.front();
}
}
QAction* defaultPresetAction = new QAction(this);
defaultPresetAction->setShortcut(defaultNodeShortcut);
defaultPresetAction->setShortcutContext(Qt::WidgetShortcut);
defaultPresetAction->setText(QString::fromUtf8(pluginLabel.c_str()));
defaultPresetAction->setIcon( pluginsToolButton->getMenuIcon() );
QObject::connect( defaultPresetAction, SIGNAL(triggered()), pluginsToolButton, SLOT(onTriggered()) );
const std::vector<PluginPresetDescriptor>& presets = internalPlugin->getPresetFiles();
if (presets.empty()) {
// If the node has no presets, just make an action, otherwise make a menu
pluginsToolButton->setAction(defaultPresetAction);
} else {
Menu* menu = new Menu(this);
menu->setTitle( pluginsToolButton->getLabel() );
menu->setIcon(menuIcon);
pluginsToolButton->setMenu(menu);
pluginsToolButton->setAction( menu->menuAction() );
defaultPresetAction->setText(QString::fromUtf8(pluginLabel.c_str()) + tr(" (Default)"));
menu->addAction(defaultPresetAction);
for (std::vector<PluginPresetDescriptor>::const_iterator it = presets.begin(); it!=presets.end(); ++it) {
QKeySequence presetShortcut;
{
// If the preset has a shortcut get it
std::string shortcutKey = internalPlugin->getPluginID();
shortcutKey += "_preset_";
shortcutKey += it->presetLabel.toStdString();
std::list<QKeySequence> keybinds = getKeybind(shortcutGroup, QString::fromUtf8(shortcutKey.c_str()));
if (!keybinds.empty()) {
presetShortcut = keybinds.front();
}
}
QString presetLabel = QString::fromUtf8(pluginLabel.c_str());
presetLabel += QLatin1String(" (");
presetLabel += it->presetLabel;
presetLabel += QLatin1String(")");
QAction* presetAction = new QAction(this);
QPixmap presetPix;
if (getPresetIcon(it->presetFilePath, it->presetIconFile, TO_DPIX(NATRON_MEDIUM_BUTTON_ICON_SIZE), &presetPix)) {
presetAction->setIcon( presetPix );
}
presetAction->setShortcut(presetShortcut);
presetAction->setShortcutContext(Qt::WidgetShortcut);
presetAction->setText(presetLabel);
presetAction->setData(it->presetLabel);
QObject::connect( presetAction, SIGNAL(triggered()), pluginsToolButton, SLOT(onTriggered()) );
menu->addAction(presetAction);
}
}
} // if (!treeNode->getChildren().empty())
// If it has a parent, add the new tool button as a child
if (parentToolButton) {
parentToolButton->tryAddChild(pluginsToolButton);
}
_imp->_toolButtons.push_back(pluginsToolButton);
return pluginsToolButton;
} // findOrCreateToolButton