当前位置: 首页>>代码示例>>C++>>正文


C++ QSplitter::deleteLater方法代码示例

本文整理汇总了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);
    }
  }
}
开发者ID:AlbertDeFusco,项目名称:avogadrolibs,代码行数:37,代码来源:multiviewwidget.cpp


注:本文中的QSplitter::deleteLater方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。