本文整理汇总了C++中kparts::ReadOnlyPart::inherits方法的典型用法代码示例。如果您正苦于以下问题:C++ ReadOnlyPart::inherits方法的具体用法?C++ ReadOnlyPart::inherits怎么用?C++ ReadOnlyPart::inherits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kparts::ReadOnlyPart
的用法示例。
在下文中一共展示了ReadOnlyPart::inherits方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveToFile
//---------------------------------------------------------------------------
bool ProjectSession::saveToFile( const QString & sessionFileName, const QValueList< KDevPlugin * > plugins )
{
QString section, keyword;
QDomElement session = domdoc.documentElement();
int nDocs = 0;
QString docIdStr;
//// // read the information about the mainframe widget
//// QDomElement mainframeEl = session.namedItem("Mainframe").toElement();
//// if(mainframeEl.isNull()){
//// mainframeEl=domdoc.createElement("Mainframe");
//// session.appendChild( mainframeEl);
//// }
//// bool bMaxMode = ((QextMdiMainFrm*)m_pDocViewMan->parent())->isInMaximizedChildFrmMode();
//// mainframeEl.setAttribute("MaximizeMode", bMaxMode);
// read the information about the documents
QDomElement docsAndViewsEl = session.namedItem("DocsAndViews").toElement();
if (docsAndViewsEl.isNull()) {
docsAndViewsEl = domdoc.createElement("DocsAndViews");
session.appendChild( docsAndViewsEl);
}
else {
// we need to remove the old ones before memorizing the current ones (to avoid merging)
QDomNode n = docsAndViewsEl.firstChild();
while ( !n.isNull() ) {
QDomNode toBeRemoved = n;
n = n.nextSibling();
docsAndViewsEl.removeChild(toBeRemoved);
}
}
QPtrListIterator<KParts::Part> it( *PartController::getInstance()->parts() );
for ( ; it.current(); ++it )
{
KParts::ReadOnlyPart* pReadOnlyPart = dynamic_cast<KParts::ReadOnlyPart*>(it.current());
if (!pReadOnlyPart)
continue;
QString url = pReadOnlyPart->url().url();
docIdStr.setNum(nDocs);
QDomElement docEl = domdoc.createElement("Doc" + docIdStr);
docEl.setAttribute( "URL", url);
docsAndViewsEl.appendChild( docEl);
nDocs++;
docEl.setAttribute( "NumberOfViews", 1);
QDomElement viewEl = domdoc.createElement( "View0");
docEl.appendChild( viewEl);
if ( dynamic_cast<HTMLDocumentationPart*>(pReadOnlyPart) )
{
viewEl.setAttribute("Type", "Documentation");
}
else if ( pReadOnlyPart->inherits("KTextEditor::Document") )
{
viewEl.setAttribute("Type", "Source");
KTextEditor::ViewCursorInterface *iface = dynamic_cast<KTextEditor::ViewCursorInterface*>(pReadOnlyPart->widget());
if (iface) {
unsigned int line, col;
iface->cursorPosition(&line, &col);
viewEl.setAttribute( "line", line );
}
if ( KTextEditor::EncodingInterface * ei = dynamic_cast<KTextEditor::EncodingInterface*>( pReadOnlyPart ) )
{
QString encoding = ei->encoding();
if ( !encoding.isNull() )
{
viewEl.setAttribute( "Encoding", encoding );
}
}
}
else
{
viewEl.setAttribute("Type", "Other");
}
}
/*
QPtrListIterator<KParts::Part> it( *PartController::getInstance()->parts() );
for ( ; it.current(); ++it ) {
//// QString partName = it.current()->name();
//// QMessageBox::information(0L,"",partName);
KParts::ReadOnlyPart* pReadOnlyPart = dynamic_cast<KParts::ReadOnlyPart*>(it.current());
if (!pReadOnlyPart)
continue; // note: read-write parts are also a read-only part, they inherit from it
HTMLDocumentationPart* pDocuPart = dynamic_cast<HTMLDocumentationPart*>(pReadOnlyPart);
/// @todo Save relative path for project sharing?
QString url = pReadOnlyPart->url().url();
docIdStr.setNum(nDocs);
QDomElement docEl = domdoc.createElement("Doc" + docIdStr);
//.........这里部分代码省略.........