本文整理汇总了C++中QSplitter::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QSplitter::deleteLater方法的具体用法?C++ QSplitter::deleteLater怎么用?C++ QSplitter::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSplitter
的用法示例。
在下文中一共展示了QSplitter::deleteLater方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeView
void MultiViewWidget::removeView()
{
ContainerWidget *container = qobject_cast<ContainerWidget *>(sender());
if (container) {
QSplitter *splitter = qobject_cast<QSplitter *>(container->parent());
if (splitter && splitter->count() == 2) {
// Get its parent, and insert the other widget into it, delete this widget.
QSplitter *splitterParent = qobject_cast<QSplitter *>(splitter->parent());
QWidget *moveWidget = splitter->widget(0);
if (moveWidget == container)
moveWidget = splitter->widget(1);
setActiveWidget(moveWidget);
if (splitterParent) {
int idx = splitterParent->indexOf(splitter);
splitterParent->insertWidget(idx, moveWidget);
splitter->deleteLater();
}
else if (splitter->parent() == this) {
// No more splits - back to single view widget.
QVBoxLayout *layoutParent = qobject_cast<QVBoxLayout *>(layout());
if (layoutParent) {
layoutParent->addWidget(moveWidget);
layoutParent->removeWidget(splitter);
splitter->deleteLater();
}
}
}
else if (container->parent() == this) {
// Delete the current container, and create the option container.
QVBoxLayout *vLayout = qobject_cast<QVBoxLayout *>(layout());
container->deleteLater();
ContainerWidget *newContainer = createContainer();
vLayout->addWidget(newContainer);
setActiveWidget(newContainer);
}
}
}