예제 #1
0
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;
    }
}
예제 #2
0
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);
  }

}
예제 #3
0
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);
	}
}
예제 #4
0
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));
    }

}
예제 #5
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;
}
예제 #6
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;
}