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


C++ QLayout::removeItem方法代码示例

本文整理汇总了C++中QLayout::removeItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QLayout::removeItem方法的具体用法?C++ QLayout::removeItem怎么用?C++ QLayout::removeItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QLayout的用法示例。


在下文中一共展示了QLayout::removeItem方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: unload

void TestController::unload() {
    //Inputs
    QLayout* layout = getView().getUi().grx_test_inputs->layout();

    for (int i = layout->count() - 1; i >= 0; --i) {
        QLayoutItem* item = layout->itemAt(i);
        GuiGrapher* g = dynamic_cast<GuiGrapher*> (item->widget());
        if (g) {
            QObject::disconnect(g, SIGNAL(onChangeInputValue()), this,
                                SLOT(onInputValueChanged()));
        }
        layout->removeItem(item);
        delete item->widget();
        delete item;
    }

    //Rules
    getView().getUi().lsw_test_rules->clear();
    getView().getUi().lsw_test_rules_activation->clear();

    //Outputs
    layout = getView().getUi().grx_test_outputs->layout();
    for (int i = layout->count() - 1; i >= 0; --i) {
        QLayoutItem* item = layout->itemAt(i);
        GuiGrapher* g = dynamic_cast<GuiGrapher*> (item->widget());
        if (g) {
            QObject::disconnect(this, SIGNAL(forceUpdate()), g, SLOT(updateUi()));
        }
        layout->removeItem(item);
        delete item->widget();
        delete item;
    }
}
开发者ID:thewitcher,项目名称:TrafficLights,代码行数:33,代码来源:TestController.cpp

示例2: showDetailsForItem

void StartupView::showDetailsForItem( const QModelIndex & index )
{
  QLayout * layout = m_projectDetailView->layout();

  for( int i = 0; i < layout->count(); i++ )
  {
    delete layout->itemAt(i)->widget();
    layout->removeItem(layout->itemAt(i));
  }

  QString name = m_templateListModel->data(index,Qt::ToolTipRole).toString();

  QString description = m_templateListModel->data(index,Qt::WhatsThisRole).toString();

  if( ! name.isEmpty() )
  {
    auto nameLabel = new QLabel(name);

    nameLabel->setStyleSheet("QLabel { font: bold }");

    layout->addWidget(nameLabel);
  }

  if( ! description.isEmpty() )
  {
    auto descriptionLabel = new QTextEdit(description);
    
    descriptionLabel->setStyleSheet("QTextEdit { border: none; }");
    
    descriptionLabel->setReadOnly(true);

    layout->addWidget(descriptionLabel);
  }

}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:35,代码来源:StartupView.cpp

示例3: setSpacingAt

void NLayoutPrototype::setSpacingAt(int index, int spacing)
{
	QLayout *layout = qscriptvalue_cast<QLayout *>(thisObject());
	if (layout) {
		layout->removeItem(layout->itemAt(index));
		dynamic_cast<QBoxLayout *>(layout)->insertSpacing(index, spacing);
	}
}
开发者ID:vkolev,项目名称:nulloy,代码行数:8,代码来源:scriptPrototypes.cpp

示例4: SetSceneControl

void VideoWidget::SetSceneControl(BaseSceneController *sceneControlIn)
{
    //Remove previous scene button controls
    while(this->ui->annotationTools->count()>0)
    {
        //This item usually corresponds to the widget generated by the control factory
        QLayoutItem *item = this->ui->annotationTools->itemAt(0);
        QWidget *custom = item->widget();
        assert(custom!=NULL);
        cout << custom->metaObject()->className() << endl;

        //Also iterate through to get child widgets and directly close and remove them
        QLayout *wlayout = custom->layout();
        assert(wlayout!=NULL);
        while(wlayout->count())
        {
            int test = wlayout->count();
            QLayoutItem *citem = wlayout->itemAt(0);
            QWidget *childw = citem->widget();
            assert(childw!=NULL);
            childw->close();
            wlayout->removeItem(citem);
            delete childw;
        }

        custom->close();
        this->ui->annotationTools->removeItem(item);
        delete custom;
    }

    //Remove previous menu controls

    //Clear previous scene
    QGraphicsScene *oldScene = this->ui->graphicsView->scene();
    if(oldScene!=NULL) oldScene->clear();

    //Activate new scene button controls
    this->sceneControl = sceneControlIn;
    if(this->sceneControl!=NULL)
    {
        MouseGraphicsScene *scene = this->sceneControl->GetScene();
        if(scene != NULL)
        {
            this->ui->graphicsView->setScene(scene);
            this->sceneControl->Redraw();
            this->SetRawScale(0.3);
        }
        else
            this->ui->graphicsView->setScene(NULL);

        QWidget *controls = this->sceneControl->ControlsFactory(this);
        if(controls!=NULL)
            this->ui->annotationTools->addWidget(controls);
    }
    else
    {
        this->ui->graphicsView->setScene(NULL);
        this->SetSceneControl(new class LogoSceneController(this));
    }

}
开发者ID:Amos-zq,项目名称:sense-scanner,代码行数:61,代码来源:videowidget.cpp


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