當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。