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


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

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


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

示例1: removeFromControlPanel

//!-------------------------------------------------------------------------
//! unmap parameter from control panel
//!-------------------------------------------------------------------------
void MEColorMapPort::removeFromControlPanel()
{
    colorMapClosed();

    if (controlLine != NULL)
    {
        if (m_colorMap)
        {
            m_fileOpen = false;
            if (m_extendedPart[CONTROL])
                m_extendedPart[CONTROL]->removeColorMap();
        }

        // remove comboBox & m_preview from layout
        // reparent
        QWidget *w = m_preview[CONTROL]->parentWidget();
        QLayout *lo = w->layout();
        lo->removeWidget(m_preview[CONTROL]);
        m_preview[CONTROL]->setParent(0);

        // remove contol line
        node->getControlInfo()->removeParameter(controlLine);

        // reset values
        m_extendedPart[CONTROL] = NULL;
        folderAction[CONTROL] = NULL;
        controlLine = NULL;
    }
}
开发者ID:nixz,项目名称:covise,代码行数:32,代码来源:MEColorMapPort.cpp

示例2: update

void CCanvasQuickView::update(CDiagram *d)
{
	QRectF				r;
	CDiagramEditor		*editor = NULL;
	CDiagramView		*view = NULL;
	QLayout				*layout = NULL;

	layout = ui->m_miniViewHolder->layout();
	if (layout && m_view)
	{
		layout->removeWidget(m_view);
		m_view->setParent(NULL);
		m_view = NULL;
	}

	m_d = d;
	if (m_d)
	{
		editor = dynamic_cast<CDiagramEditor*>(m_d->getMainView());
		if (editor)
		{
			view = editor->diagramView();
			if (view)
			{
				view->setParent(this);
				layout->addWidget(view);
				m_view = view;
			}
		}
	}
}
开发者ID:jetcodes,项目名称:JetMind,代码行数:31,代码来源:CCanvasQuickView.cpp

示例3: changeScreen

void MainWindow::changeScreen(QWidget* screen){
	mCurrentScreen = screen;

	QLayout* layout = ui.screenContainer->layout();
	layout->removeWidget(layout->itemAt(0)->widget());
	layout->addWidget(mCurrentScreen);
}
开发者ID:exjam,项目名称:OpenPvP.net,代码行数:7,代码来源:mainwindow.cpp

示例4: updateLegend

/*!
  \brief Update the entries for an item

  \param itemInfo Info for an item
  \param data List of legend entry attributes for the item
 */
void QwtLegend::updateLegend( const QVariant &itemInfo, 
    const QList<QwtLegendData> &data )
{
    QList<QWidget *> widgetList = legendWidgets( itemInfo );

    if ( widgetList.size() != data.size() )
    {
        QLayout *contentsLayout = d_data->view->contentsWidget->layout();

        while ( widgetList.size() > data.size() )
        {
            QWidget *w = widgetList.takeLast();

            contentsLayout->removeWidget( w );

            // updates might be triggered by signals from the legend widget
            // itself. So we better don't delete it here.

            w->hide();
            w->deleteLater();
        }

        for ( int i = widgetList.size(); i < data.size(); i++ )
        {
            QWidget *widget = createWidget( data[i] );

            if ( contentsLayout )
                contentsLayout->addWidget( widget );

            if ( isVisible() )
            {
                // QLayout does a delayed show, with the effect, that
                // the size hint will be wrong, when applications
                // call replot() right after changing the list
                // of plot items. So we better do the show now.

                widget->setVisible( true );
            }

            widgetList += widget;
        }

        if ( widgetList.isEmpty() )
        {
            d_data->itemMap.remove( itemInfo );
        }
        else
        {
            d_data->itemMap.insert( itemInfo, widgetList );
        }

        updateTabOrder();
    }
    
    for ( int i = 0; i < data.size(); i++ )
        updateWidget( widgetList[i], data[i] );
}
开发者ID:151706061,项目名称:sofa,代码行数:63,代码来源:qwt_legend.cpp

示例5: removeRow

void HashPopulateWidget::removeRow(HashRemoveButton* button) {
	QLayout *lo = layout();
	QList<QWidget*> widgs;
	widgs << button->label() << button->value() << button;
	foreach(QWidget* w, widgs) {
		lo->removeWidget(w);   
		//w->hide();
        //delete w;
	}
开发者ID:himanshuchoudhary,项目名称:cscope,代码行数:9,代码来源:hashpopulatewidget.cpp

示例6: setContentWidget

void UIBar::setContentWidget(QWidget *pWidget)
{
    QLayout *pLayout = layout();
    if (m_pContentWidget)
        pLayout->removeWidget(m_pContentWidget);
    pLayout->addWidget(pWidget);
//    pLayout->setAlignment(pWidget, Qt::AlignCenter);
    m_pContentWidget = pWidget;
}
开发者ID:LastRitter,项目名称:vbox-haiku,代码行数:9,代码来源:UIBar.cpp

示例7: clearOutConfig

void PinConfig::clearOutConfig()
{
    QLayout *groupBoxLayout = this->subConfigGroupBox->layout();

    if (!groupBoxLayout)
        return;
    while (!groupBoxLayout->isEmpty())
    {
        QWidget *widget = groupBoxLayout->itemAt(0)->widget();
        groupBoxLayout->removeWidget(widget);
        delete widget;
    }
    delete groupBoxLayout;
}
开发者ID:ArnaudValensi,项目名称:arduino-control-interface,代码行数:14,代码来源:PinConfig.cpp

示例8: updateLegend

/*!
  \brief Update the entries for an item

  \param itemInfo Info for an item
  \param data List of legend entry attributes for the item
 */
void QwtLegend::updateLegend( const QVariant &itemInfo, 
    const QList<QwtLegendData> &data )
{
    QList<QWidget *> widgetList = legendWidgets( itemInfo );

    if ( widgetList.size() != data.size() )
    {
        QLayout *contentsLayout = d_data->view->contentsWidget->layout();

        while ( widgetList.size() > data.size() )
        {
            QWidget *w = widgetList.takeLast();

            contentsLayout->removeWidget( w );

            // updates might be triggered by signals from the legend widget
            // itself. So we better don't delete it here.

            w->hide();
            w->deleteLater();
        }

        for ( int i = widgetList.size(); i < data.size(); i++ )
        {
            QWidget *widget = createWidget( data[i] );

            if ( contentsLayout )
                contentsLayout->addWidget( widget );

            widgetList += widget;
        }

        if ( widgetList.isEmpty() )
        {
            d_data->itemMap.remove( itemInfo );
        }
        else
        {
            d_data->itemMap.insert( itemInfo, widgetList );
        }

        updateTabOrder();
    }
    
    for ( int i = 0; i < data.size(); i++ )
        updateWidget( widgetList[i], data[i] );
}
开发者ID:FabianFrancoRoldan,项目名称:OpenPilot,代码行数:53,代码来源:qwt_legend.cpp

示例9: on_btnAddressDelete_clicked

void MTContactDetails::on_btnAddressDelete_clicked()
{
    QObject * pqobjSender = QObject::sender();

    if (NULL != pqobjSender)
    {
        QPushButton * pBtnDelete = dynamic_cast<QPushButton *>(pqobjSender);

        if (m_pAddresses && (NULL != pBtnDelete))
        {
            QVariant  varContactID   = pBtnDelete->property("contactid");
            QVariant  varMethodType  = pBtnDelete->property("methodtype");
            QVariant  varMethodAddr  = pBtnDelete->property("methodaddr");
            int       nContactID     = varContactID .toInt();
            QString   qstrMethodType = varMethodType.toString();
            QString   qstrAddress    = varMethodAddr.toString();
            QWidget * pWidget        = VPtr<QWidget>::asPtr(pBtnDelete->property("methodwidget"));

            if (NULL != pWidget)
            {
                bool bRemoved = MTContactHandler::getInstance()->RemoveMsgAddressFromContact(nContactID, qstrMethodType, qstrAddress);

                if (bRemoved) // Let's remove it from the GUI, too, then.
                {
                    QLayout * pLayout = m_pAddresses->layout();

                    if (NULL != pLayout)
                    {
                        pLayout->removeWidget(pWidget);

                        pWidget->setParent(NULL);
                        pWidget->disconnect();
                        pWidget->deleteLater();

                        pWidget = NULL;
                    }
                }
            }
        }
    }
}
开发者ID:habibmasuro,项目名称:Moneychanger,代码行数:41,代码来源:contactdetails.cpp

示例10: removeFromControlPanel

//------------------------------------------------------------------------
// unmap parameter from control panel
//------------------------------------------------------------------------
void MEMaterialPort::removeFromControlPanel()
{
    materialMapClosed();

    if (controlLine != NULL)
    {
        // remove comboBox & preview from layout
        // reparent
        QWidget *w = m_preview[CONTROL]->parentWidget();
        QLayout *lo = w->layout();
        lo->removeWidget(m_preview[CONTROL]);
        m_preview[CONTROL]->setParent(0);

        // remove control line
        node->getControlInfo()->removeParameter(controlLine);

        // reset values
        folderAction[CONTROL] = NULL;
        controlLine = NULL;
    }
}
开发者ID:nixz,项目名称:covise,代码行数:24,代码来源:MEMaterialPort.cpp

示例11: initializeTextureStagesTab

void PixelShaderEditor::initializeTextureStagesTab()
{
   m_resourceMgr = &ResourcesManager::getInstance();
   QString iconsDir = m_resourceMgr->getFilesystem().getShortcut( "editorIcons" ).c_str();


   int activeTabIdx = 0;

   QLayout* layout = m_ui.textureStagesOptionsTab->layout();
   if ( m_textureStagesTabs != NULL )
   {
      activeTabIdx = m_textureStagesTabs->currentIndex();

      layout->removeWidget( m_textureStagesTabs );
      delete m_textureStagesTabs;
   }

   m_textureStagesTabs = new QTabWidget( m_ui.textureStagesOptionsTab );
   layout->addWidget( m_textureStagesTabs );

   m_textureStagesTabWidgets.clear();

   // add new tabs
   unsigned int count = m_shader.getTextureStagesCount();
   for ( unsigned int i = 0; i < count; ++i )
   {
      QFrame* frame = new QFrame( m_textureStagesTabs );
      QFormLayout* layout = new QFormLayout( frame );
      frame->setLayout( layout );

      const std::string& stageName = m_shader.getTextureStageName( i );
      m_textureStagesTabs->addTab( frame, stageName.c_str() );

      // add the widgets
      m_textureStagesTabWidgets.push_back( TextureStageTabDef() );
      TextureStageTabDef& tabDef = m_textureStagesTabWidgets.back();

      // attempt to restore texture stage state from DB
      TextureStageParams& stageSettings = m_shader.changeTextureStage( i );
      restoreTextureStageFromDB( stageName, stageSettings );

      // create the UI for the stage
      QFrame* uAddressModeFrame = new QFrame( frame );
      {
         QHBoxLayout* uAddressModeLayout = new QHBoxLayout( uAddressModeFrame );
         uAddressModeLayout->setMargin( 0 );
         uAddressModeFrame->setLayout( uAddressModeLayout );

         tabDef.m_uAddressMode = new QComboBox( uAddressModeFrame );
         tabDef.m_uAddressMode->addItems( m_addressModes );
         tabDef.m_uAddressMode->setCurrentIndex( stageSettings.m_addressU - 1 );
         uAddressModeLayout->addWidget( tabDef.m_uAddressMode, 1 );

         tabDef.m_linkAddressingModes = new QPushButton( uAddressModeFrame );
         uAddressModeLayout->addWidget( tabDef.m_linkAddressingModes, 0, Qt::AlignRight );
      }
      connect( tabDef.m_linkAddressingModes, SIGNAL( clicked( bool ) ), this, SLOT( onToggleAddressingModesLink( bool ) ) );
      connect( tabDef.m_uAddressMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      tabDef.m_vAddressMode = new QComboBox( frame );
      tabDef.m_vAddressMode->addItems( m_addressModes );
      tabDef.m_vAddressMode->setCurrentIndex( stageSettings.m_addressV - 1 );
      connect( tabDef.m_vAddressMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      tabDef.m_wAddressMode = new QComboBox( frame );
      tabDef.m_wAddressMode->addItems( m_addressModes );
      tabDef.m_wAddressMode->setCurrentIndex( stageSettings.m_addressW - 1 );
      connect( tabDef.m_wAddressMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      QFrame* minFilterFrame = new QFrame( frame );
      {
         QHBoxLayout* minFilterLayout = new QHBoxLayout( minFilterFrame );
         minFilterLayout->setMargin( 0 );
         minFilterFrame->setLayout( minFilterLayout );

         tabDef.m_minFilter = new QComboBox( frame );
         tabDef.m_minFilter->addItems( m_filteringModes );
         tabDef.m_minFilter->setCurrentIndex( stageSettings.m_minFilter );
         minFilterLayout->addWidget( tabDef.m_minFilter, 1 );

         tabDef.m_linkFilters = new QPushButton( minFilterFrame );
         minFilterLayout->addWidget( tabDef.m_linkFilters, 0, Qt::AlignRight );
      }
      connect( tabDef.m_linkFilters, SIGNAL( clicked( bool ) ), this, SLOT( onToggleFiltersLink( bool ) ) );
      connect( tabDef.m_minFilter, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      tabDef.m_magFilter = new QComboBox( frame );
      tabDef.m_magFilter->addItems( m_filteringModes );
      tabDef.m_magFilter->setCurrentIndex( stageSettings.m_magFilter );
      connect( tabDef.m_magFilter, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      tabDef.m_mipFilter = new QComboBox( frame );
      tabDef.m_mipFilter->addItems( m_filteringModes );
      tabDef.m_mipFilter->setCurrentIndex( stageSettings.m_mipFilter );
      connect( tabDef.m_mipFilter, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onTextureStageChange() ) );

      layout->addRow( "U address mode:", uAddressModeFrame );
      layout->addRow( "V address mode:", tabDef.m_vAddressMode );
      layout->addRow( "W address mode:", tabDef.m_wAddressMode );
      layout->addRow( "Min filter:", minFilterFrame );
//.........这里部分代码省略.........
开发者ID:chenwenbin928,项目名称:tamy,代码行数:101,代码来源:PixelShaderEditor.cpp

示例12: widgets

void
qt_tm_widget_rep::write (slot s, blackbox index, widget w) {
  if (DEBUG_QT_WIDGETS)
    debug_widgets << "qt_tm_widget_rep::write " << slot_name (s) << LF;
  
  switch (s) {
        // Widget w is usually a qt_simple_widget_rep, with a QTMWidget as
        // underlying widget. We must discard the current main_widget and
        // display the new. But while switching buffers the widget w is a
        // glue_widget, so we may not just use canvas() everywhere.
    case SLOT_SCROLLABLE:
    {
      check_type_void (index, s);
      
      QWidget* q = main_widget->qwid;
      q->hide();
      QLayout* l = centralwidget()->layout();
      l->removeWidget(q);
      
      q = concrete(w)->as_qwidget();   // force creation of the new QWidget
      l->addWidget(q);
      /* " When you use a layout, you do not need to pass a parent when
       constructing the child widgets. The layout will automatically reparent
       the widgets (using QWidget::setParent()) so that they are children of 
       the widget on which the layout is installed " */
      main_widget = concrete (w);
        // canvas() now returns the new QTMWidget (or 0)
      
      if (scrollarea())   // Fix size to draw margins around.
        scrollarea()->surface()->setSizePolicy (QSizePolicy::Fixed,
                                                QSizePolicy::Fixed);
      send_keyboard_focus (abstract (main_widget));
    }
      break;
      
    case SLOT_MAIN_MENU:
      check_type_void (index, s);
    {
      waiting_main_menu_widget = concrete (w);
      if (menu_count <= 0)
        install_main_menu();
      else if (!contains (waiting_widgets, this))
          // menu interaction ongoing, postpone new menu installation until done
        waiting_widgets << this;
    }
      break;
      
    case SLOT_MAIN_ICONS:
      check_type_void (index, s);
    {
      main_icons_widget = concrete (w);
      QMenu* m = main_icons_widget->get_qmenu();
      if (m) {
        replaceButtons (mainToolBar, m);
        update_visibility();
      }
    }
      break;
      
    case SLOT_MODE_ICONS:
      check_type_void (index, s);
    {
      mode_icons_widget = concrete (w);
      QMenu* m = mode_icons_widget->get_qmenu();
      if (m) {
        replaceButtons (modeToolBar, m);
        update_visibility();
      }
    }
      break;
      
    case SLOT_FOCUS_ICONS:
      check_type_void (index, s);
    {
      focus_icons_widget = concrete (w);
      QMenu* m = focus_icons_widget->get_qmenu();
      if (m) {
        replaceButtons (focusToolBar, m);
        update_visibility();
      }
    }
      break;
      
    case SLOT_USER_ICONS:
      check_type_void (index, s);
    {   
      user_icons_widget = concrete (w);
      QMenu* m = user_icons_widget->get_qmenu();
      if (m) {
        replaceButtons (userToolBar, m);
        update_visibility();
      }
    }
      break;
      
    case SLOT_SIDE_TOOLS:
      check_type_void (index, s);
    {
      side_tools_widget = concrete (w);
      QWidget* new_qwidget = side_tools_widget->as_qwidget();
//.........这里部分代码省略.........
开发者ID:niujiashu,项目名称:texmacs-mirror,代码行数:101,代码来源:qt_tm_widget.cpp


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