本文整理汇总了C++中ViewContainer::containerWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewContainer::containerWidget方法的具体用法?C++ ViewContainer::containerWidget怎么用?C++ ViewContainer::containerWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewContainer
的用法示例。
在下文中一共展示了ViewContainer::containerWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: activeContainer
ViewContainer* ViewSplitter::activeContainer() const
{
if (QWidget* focusW = focusWidget()) {
ViewContainer* focusContainer = 0;
while (focusW != 0) {
QListIterator<ViewContainer*> containerIter(_containers);
while (containerIter.hasNext()) {
ViewContainer* nextContainer = containerIter.next();
if (nextContainer->containerWidget() == focusW) {
focusContainer = nextContainer;
break;
}
}
focusW = focusW->parentWidget();
}
if (focusContainer)
return focusContainer;
}
QList<ViewSplitter*> splitters = findChildren<ViewSplitter*>();
if (splitters.count() > 0) {
return splitters.last()->activeContainer();
} else {
if (_containers.count() > 0)
return _containers.last();
else
return 0;
}
}
示例2: addContainer
void ViewSplitter::addContainer( ViewContainer* container ,
Qt::Orientation containerOrientation )
{
ViewSplitter* splitter = activeSplitter();
if ( splitter->count() < 2 ||
containerOrientation == splitter->orientation() ||
!_recursiveSplitting )
{
splitter->registerContainer(container);
splitter->addWidget(container->containerWidget());
if ( splitter->orientation() != containerOrientation )
splitter->setOrientation( containerOrientation );
splitter->updateSizes();
}
else
{
ViewSplitter* newSplitter = new ViewSplitter(this);
connect( newSplitter , SIGNAL(empty(ViewSplitter*)) , splitter , SLOT(childEmpty(ViewSplitter*)) );
ViewContainer* oldContainer = splitter->activeContainer();
int oldContainerIndex = splitter->indexOf(oldContainer->containerWidget());
splitter->unregisterContainer(oldContainer);
newSplitter->registerContainer(oldContainer);
newSplitter->registerContainer(container);
newSplitter->addWidget(oldContainer->containerWidget());
newSplitter->addWidget(container->containerWidget());
newSplitter->setOrientation(containerOrientation);
newSplitter->updateSizes();
newSplitter->show();
splitter->insertWidget(oldContainerIndex,newSplitter);
}
}
示例3: splitView
void ViewManager::splitView(Qt::Orientation orientation)
{
// iterate over each session which has a view in the current active
// container and create a new view for that session in a new container
QListIterator<QWidget*> existingViewIter(_viewSplitter->activeContainer()->views());
ViewContainer* container = 0;
while (existingViewIter.hasNext()) {
Session* session = _sessionMap[(TerminalDisplay*)existingViewIter.next()];
TerminalDisplay* display = createTerminalDisplay(session);
const Profile::Ptr profile = SessionManager::instance()->sessionProfile(session);
applyProfileToView(display, profile);
ViewProperties* properties = createController(session, display);
_sessionMap[display] = session;
// create a container using settings from the first
// session in the previous container
if (!container) {
container = createContainer(profile);
applyProfileToContainer(container, profile);
}
container->addView(display, properties);
session->addView(display);
}
_viewSplitter->addContainer(container, orientation);
emit splitViewToggle(_viewSplitter->containers().count() > 0);
// focus the new container
container->containerWidget()->setFocus();
// ensure that the active view is focused after the split / unsplit
ViewContainer* activeContainer = _viewSplitter->activeContainer();
QWidget* activeView = activeContainer ? activeContainer->activeView() : 0;
if (activeView)
activeView->setFocus(Qt::OtherFocusReason);
}