void SingleConnectorInfoWidget::startEdition() { createInputs(); m_nameEdit->setText(m_nameLabel->text()); m_descEdit->setText(m_descLabel->text()); toEditionMode(); emit editionStarted(); }
void SingleConnectorInfoWidget::toEditionMode() { hide(); setInEditionMode(true); hideIfNeeded(m_nameLabel); hideIfNeeded(m_nameDescSeparator); hideIfNeeded(m_descLabel); createInputs(); // first row QHBoxLayout *firstRowLayout = new QHBoxLayout(); firstRowLayout->addWidget(m_type); firstRowLayout->addSpacerItem(new QSpacerItem(10,0)); firstRowLayout->addWidget(m_nameEditContainer); firstRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); firstRowLayout->addWidget(m_removeButton); m_nameEditContainer->show(); // second row m_descEditContainer->show(); // third row if(!m_acceptButton) { m_acceptButton = new QPushButton(QObject::tr("Accept"),this); connect(m_acceptButton,SIGNAL(clicked()),this,SLOT(editionCompleted())); } m_acceptButton->show(); if(!m_cancelButton) { m_cancelButton = new QPushButton(QObject::tr("Cancel"),this); connect(m_cancelButton,SIGNAL(clicked()),this,SLOT(editionCanceled())); } m_cancelButton->show(); QHBoxLayout *thirdRowLayout = new QHBoxLayout(); thirdRowLayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding)); thirdRowLayout->addWidget(m_acceptButton); thirdRowLayout->addWidget(m_cancelButton); QVBoxLayout *layout = (QVBoxLayout*)this->layout(); layout->addLayout(firstRowLayout); layout->addWidget(m_descEditContainer); layout->addLayout(thirdRowLayout); setFixedHeight(SingleConnectorHeight*4); setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); updateGeometry(); show(); setFocus(); emit editionStarted(); }
int execFileMerger(int n = 2) { createInputs(2*n); bool result = merge(n) && check(n); if (!result) { return 1; } // Now try again but limit the number of files to test the case where we run out of file descriptor result = merge(2 * n, 2) && check( 2 * n); return result ? 0 : 1; }