本文整理汇总了C++中KviKvsObject类的典型用法代码示例。如果您正苦于以下问题:C++ KviKvsObject类的具体用法?C++ KviKvsObject怎么用?C++ KviKvsObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KviKvsObject类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: killAllObjectsWithClass
void KviKvsObjectController::killAllObjectsWithClass(KviKvsObjectClass * pClass)
{
if(!m_pObjectDict)
return; // no more objects at all...
KviPointerList< QPointer<KviKvsObject> > lDying;
lDying.setAutoDelete(true);
KviKvsObject * pObject;
for(pObject = m_pTopLevelObjectList->first();pObject;pObject = m_pTopLevelObjectList->next())
{
if(pObject->getClass() == pClass)
{
lDying.append(new QPointer<KviKvsObject>(pObject));
} else {
pObject->killAllChildrenWithClass(pClass);
}
}
for(QPointer<KviKvsObject> * pObject = lDying.first();pObject;pObject = lDying.next())
{
if(pObject->isNull())
continue; // already dead ?
(*pObject)->dieNow();
}
}
示例2: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(mainWindow,setCentralWidget)
{
CHECK_INTERNAL_POINTER(widget())
KviKvsObject * pObject;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETERS_END(c)
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
if (!pObject)
{
c->warning(__tr2qs_ctx("Widget parameter is not an object","objects"));
return true;
}
if (!pObject->object())
{
c->warning(__tr2qs_ctx("Widget parameter is not a valid object","objects"));
return true;
}
if(!pObject->inheritsClass("widget"))
{
c->warning(__tr2qs_ctx("Widget object required","objects"));
return true;
}
((KviTalMainWindow *)widget())->setCentralWidget(((QWidget *)(pObject->object())));
return true;
}
示例3: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(trayIcon,setContextMenu)
{
CHECK_INTERNAL_POINTER(m_pTrayIcon)
KviKvsObject *ob;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETERS_END(c)
ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
if (!ob)
{
c->warning(__tr2qs_ctx("Widget parameter is not an object","objects"));
return true;
}
if (!ob->object())
{
c->warning(__tr2qs_ctx("Widget parameter is not a valid object","objects"));
return true;
}
if(!ob->inheritsClass("popupmenu"))
{
c->warning(__tr2qs_ctx("Can't add a non-popupmenu object","objects"));
return true;
}
m_pTrayIcon->setContextMenu(((QMenu *)(ob->object())));
return true;
}
示例4: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(workspace,addSubWindow)
{
CHECK_INTERNAL_POINTER(widget())
KviKvsObject * pObject;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETERS_END(c)
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
CHECK_HOBJECT_IS_WIDGET(pObject)
QMdiSubWindow *pMdi=((QMdiArea *)object())->addSubWindow(((QWidget *)(pObject->object())));
pWidgetDict->insert(hObject,pMdi);
((QMdiArea *)object())->setActiveSubWindow(pMdi);
return true;
}
示例5: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(wizard,setTitle)
{
CHECK_INTERNAL_POINTER(widget())
KviKvsObject *ob;
QString szTitle;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("page_widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETER("title",KVS_PT_STRING,0,szTitle)
KVSO_PARAMETERS_END(c)
ob=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
if(!ob->object()->isWidgetType())
{
c->warning(__tr2qs_ctx("Widget object required","objects"));
return true;
}
((KviTalWizard *)widget())->setPageTitle(((QWidget *)(ob->object())),szTitle);
return true;
}
示例6: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(hBox,setStretchFactor)
{
CHECK_INTERNAL_POINTER(widget())
KviKvsObject * pObject;
kvs_hobject_t hObject;
kvs_uint_t uStretch;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETER("stretch",KVS_PT_UNSIGNEDINTEGER,0,uStretch)
KVSO_PARAMETERS_END(c)
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
CHECK_HOBJECT_IS_WIDGET(pObject)
if(((KvsObject_widget *)pObject)->widget()->parentWidget() != widget())
{
c->warning(__tr2qs_ctx("The widget must be a child of this hbox","objects"));
return true;
}
((KviTalHBox *)widget())->setStretchFactor(((QWidget *)(pObject->object())),uStretch);
return true;
}
示例7: m_allocProc
KviKvsObject * KviKvsObjectClass::allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams)
{
if(!m_allocProc)
return 0;
KviKvsObject * pObject = m_allocProc(this,pParent,szName);
if(!pObject)
return 0;
if(!pObject->init(pContext,pParams))
{
// internal init failure : abort
pObject->dieNow();
return 0;
}
// copy params
KviKvsVariantList copy;
copy.setAutoDelete(false);
KviKvsVariant * v = pParams->first();
while(v)
{
copy.append(v);
v = pParams->next();
}
KviKvsVariant ret;
if(!pObject->callFunction(pObject,"constructor",QString(),pContext,&ret,©))
{
// ops...constructor failed (script error!)
pObject->dieNow();
return 0;
}
if(!ret.isEmpty())
pContext->warning(__tr2qs_ctx("It's not allowed to return values in the constructor","kvs"));
return pObject;
}
示例8: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(vBox,setAlignment)
{
CHECK_INTERNAL_POINTER(widget())
QStringList alignment;
KviKvsObject * pObject;
kvs_hobject_t hObject;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("widget",KVS_PT_HOBJECT,0,hObject)
KVSO_PARAMETER("alignment",KVS_PT_STRINGLIST,KVS_PF_OPTIONAL,alignment)
KVSO_PARAMETERS_END(c)
pObject=KviKvsKernel::instance()->objectController()->lookupObject(hObject);
CHECK_HOBJECT_IS_WIDGET(pObject)
if(((KvsObject_widget *)pObject)->widget()->parentWidget() != widget())
{
c->warning(__tr2qs_ctx("The widget must be a child of this hbox","objects"));
return true;
}
int align,sum=0;
for ( QStringList::Iterator it = alignment.begin(); it != alignment.end(); ++it )
{
align = 0;
for(unsigned int j = 0; j < align_num; j++)
{
if(KviQString::equalCI((*it), align_tbl[j]))
{
align=align_cod[j];
break;
}
}
if(align)
sum = sum | align;
else
c->warning(__tr2qs_ctx("Unknown alignment: '%Q'","objects"),&(*it));
}
if (widget()) ((KviTalHBox *)widget())->setAlignment(((QWidget *)(pObject->object())),(Qt::Alignment)sum);
return true;
}
示例9: KVSO_CLASS_FUNCTION
KVSO_CLASS_FUNCTION(xmlReader, parse)
{
KviKvsVariant * pVariantData;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("string_or_memorybuffer_object", KVS_PT_VARIANT, 0, pVariantData)
KVSO_PARAMETERS_END(c)
#ifdef QT_NO_XML
fatalError(__tr2qs_ctx("XML support not available in the Qt library"));
c->returnValue()->setBoolean(false);
#else
m_szLastError = "";
KviXmlHandler handler(this);
QXmlInputSource source;
if(pVariantData->isHObject())
{
KviKvsObject * pObject;
kvs_hobject_t hObject;
pVariantData->asHObject(hObject);
pObject = KviKvsKernel::instance()->objectController()->lookupObject(hObject);
if(!pObject)
{
c->warning(__tr2qs_ctx("Data parameter is not an object", "objects"));
return true;
}
if(pObject->inheritsClass("memorybuffer"))
{
source.setData(*((KvsObject_memoryBuffer *)pObject)->pBuffer());
}
else
{
c->warning(__tr2qs_ctx("Data parameter is not a memorybuffer object", "objects"));
return true;
}
}
else if(pVariantData->isString())
{
QString szString;
pVariantData->asString(szString);
// We have a problem here.. most kvirc functions already interpret the data
// read from files. We should have binary data handling features to get this to work correctly.
// The following snippet of code tries to provide a best-effort workaround.
QByteArray utf8data = szString.toUtf8();
QByteArray data = utf8data;
data.truncate(utf8data.length()); // don't include the null terminator in data
source.setData(data);
//qDebug("PARSING(%s) LEN(%d)",szString.toUtf8().data(),szString.toUtf8().length());
}
else
{
c->warning(__tr2qs_ctx("Data is not a memorybuffer object or string", "objects"));
return true;
}
QXmlSimpleReader reader;
reader.setContentHandler(&handler);
reader.setErrorHandler(&handler);
c->returnValue()->setBoolean(reader.parse(source));
#endif
return true;
}