当前位置: 首页>>代码示例>>C++>>正文


C++ GetUniqueItem函数代码示例

本文整理汇总了C++中GetUniqueItem函数的典型用法代码示例。如果您正苦于以下问题:C++ GetUniqueItem函数的具体用法?C++ GetUniqueItem怎么用?C++ GetUniqueItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetUniqueItem函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PyErr_SetString

PyObject *scribus_setlinespacemode(PyObject* /* self */, PyObject* args)
{
	char *Name = const_cast<char*>("");
	int w;
	if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name))
		return NULL;
	if(!checkHaveDocument())
		return NULL;
	if (w < 0 || w > 3) // Use constants?
	{
		PyErr_SetString(PyExc_ValueError, QObject::tr("Line space mode invalid, must be 0, 1 or 2","python error").toLocal8Bit().constData());
		return NULL;
	}
	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
	if (i == NULL)
		return NULL;
	if (!i->asTextFrame())
	{
		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set line spacing mode on a non-text frame.","python error").toLocal8Bit().constData());
		return NULL;
	}
	
	int Apm = ScCore->primaryMainWindow()->doc->appMode;
	ScCore->primaryMainWindow()->doc->m_Selection->clear();
	ScCore->primaryMainWindow()->doc->m_Selection->addItem(i);
	if (i->HasSel)
		ScCore->primaryMainWindow()->doc->appMode = modeEdit;
	ScCore->primaryMainWindow()->doc->itemSelection_SetLineSpacingMode(w);
	ScCore->primaryMainWindow()->doc->appMode = Apm;
	ScCore->primaryMainWindow()->view->Deselect();
		
	Py_RETURN_NONE;
}
开发者ID:ryanfmurphy,项目名称:scribus,代码行数:33,代码来源:cmdtext.cpp

示例2: GetUniqueItem

PyObject *scribus_settablebottomborder(PyObject* /* self */, PyObject* args)
{
	char *Name = const_cast<char*>("");
	PyObject* borderLines;
	if (!PyArg_ParseTuple(args, "O|es", &borderLines, "utf-8", &Name))
		return nullptr;
	if (!checkHaveDocument())
		return nullptr;
	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
	if (i == nullptr)
		return nullptr;
	PageItem_Table *table = i->asTable();
	if (!table)
	{
		PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set table bottom border on a non-table item.","python error").toLocal8Bit().constData());
		return nullptr;
	}

	bool ok = false;
	TableBorder border = parseBorder(borderLines, &ok);
	if (ok)
		table->setBottomBorder(border);
	else
		return nullptr;

	Py_RETURN_NONE;
}
开发者ID:luzpaz,项目名称:scribus,代码行数:27,代码来源:cmdtable.cpp

示例3: GetUniqueItem

PyObject *scribus_inserthtmltext(PyObject* /* self */, PyObject* args)
{
	char *name = const_cast<char*>("");
	char *file;
	QString data;

	if (!PyArg_ParseTuple(args, "es|es", "utf-8", &file, "utf-8", &name)) {
		return NULL;
	}

	if(!checkHaveDocument()) {
		return NULL;
	}

	PageItem *it = GetUniqueItem(QString::fromUtf8(name));
	if (it == NULL) {
		return NULL;
	}

	if (!(it->asTextFrame()) && !(it->asPathText())) {
		PyErr_SetString(WrongFrameTypeError,
				QObject::tr("Cannot insert text into non-text frame.",
					"python error").toLocal8Bit().constData());
		return NULL;
	}

	QString fileName = QString::fromUtf8(file);

	gtGetText gt(ScCore->primaryMainWindow()->doc);
	gt.launchImporter(-1, fileName, false, QString("utf-8"), false, it);

	// FIXME: PyMem_Free() - are any needed??
	Py_RETURN_NONE;
}
开发者ID:ryanfmurphy,项目名称:scribus,代码行数:34,代码来源:cmdtext.cpp

示例4: GetUniqueItem

PyObject *scribus_getfillblend(PyObject* /* self */, PyObject* args)
{
	char *Name = const_cast<char*>("");
	if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
		return NULL;
	if(!checkHaveDocument())
		return NULL;
	PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
	return i != NULL ? PyInt_FromLong(static_cast<long>(i->fillBlendmode())) : NULL;
}
开发者ID:JLuc,项目名称:scribus,代码行数:10,代码来源:cmdgetprop.cpp

示例5: RAISE

void DocumentAPI::unGroupItems(QString name)
{
	if (!check())
		RAISE("No document open");
	PageItem *i = GetUniqueItem(name);
	if (i == NULL)
		RAISE("Item not found.");
	ScCore->primaryMainWindow()->view->Deselect();
	ScCore->primaryMainWindow()->view->SelectItem(i);
	ScCore->primaryMainWindow()->UnGroupObj();
}
开发者ID:JLuc,项目名称:scribus,代码行数:11,代码来源:api_document.cpp


注:本文中的GetUniqueItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。