本文整理汇总了C++中QSqlIndex::setDescending方法的典型用法代码示例。如果您正苦于以下问题:C++ QSqlIndex::setDescending方法的具体用法?C++ QSqlIndex::setDescending怎么用?C++ QSqlIndex::setDescending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSqlIndex
的用法示例。
在下文中一共展示了QSqlIndex::setDescending方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tr
//.........这里部分代码省略.........
}
if ( containerType() == "wCatalogue" ) {
tbl = container->table(); //new aSQLTable( o, adb );
setFilter(QString("idg=0"));
newDataId(0);
tbl->append( Q3SqlFieldInfo("system_icon") );
// tbl->setGenerated( "system_icon", false );
tbl->setCalculated("system_icon", true );
}
if ( containerType() == "wJournal" ) {
tbl = container->table(); //new aSQLTable( o, adb );
tbl->setMode( 0 );
tbl->append( Q3SqlFieldInfo( "system_icon" ) );
// tbl->setGenerated( "system_icon", false );
tbl->setCalculated( "system_icon", true );
// tbl->append( QSqlFieldInfo( "t1" ) );
// tbl->setGenerated( "t1", false );
// tbl->setCalculated("t1", true );
}
refresh();
cur->clear();
setSqlCursor(tbl,true);
refresh(RefreshColumns);
countField = numCols();
lst = property("DefIdList").toStringList();
lstHead = property("DefHeaders").toStringList();
lstWidth = property("ColWidth").toStringList();
for ( i = 0; i < countField; i++ )
{
//remove all columns in wDBTable, not in sql cursor
removeColumn( 0 );
QString s = sqlCursor()->fieldName(i);
// printf(">>>>s = %s\n",s.ascii());
// if(sqlCursor()->isCalculated(s))
// {
// if((s.left(7)=="text_uf" && lst.findIndex(s.mid(7))!=-1) || s == "system_icon")
// {
// continue;
// }
// not calculate field, if is not contents in wDBTable
// sqlCursor()->setCalculated(sqlCursor()->fieldName(i),false);
// }
}
if ( containerType() == "wJournal" ) {
addColumn( "system_icon", "", 20 );
setColumnReadOnly( 0, true );
if (md->objClass(*(container->getMDObject()))==md_journal && !((aDocJournal*) container->dataObject())->type() ) {
// we have common journal
// Insert journal system columns.
addColumn( "ddate", tr("Date"), 100 );
addColumn( "pnum", tr("Prefix"), 200 );
addColumn( "num", tr("Number"), 100 );
}
}
if ( containerType() == "wCatalogue" ) {
addColumn( "system_icon", "", 20 );
// printf("set column ro\n");
setColumnReadOnly( 0, true );
}
if ( containerType() == "wDocument" || containerType() == "wCatalogue" ) {
// Задаем сортировку по индентификатору в обратном порядке для
// табличной части документа
// чтобы при добавлении новых позиций в список строки не скакали
QSqlIndex pk = sqlCursor()->primaryIndex();
pk.setDescending( 0, false);
setSort( pk );
sqlCursor()->select();
sqlCursor()->first();
refresh();
}
//refresh(RefreshColumns);
if (md->objClass(*(container->getMDObject()))!=md_journal || ((aDocJournal*) container->dataObject())->type() ) {
// we have not common journal
for(i=0; i<lst.count();i++)
{
// assemble sql table field names
if ( containerType() == "wJournal" )
{
// str = journalFieldName(lst[i].toLong());
str = "uf"+QString::number(journalFieldId(lst[i].toLong()));
//printf(">>>>>>ss=%s\n",str.ascii());
}
else
{
str = "uf"+lst[i];
}
// add defined fields
addColumn(str,lstHead[i],lstWidth[i].toInt());
}
}
refresh(RefreshAll);
setWFieldEditor();
aLog::print(aLog::Debug, tr("wDBTable init in engine ok"));
}