Exemple #1
0
void
IsotopeForm::OnInitialUpdate()
{
    QStandardItemModel& model = *pModel_;
    
    QStandardItem * rootNode = model.invisibleRootItem();
    ui->treeView->setItemDelegate( pDelegate_.get() );

    rootNode->setColumnCount(4);
	model.setHeaderData( 0, Qt::Horizontal, "Structure" );
    model.setHeaderData( 1, Qt::Horizontal, "Formula" );
    model.setHeaderData( 2, Qt::Horizontal, "Exact mass" );

	ui->treeView->setColumnWidth( 0, 100 );
	ui->treeView->setColumnWidth( 1, 80 );
	ui->treeView->setColumnWidth( 2, 80 );
	ui->treeView->setColumnHidden( 3, true );  // CTable
	//----
	//StandardItemHelper::appendRow( rootNode, "Formula", "" );
	//StandardItemHelper::appendRow( rootNode, "Mass Tolerance[Da]", "yy" );
	//StandardItemHelper::appendRow( rootNode, "Minimum RA[%]",      "zz" );

    //--------------
	//ui->treeView->expand( scanType->index() );
}
// -------- QTestFunction
void QTestFunction::addIncident(IncidentType type,
                                const QString &file,
                                const QString &line,
                                const QString &details)
{
    QStandardItem *status = new QStandardItem(incidentString(type));
    status->setData(QVariant::fromValue(type));

    switch (type) {
        case QTestFunction::Pass: status->setForeground(Qt::green); break;
        case QTestFunction::Fail: status->setForeground(Qt::red); break;
        case QTestFunction::XFail: status->setForeground(Qt::darkMagenta); break;
        case QTestFunction::XPass: status->setForeground(Qt::darkGreen); break;
    }

    QStandardItem *location = new QStandardItem;
    if (!file.isEmpty()) {
        location->setText(file + QLatin1Char(':') + line);
        location->setForeground(Qt::red);

        QTestLocation loc;
        loc.file = file;
        loc.line = line;
        location->setData(QVariant::fromValue(loc));
    }

    appendRow(QList<QStandardItem *>() << status << location);

    if (!details.isEmpty()) {
        status->setColumnCount(2);
        status->appendRow(QList<QStandardItem *>() << new QStandardItem() << new QStandardItem(details));
    }
}
Exemple #3
0
void tst_QStandardItem::getSetRowAndColumnCount()
{
    QStandardItem item;

    item.setRowCount(-1);
    QCOMPARE(item.rowCount(), 0);

    item.setColumnCount(-1);
    QCOMPARE(item.columnCount(), 0);

    item.setRowCount(1);
    QCOMPARE(item.rowCount(), 1);
    QCOMPARE(item.columnCount(), 0);

    item.setColumnCount(1);
    QCOMPARE(item.columnCount(), 1);
    QCOMPARE(item.rowCount(), 1);

    item.setColumnCount(10);
    QCOMPARE(item.columnCount(), 10);
    QCOMPARE(item.rowCount(), 1);

    item.setRowCount(20);
    QCOMPARE(item.rowCount(), 20);
    QCOMPARE(item.columnCount(), 10);

    item.setRowCount(-1);
    QCOMPARE(item.rowCount(), 20);

    item.setColumnCount(-1);
    QCOMPARE(item.columnCount(), 10);

    item.setColumnCount(0);
    QCOMPARE(item.columnCount(), 0);
    QCOMPARE(item.rowCount(), 20);

    item.setRowCount(0);
    QCOMPARE(item.rowCount(), 0);
}
Exemple #4
0
void
TargetingAdducts::OnInitialUpdate()
{
    using namespace adwidgets::detail;
	QStandardItemModel& model = *model_;

    QStandardItem * rootNode = model.invisibleRootItem();
    rootNode->setColumnCount( nbrColumns );

    model.setRowCount( nbrRows );
    
    model.setData( model.index( r_pos_adducts, c_header ),  tr("Adducts(pos)") );
    model.setData( model.index( r_neg_adducts, c_header ),  tr("Adducts/Losses(neg)") );

}
Exemple #5
0
void
SequenceWnd::OnInitialUpdate( const adsequence::schema& schema )
{
    boost::filesystem::path dir( adportable::profile::user_data_dir<char>() );
    dir /= "data";
    dir /= adportable::date_string::string( boost::posix_time::second_clock::local_time().date() );

    ui->lineEditName->setText( ( dir / "sequence.sequ" ).string().c_str() );
    ui->lineEditDataDir->setText( dir.string().c_str() );

    QStandardItem * rootnode = model_->invisibleRootItem();
    size_t ncols = std::distance( schema.begin(), schema.end() );
    rootnode->setColumnCount( static_cast<int>(ncols) );

    for ( adsequence::schema::vector_type::const_iterator it = schema.begin(); it != schema.end(); ++it )
        model_->setHeaderData( std::distance( schema.begin(), it ), Qt::Horizontal, it->display_name().c_str() );
    
    for ( int i = 0; i < 3; ++i )
        addLine();
}
void
MSCalibrationForm::OnInitialUpdate()
{
    QStandardItemModel& model = *pModel_;
    adcontrols::MSCalibrateMethod& method = *pMethod_;
	QTableView& table = *ui->tableView;

    QStandardItem * rootNode = model.invisibleRootItem();
    table.setItemDelegate( pDelegate_.get() );

    rootNode->setColumnCount( c_num_columns );
    model.setHeaderData( c_formula,     Qt::Horizontal, "Chemical formula" );
    model.setHeaderData( c_exact_mass,  Qt::Horizontal, "exact mass" );
    model.setHeaderData( c_enable,      Qt::Horizontal, "enable" );
    model.setHeaderData( c_description, Qt::Horizontal, "Description" );
	model.setHeaderData( c_charge,      Qt::Horizontal, "charge" );

    setCalibrateMethod( method );

    table.setColumnWidth( 0, 200 );
    table.setColumnWidth( c_charge, 80 );
	table.verticalHeader()->setDefaultSectionSize( 18 );

	table.setSortingEnabled(true);

	ui->comboBoxMaterials->addItem( "Ar", "Ar" );
	ui->comboBoxMaterials->addItem( "Xe", "Xe" );
	ui->comboBoxMaterials->addItem( "PFTBA", "PFTBA" );
	ui->comboBoxMaterials->addItem( "PEG", "H2O\tC2H4O\tH" );
	ui->comboBoxMaterials->addItem( "Recerpine", "C33H40N2O9\t\tH" );
	ui->comboBoxMaterials->addItem( "Polystyrene", "H2O\tC8H8\tH" );
	ui->comboBoxMaterials->addItem( "Jeffamine(D230)", "CH3CH(NH2)CH2NH2\tOCH2CH(CH3)\tH" );
	ui->comboBoxMaterials->addItem( "Sulfa drug (311)", "C12H14N4O4S\t\tH" );
	ui->comboBoxMaterials->addItem( "AgilentTOF Mix(+)", "AgilentTOF Mix(+)" );
	ui->comboBoxMaterials->addItem( "AgilentTOF Mix(-)", "AgilentTOF Mix(-)" );
	ui->comboBoxMaterials->addItem( "Anionic Surfactants 1(-)", "C12H26SO4\tC2H4O\t-H\t" ); // negative
	ui->comboBoxMaterials->addItem( "Anionic Surfactants 2(-)", "C13H28SO4\tC2H4O\t-H\t" ); // negative only
	ui->comboBoxMaterials->addItem( "Sodium acetate", "\tCH3COONa\tNa\t" ); //
}
void
MSCalibrationForm::OnInitialUpdate()
{
    QStandardItemModel& model = *pModel_;
    adcontrols::MSCalibrateMethod& method = *pMethod_;

    QStandardItem * rootNode = model.invisibleRootItem();
    ui->treeView->setItemDelegate( pDelegate_.get() );

    rootNode->setColumnCount(4);
    model.setHeaderData( 0, Qt::Horizontal, "MSCaribrate" );
    for ( int i = 1; i < rootNode->columnCount(); ++i )
        model.setHeaderData( 1, Qt::Horizontal, "" );

//----
    StandardItemHelper::appendRow( rootNode, "Polynomial[degree]", method.polynomialDegree() );
    StandardItemHelper::appendRow( rootNode, "Mass Tolerance[Da]", method.massToleranceDa() );
    StandardItemHelper::appendRow( rootNode, "Minimum RA[%]",      method.minimumRAPercent() );
    StandardItemHelper::appendRow( rootNode, "Low Mass[Da]",       method.lowMass() );
    StandardItemHelper::appendRow( rootNode, "High Mass[Da]",      method.highMass() );

    //------ create Xe reference -------
    adcontrols::MSReferences Xe;
    Xe.name( L"Xe-EI-Positive" );
#if 0
    // adcontrols::MSReferenceDefns Xe;
    do {
        adcontrols::MSReferences& ref = Xe;
        ref << adcontrols::MSReference( L"126Xe", true, L"", false );
        ref << adcontrols::MSReference( L"128Xe", true, L"", false );
        ref << adcontrols::MSReference( L"129Xe", true, L"", true );
        ref << adcontrols::MSReference( L"130Xe", true, L"", false );
        ref << adcontrols::MSReference( L"131Xe", true, L"", false );
        ref << adcontrols::MSReference( L"132Xe", true, L"", false );
        ref << adcontrols::MSReference( L"134Xe", true, L"", false );
        ref << adcontrols::MSReference( L"136Xe", true, L"", true );
    } while(0);
#endif
    // ---------------------------------
    //------ create PFTBA < tris(Perfluorobutyl)amine > reference -------
    adcontrols::MSReferences PFTBA;
    PFTBA.name( L"PFTBA-EI-Positive" );
    do {
        adcontrols::MSReferences& ref = PFTBA;
        ref << adcontrols::MSReference( L"CF3",     true,  L"", true );
        ref << adcontrols::MSReference( L"C2F4",    true,  L"", false );
        ref << adcontrols::MSReference( L"C2F5",    true,  L"", false );
        ref << adcontrols::MSReference( L"C3F5",    true,  L"", true );
        ref << adcontrols::MSReference( L"C4F9",    true,  L"", true );
        ref << adcontrols::MSReference( L"C5F10N",  true,  L"", true );
        ref << adcontrols::MSReference( L"C6F12N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C7F12N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C8F14N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C8F16N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C9F16N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C9F18N",  true,  L"", false );
        ref << adcontrols::MSReference( L"C9F20N",  true,  L"", true );
        ref << adcontrols::MSReference( L"C12F22N", true,  L"", false );
        ref << adcontrols::MSReference( L"C12F24N", true,  L"", false );
    } while(0);
    // ---------------------------------

    pDelegate_->refs_[ Xe.name() ] = Xe;
    pDelegate_->refs_[ PFTBA.name() ] = PFTBA;

    pMethod_->references( PFTBA );  // set as default calibration reference

    QStandardItem * refItem = 
        StandardItemHelper::appendRow( rootNode, "Mass References", qVariantFromValue( MSCalibrateDelegate::MSReferences( pMethod_->references().name() ) ) );

    OnMSReferencesUpdated( refItem->index() );

    ui->treeView->expand( refItem->index() );
    ui->treeView->setColumnWidth( 0, 200 );
}