本文整理汇总了C++中Workbench类的典型用法代码示例。如果您正苦于以下问题:C++ Workbench类的具体用法?C++ Workbench怎么用?C++ Workbench使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Workbench类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PyErr_SetString
PyObject* Application::sActiveWorkbenchHandler(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
if (!PyArg_ParseTuple(args, "")) // convert args: Python->C
return NULL; // NULL triggers exception
Workbench* actWb = WorkbenchManager::instance()->active();
if (!actWb) {
PyErr_SetString(PyExc_AssertionError, "No active workbench\n");
return NULL;
}
// get the python workbench object from the dictionary
std::string key = actWb->name();
PyObject* pcWorkbench = PyDict_GetItemString(Instance->_pcWorkbenchDictionary, key.c_str());
if (!pcWorkbench) {
PyErr_Format(PyExc_KeyError, "No such workbench '%s'", key.c_str());
return NULL;
}
// object get incremented
Py_INCREF(pcWorkbench);
return pcWorkbench;
}
开发者ID:rogerbrasil,项目名称:FreeCAD,代码行数:23,代码来源:ApplicationPy.cpp
示例2: CustomizeActionPage
/**
* Constructs a DlgCustomToolbars which is a child of 'parent', with the
* name 'name' and widget flags set to 'f'
*
* The dialog will by default be modeless, unless you set 'modal' to
* true to construct a modal dialog.
*/
DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
: CustomizeActionPage(parent), type(t)
{
this->setupUi(this);
moveActionRightButton->setIcon(BitmapFactory().pixmap(":/icons/button_right.svg"));
moveActionLeftButton->setIcon(BitmapFactory().pixmap(":/icons/button_left.svg"));
moveActionDownButton->setIcon(BitmapFactory().pixmap(":/icons/button_down.svg"));
moveActionUpButton->setIcon(BitmapFactory().pixmap(":/icons/button_up.svg"));
CommandManager & cCmdMgr = Application::Instance->commandManager();
std::map<std::string,Command*> sCommands = cCmdMgr.getCommands();
GroupMap groupMap;
groupMap.push_back(std::make_pair(QLatin1String("File"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Edit"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("View"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Standard-View"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Tools"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Window"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Help"), QString()));
groupMap.push_back(std::make_pair(QLatin1String("Macros"), qApp->translate("Gui::MacroCommand", "Macros")));
for (std::map<std::string,Command*>::iterator it = sCommands.begin(); it != sCommands.end(); ++it) {
QLatin1String group(it->second->getGroupName());
QString text = qApp->translate(it->second->className(), it->second->getGroupName());
GroupMap::iterator jt;
jt = std::find_if(groupMap.begin(), groupMap.end(), GroupMap_find(group));
if (jt != groupMap.end()) {
if (jt->second.isEmpty())
jt->second = text;
}
else {
groupMap.push_back(std::make_pair(group, text));
}
}
int index = 0;
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
categoryBox->addItem(it->second);
categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
}
// fills the combo box with all available workbenches
QStringList workbenches = Application::Instance->workbenches();
workbenches.sort();
index = 1;
workbenchBox->addItem(QApplication::windowIcon(), tr("Global"));
workbenchBox->setItemData(0, QVariant(QString::fromLatin1("Global")), Qt::UserRole);
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
QPixmap px = Application::Instance->workbenchIcon(*it);
QString mt = Application::Instance->workbenchMenuText(*it);
if (mt != QLatin1String("<none>")) {
if (px.isNull())
workbenchBox->addItem(mt);
else
workbenchBox->addItem(px, mt);
workbenchBox->setItemData(index, QVariant(*it), Qt::UserRole);
index++;
}
}
QStringList labels;
labels << tr("Icon") << tr("Command");
commandTreeWidget->setHeaderLabels(labels);
commandTreeWidget->header()->hide();
commandTreeWidget->setIconSize(QSize(32, 32));
commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents);
labels.clear(); labels << tr("Command");
toolbarTreeWidget->setHeaderLabels(labels);
toolbarTreeWidget->header()->hide();
on_categoryBox_activated(categoryBox->currentIndex());
Workbench* w = WorkbenchManager::instance()->active();
if (w) {
QString name = QString::fromLatin1(w->name().c_str());
int index = workbenchBox->findData(name);
workbenchBox->setCurrentIndex(index);
}
on_workbenchBox_activated(workbenchBox->currentIndex());
}
开发者ID:3DPrinterGuy,项目名称:FreeCAD,代码行数:88,代码来源:DlgToolbarsImp.cpp
注:本文中的Workbench类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论