Beispiel #1
0
void GPhidgetManagerWidget::UpdateSubDevicesWidgetList()
{
	GPhidgetManager* pPhidMan = qobject_cast<GPhidgetManager*>(Device());
	QLayout *pLayout = layout();
	if(!pPhidMan || !pLayout)
		return;
	QList<GDevice*> oldList = m_ListDev;
	m_ListDev = pPhidMan->m_SerialPhidgetModules.values();
	// make a list of new items in the m_ListDev
	QList<GDevice*> newDevicesInList = m_ListDev;
	foreach(GDevice* pDev, m_ListDev)
		if(oldList.contains(pDev))
			newDevicesInList.removeOne(pDev);
	// make a list of items that are gone from the m_ListDev
	QList<GDevice*> goneDevicesInList = oldList;
	foreach(GDevice* pDev, oldList)
		if(m_ListDev.contains(pDev))
			goneDevicesInList.removeOne(pDev);

	// lets delete the gone's and create the new's
	foreach(GDevice* pDev, goneDevicesInList) {
		for (int i = 0; i < pLayout->count(); ++i) {
			GDeviceWidget* pWid = qobject_cast<GDeviceWidget*>(pLayout->itemAt(i)->widget());
			if(pWid && goneDevicesInList.contains(pWid->Device())) {
				pLayout->removeWidget(pWid);
				delete pWid;
			}
		}
	}
	foreach(GDevice* pDev, newDevicesInList) {
		GDeviceWidget* subDevWidget = pDev->ProvideNewDeviceGroupBox(this);
		pLayout->addWidget(subDevWidget);
	}
Beispiel #2
0
//!-------------------------------------------------------------------------
//! 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;
    }
}
Beispiel #3
0
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;
			}
		}
	}
}
Beispiel #4
0
void MainWindow::changeScreen(QWidget* screen){
	mCurrentScreen = screen;

	QLayout* layout = ui.screenContainer->layout();
	layout->removeWidget(layout->itemAt(0)->widget());
	layout->addWidget(mCurrentScreen);
}
Beispiel #5
0
/*!
  \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] );
}
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;
	}
Beispiel #7
0
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;
}
Beispiel #8
0
void SkinStyle::removeLayout(QWidget * widget) {
    QWidget * parent = widget->parentWidget();
    if (parent) {
        QLayout * layout = parent->layout();
        if (layout) {
            layout->removeWidget(widget);
            QList<QLayout *> layouts = layout->findChildren<QLayout *>();
            for (int i = 0; i < layouts.size(); i++) {
                layouts.at(i)->removeWidget(widget);
            }
        }
    }
}
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;
}
/*!
  \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] );
}
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;
                    }
                }
            }
        }
    }
}
Beispiel #12
0
//------------------------------------------------------------------------
// 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;
    }
}
Beispiel #13
0
void ContactCluster::layout()
{
  QLayout* currLayout = (_layoutDone) ? _grid : parentWidget()->layout();

  if (_layoutDone)
  {
    currLayout->removeItem(_numberBox);
    currLayout->removeItem(_nameBox);
    currLayout->removeItem(_buttonBox);
    currLayout->removeItem(_titleBox);
  }

  if (currLayout)
  {
    currLayout->removeWidget(_label);
    currLayout->removeItem(_numberBox);
    currLayout->removeItem(_nameBox);
    currLayout->removeItem(_buttonBox);
    currLayout->removeItem(_titleBox);
    currLayout->removeWidget(_phoneLit);
    currLayout->removeWidget(_phone);
    currLayout->removeWidget(_phone2Lit);
    currLayout->removeWidget(_phone2);
    currLayout->removeWidget(_faxLit);
    currLayout->removeWidget(_fax);
    currLayout->removeWidget(_emailLit);
    currLayout->removeWidget(_email);
    currLayout->removeWidget(_webaddrLit);
    currLayout->removeWidget(_webaddr);
    currLayout->removeWidget(_address);
  }

  _grid->addWidget(_label,	0, 0, 1, -1);
  //_grid->addItem(_numberBox,    1, 0, 1, -1);  Possible implement at a later time
  _grid->addItem(_nameBox,	1, 0, 1, -1);
  _grid->addItem(_buttonBox,	2, 0, 1, -1);
  _grid->addItem(_titleBox,	3, 0, 1, -1);

  if (_minimalLayout)
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 1);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

    _grid->addWidget(_phoneLit,	4, 0);
    _grid->addWidget(_phone,	4, 1);
    _grid->addWidget(_faxLit,	4, 2);
    _grid->addWidget(_fax,	4, 3);
    _grid->addWidget(_emailLit,	4, 4);
    _grid->addWidget(_email,	4, 5);

    _grid->addWidget(_phone2Lit,	4, 0);
    _grid->addWidget(_phone2,		4, 1);
    _grid->addWidget(_webaddrLit,	4, 4);
    _grid->addWidget(_webaddr,		5, 0);
    _grid->addWidget(_address,		5, 1); //, -1, -1);
  }
  else if (_address->isVisibleTo(this))
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 3);

    _grid->addWidget(_phoneLit,		4, 0);
    _grid->addWidget(_phone,		4, 1);
    _grid->addWidget(_address,		4, 2, 5, -1);
    _grid->addWidget(_phone2Lit,	5, 0);
    _grid->addWidget(_phone2,		5, 1);
    _grid->addWidget(_faxLit,		6, 0);
    _grid->addWidget(_fax,		6, 1);
    _grid->addWidget(_emailLit,		7, 0);
    _grid->addWidget(_email,		7, 1);
    _grid->addWidget(_webaddrLit,	8, 0);
    _grid->addWidget(_webaddr,		8, 1);
  }
  else
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 2);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

    _grid->addWidget(_phoneLit,		5, 0);
    _grid->addWidget(_phone,		5, 1);
    _grid->addWidget(_faxLit,		5, 2);
    _grid->addWidget(_fax,		5, 3);
    _grid->addWidget(_webaddrLit,	5, 4);
    _grid->addWidget(_webaddr,		5, 5);
    _grid->addWidget(_phone2Lit,	6, 0);
    _grid->addWidget(_phone2,		6, 1);
    _grid->addWidget(_emailLit,		6, 2);
    _grid->addWidget(_email,		6, 3);
    _grid->addWidget(_address,		7, 0, 1, -1);
  }

  _layoutDone = true;
}
Beispiel #14
0
void ContactWidget::layout()
{
  QLayout* pwl = 0;
  if(parentWidget())
    pwl = parentWidget()->layout();
  QLayout* currLayout = (_layoutDone) ? _grid : pwl;

  if (_layoutDone)
  {
    currLayout->removeItem(_nameBox);
    currLayout->removeItem(_initialsBox);
    currLayout->removeItem(_buttonBox);
    currLayout->removeItem(_titleBox);
  }

  if (currLayout)
  {
    currLayout->removeWidget(_label);
    currLayout->removeItem(_nameBox);
    currLayout->removeItem(_buttonBox);
    currLayout->removeItem(_titleBox);
    currLayout->removeWidget(_phoneLit);
    currLayout->removeWidget(_phone);
    currLayout->removeWidget(_phone2Lit);
    currLayout->removeWidget(_phone2);
    currLayout->removeWidget(_faxLit);
    currLayout->removeWidget(_fax);
    currLayout->removeWidget(_emailLit);
    currLayout->removeWidget(_email);
    currLayout->removeWidget(_webaddrLit);
    currLayout->removeWidget(_webaddr);
    currLayout->removeWidget(_address);
  }

  _grid->addWidget(_label,	0, 0, 1, -1);
  //_grid->addItem(_numberBox,    1, 0, 1, -1);  Possible implement at a later time
  _grid->addWidget(_nameLit,    1, 0, 1, 1);
  _grid->addItem(_nameBox,	1, 1, 1, -1);
  _grid->addWidget(_initialsLit,2, 0, 1, 1);
  _grid->addItem(_initialsBox,  2, 1, 1, -1);
  _grid->addWidget(_active,       2, 2, 1, -1);
  _grid->addItem(_buttonBox,	3, 0, 1, -1);
  _grid->addWidget(_titleLit,   4, 0, 1, 1);
  _grid->addItem(_titleBox,	4, 1, 1, -1);

  if (_minimalLayout)
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 1);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

    _grid->addWidget(_phoneLit,	5, 0);
    _grid->addWidget(_phone,	5, 1);
    _grid->addWidget(_faxLit,	5, 2);
    _grid->addWidget(_fax,	5, 3);
    _grid->addWidget(_emailLit,	5, 4);
    _grid->addWidget(_email,	5, 5);

    _grid->addWidget(_phone2Lit,	5, 0);
    _grid->addWidget(_phone2,		5, 1);
    _grid->addWidget(_webaddrLit,	5, 4);
    _grid->addWidget(_webaddr,		6, 0);
    _grid->addWidget(_address,		6, 1); //, -1, -1);
  }
  else if (_address->isVisibleTo(this))
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 3);

    _grid->addWidget(_phoneLit,		5, 0);
    _grid->addWidget(_phone,		5, 1);
    _grid->addWidget(_address,		5, 2, 5, -1);
    _grid->addWidget(_phone2Lit,	6, 0);
    _grid->addWidget(_phone2,		6, 1);
    _grid->addWidget(_faxLit,		7, 0);
    _grid->addWidget(_fax,		7, 1);
    _grid->addWidget(_emailLit,		8, 0);
    _grid->addWidget(_email,		8, 1);
    _grid->addWidget(_webaddrLit,	9, 0);
    _grid->addWidget(_webaddr,		9, 1);
  }
  else
  {
    _grid->setColumnStretch(0, 0);
    _grid->setColumnStretch(1, 1);
    _grid->setColumnStretch(2, 0);
    _grid->setColumnStretch(3, 2);
    _grid->setColumnStretch(4, 0);
    _grid->setColumnStretch(5, 2);

    _grid->addWidget(_phoneLit,		6, 0);
    _grid->addWidget(_phone,		6, 1);
    _grid->addWidget(_faxLit,		6, 2);
    _grid->addWidget(_fax,		6, 3);
    _grid->addWidget(_webaddrLit,	6, 4);
    _grid->addWidget(_webaddr,		5, 5);
    _grid->addWidget(_phone2Lit,	7, 0);
    _grid->addWidget(_phone2,		7, 1);
    _grid->addWidget(_emailLit,		7, 2);
    _grid->addWidget(_email,		7, 3);
    _grid->addWidget(_address,		8, 0, 1, -1);
  }

#if defined Q_WS_MAC
  setMinimumSize(_grid->columnCount() * 50, _grid->rowCount() * 11);
#endif
  _layoutDone = true;
}
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 );
      layout->addRow( "Mag filter:", tabDef.m_magFilter );
      layout->addRow( "Mip filter:", tabDef.m_mipFilter );


      // determine state of the links - if all object in a group contain the same value, link them
      // together
      {
         tabDef.m_addressingModesLinked = ( stageSettings.m_addressU == stageSettings.m_addressV && stageSettings.m_addressV == stageSettings.m_addressW );
         tabDef.m_filteringModesLinked = ( stageSettings.m_minFilter == stageSettings.m_magFilter && stageSettings.m_magFilter == stageSettings.m_mipFilter );

         updateAddressingModesLinkState( i );
         updateFiltersLinkState( i );
      }
   }


   m_textureStagesTabs->setCurrentIndex( activeTabIdx );
}
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();
      QWidget* old_qwidget = sideTools->widget();
      if (old_qwidget) old_qwidget->deleteLater();
      sideTools->setWidget (new_qwidget);
      update_visibility();
      new_qwidget->show();
    }
      break;

    case SLOT_BOTTOM_TOOLS:
      check_type_void (index, s);
    {   
      bottom_tools_widget = concrete (w);
      QWidget* new_qwidget = bottom_tools_widget->as_qwidget();
      QWidget* old_qwidget = bottomTools->widget();
      if (old_qwidget) old_qwidget->deleteLater();
      bottomTools->setWidget (new_qwidget);
      update_visibility();
      new_qwidget->show();
    }
      break;
      
    case SLOT_INTERACTIVE_PROMPT:
      check_type_void (index, s);
      int_prompt= concrete (w);
      break;
      
    case SLOT_INTERACTIVE_INPUT:
      check_type_void (index, s);
      int_input= concrete (w);
      break;

    default:
      qt_window_widget_rep::write (s, index, w);
  }
}