本文整理汇总了C++中ViewContainer::activeViewArea方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewContainer::activeViewArea方法的具体用法?C++ ViewContainer::activeViewArea怎么用?C++ ViewContainer::activeViewArea使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewContainer
的用法示例。
在下文中一共展示了ViewContainer::activeViewArea方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openURL
Document* DocManager::openURL( const KURL &url, ViewArea *viewArea )
{
if ( url.isEmpty() ) return 0;
if ( url.isLocalFile() )
{
QFile file(url.path());
if ( file.open(IO_ReadOnly) == false )
{
KMessageBox::sorry( 0l, i18n("Could not open '%1'").arg( url.prettyURL() ) );
return 0l;
}
file.close();
}
// If the currently active view area is empty, and we were not given a view area
// to open into, then use the empty view area
if ( !viewArea )
{
ViewContainer * currentVC = static_cast<ViewContainer*>( KTechlab::self()->tabWidget()->currentPage() );
if ( currentVC )
{
ViewArea * va = currentVC->viewArea( currentVC->activeViewArea() );
if ( !va->view() )
viewArea = va;
}
}
// If the document is already open, and a specific view area hasn't been
// specified, then just return that document - otherwise, create a new
// view in the viewarea
Document *document = findDocument(url);
if ( document ) {
if ( viewArea )
createNewView( document, viewArea );
else giveDocumentFocus( document, viewArea );
return document;
}
QString fileName = url.fileName();
QString extension = fileName.right( fileName.length() - fileName.findRev('.') );
if ( extension == ".circuit" )
return openCircuitFile( url, viewArea );
else if ( extension == ".flowcode" )
return openFlowCodeFile( url, viewArea );
else if ( extension == ".mechanics" )
return openMechanicsFile( url, viewArea );
else return openTextFile( url, viewArea );
}