本文整理汇总了C++中QStandardItem::setColumnCount方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItem::setColumnCount方法的具体用法?C++ QStandardItem::setColumnCount怎么用?C++ QStandardItem::setColumnCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStandardItem
的用法示例。
在下文中一共展示了QStandardItem::setColumnCount方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addIncident
// -------- 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));
}
}
示例2: getSetRowAndColumnCount
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);
}
示例3: tr
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)") );
}
示例4: dir
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();
}
示例5: setCalibrateMethod
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" ); //
}
示例6: while
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 );
}