本文整理汇总了C++中setTable函数的典型用法代码示例。如果您正苦于以下问题:C++ setTable函数的具体用法?C++ setTable怎么用?C++ setTable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Q_UNUSED
void HiddenTableModel::setTableModel(int id) {
Q_UNUSED(id);
QSqlQuery query;
const QString tableName("hidden_songs");
QStringList columns;
columns << "library." + LIBRARYTABLE_ID;
QString filter("mixxx_deleted=1");
query.prepare("CREATE TEMPORARY VIEW IF NOT EXISTS " + tableName + " AS "
"SELECT "
+ columns.join(",") +
" FROM library "
"INNER JOIN track_locations "
"ON library.location=track_locations.id "
"WHERE " + filter);
if (!query.exec()) {
qDebug() << query.executedQuery() << query.lastError();
}
//Print out any SQL error, if there was one.
if (query.lastError().isValid()) {
qDebug() << __FILE__ << __LINE__ << query.lastError();
}
QStringList tableColumns;
tableColumns << LIBRARYTABLE_ID;
setTable(tableName, LIBRARYTABLE_ID, tableColumns,
m_pTrackCollection->getTrackSource());
setDefaultSort(fieldIndex("artist"), Qt::AscendingOrder);
setSearch("");
}
示例2: setTable
void cNPC::save()
{
if ( changed_ )
{
initSave;
setTable( "npcs" );
addField( "serial", serial() );
addField( "summontime", summonTime_ ? summonTime_ - Server::instance()->time() : 0 );
addField( "additionalflags", additionalFlags_ );
addField( "owner", owner_ ? owner_->serial() : INVALID_SERIAL );
addField( "stablemaster", stablemasterSerial_ );
addStrField( "ai", aiid_ );
addField( "wandertype", ( Q_UINT8 ) wanderType() );
addField( "wanderx1", wanderX1() );
addField( "wanderx2", wanderX2() );
addField( "wandery1", wanderY1() );
addField( "wandery2", wanderY2() );
addField( "wanderradius", wanderRadius() );
addCondition( "serial", serial() );
saveFields;
}
cBaseChar::save();
}
示例3: setTable
void cNPC::save()
{
if ( changed_ )
{
initSave;
setTable( "npcs" );
addField( "serial", serial() );
addField( "mindamage", minDamage_);
addField( "maxdamage", maxDamage_);
addField( "tamingminskill", tamingMinSkill_);
addField( "summontime", summonTime_ ? summonTime_ - uiCurrentTime : 0 );
addField( "additionalflags", additionalFlags_ );
addField( "owner", owner_ ? owner_->serial() : INVALID_SERIAL );
addStrField( "carve", carve_);
addStrField( "spawnregion", spawnregion_);
addField( "stablemaster", stablemasterSerial_ );
addStrField( "lootlist", lootList_);
addStrField( "ai", aiid_ );
addField( "wandertype", (UINT8)wanderType() );
addField( "wanderx1", wanderX1() );
addField( "wanderx2", wanderX2() );
addField( "wandery1", wanderY1() );
addField( "wandery2", wanderY2() );
addField( "wanderradius", wanderRadius() );
addField( "fleeat", criticalHealth() );
addField( "spellslow", spellsLow_ );
addField( "spellshigh", spellsHigh_ );
addField( "controlslots", controlSlots_ );
addCondition( "serial", serial() );
saveFields;
}
cBaseChar::save();
}
示例4: QSqlTableModel
MEstablecimiento::MEstablecimiento( QObject *parent )
: QSqlTableModel( parent )
{
setTable( "car_establecimientos" );
setHeaderData( 0, Qt::Horizontal, "#ID" );
setHeaderData( 1, Qt::Horizontal, "Nombre" );
setHeaderData( 2, Qt::Horizontal, "#RESMPA" );
}
示例5: QSqlTableModel
MDescuentos::MDescuentos(QObject *parent) :
QSqlTableModel(parent)
{
setTable( "descuentos" );
_seleccionado = false;
_id_comprobante = -1;
_tipo = Invalido;
}
示例6: setTable
/*!
Performs persistency layer saves.
*/
void cUObject::save()
{
bool havetags_ = ( tags_.size() > 0 );
// uobjectmap fields
// If the type is changed somewhere in the code
// That part needs to take care of delete/recreate
// So we never update the type EVER here..
if( !isPersistent )
{
initSave;
setTable( "uobjectmap" );
addField( "serial", serial_ );
addStrField( "type", QString( objectID() ) );
addCondition( "serial", serial_ );
saveFields;
clearFields;
}
// uobject fields
if ( changed_ )
{
initSave;
setTable( "uobject" );
addStrField( "name", name_ );
addField( "serial", serial_ );
addField( "multis", multis_ );
addField( "direction", dir_);
addField( "pos_x", pos_.x );
addField( "pos_y", pos_.y );
addField( "pos_z", pos_.z );
addField( "pos_map", pos_.map );
addStrField( "events", eventList_ == QString::null ? QString( "" ) : eventList_ );
addStrField( "bindmenu", bindmenu_ );
addCondition( "serial", serial_ );
addField( "havetags", havetags_ );
saveFields;
}
if( havetags_ )
{
tags_.save( serial_ );
}
PersistentObject::save();
flagUnchanged(); // This is the botton of the chain, now go up and flag everyone unchanged.
}
示例7: setTable
/*!
Performs persistency layer saves.
*/
void cUObject::save()
{
bool havetags_ = ( tags_.size() > 0 );
// uobjectmap fields
initSave;
// If the type is changed somewhere in the code
// That part needs to take care of delete/recreate
// So we never update the type EVER here..
if( !isPersistent )
{
setTable( "uobjectmap" );
addField( "serial", serial_ );
addStrField( "type", objectID() );
addCondition( "serial", serial_ );
saveFields;
clearFields;
}
// uobject fields
if ( changed_ )
{
setTable( "uobject" );
addStrField( "name", name_ );
addField( "serial", serial_ );
addField( "multis", multis_ );
addField( "pos_x", pos_.x );
addField( "pos_y", pos_.y );
addField( "pos_z", pos_.z );
addField( "pos_map", pos_.map );
addStrField( "events", eventList_.join( "," ) );
addStrField( "bindmenu", bindmenu_ );
addCondition( "serial", serial_ );
addField( "havetags", havetags_ );
saveFields;
}
if( havetags_ )
{
tags_.save( serial_ );
}
PersistentObject::save();
changed_ = false;
}
示例8: QSqlRelationalTableModel
ContentTypesModel::ContentTypesModel(int id, QObject *parent, QSqlDatabase db) :
QSqlRelationalTableModel(parent, db) {
_id = id;
_f = "";
_begin = 0;
_limit = 25;
setTable("app_content_type");
}
示例9: QSqlTableModel
DTScheduleModel::DTScheduleModel(QObject *parent, QSqlDatabase db) :
QSqlTableModel(parent, db),
mStartDate(QDate()),
mEndDate(QDate()),
mStartColIndex(-1),
mDurationColIndex(-1)
{
setTable("RECEPTION");
}
示例10: QSqlTableModel
MPrefCategorias::MPrefCategorias(QObject *parent)
: QSqlTableModel(parent)
{
setTable( "car_categorias" );
setHeaderData( 0, Qt::Horizontal, "#id_db" );
setHeaderData( 1, Qt::Horizontal, "Categoria" );
setHeaderData( 2, Qt::Horizontal, "Especial" );
setEditStrategy( QSqlTableModel::OnManualSubmit );
}
示例11: QSqlTableModel
MCajas::MCajas(QObject *parent ) :
QSqlTableModel(parent)
{
setTable( "caja" );
this->setHeaderData( 0, Qt::Horizontal, "#ID" );
this->setHeaderData( 1, Qt::Horizontal, "Nombre" );
this->setHeaderData( 2, Qt::Horizontal, "Fecha de Alta" );
this->setHeaderData( 3, Qt::Horizontal, "Saldo Actual" );
}
示例12: QSqlRelationalTableModel
MealModel::MealModel(int meal, QObject *parent) : QSqlRelationalTableModel(parent), meal(meal)
{
setTable("menu");
setRelation(2, QSqlRelation("recipes", "id", "name"));
setFilter(QString("meal='%1'").arg(meal));
sort(2, Qt::AscendingOrder);
select();
setSupportedDragActions(Qt::MoveAction);
}
示例13: setTable
ReferTableModel::ReferTableModel(QObject *parent)
{
setTable("referNode");
setSort(1, Qt::AscendingOrder);
setHeaderData(1, Qt::Horizontal, tr("NetID"));
setHeaderData(2, Qt::Horizontal, tr("Floor"));
setHeaderData(3, Qt::Horizontal, tr("Number"));
setHeaderData(4, Qt::Horizontal, tr("TMP_Period"));
select();
}
示例14: QSqlRelationalTableModel
MVPresupuestos::MVPresupuestos(QObject *parent) :
QSqlRelationalTableModel(parent)
{
setTable( "v_presupuestos" );
setHeaderData( 0, Qt::Horizontal, "#ID" );
setHeaderData( 1, Qt::Horizontal, "#Presupuesto" );
setHeaderData( 2, Qt::Horizontal, "Destinatario" );
setHeaderData( 3, Qt::Horizontal, "Fecha" );
setHeaderData( 4, Qt::Horizontal, "Total" );
}
示例15: Q_UNUSED
void BaseExternalTrackModel::setTableModel(int id) {
Q_UNUSED(id);
QStringList columns;
columns << "id";
// TODO(XXX) preview column, needs a temporary view
setTable(m_trackTable, columns[0], columns,
m_pTrackCollection->getTrackSource(m_trackSource));
setDefaultSort(fieldIndex("artist"), Qt::AscendingOrder);
initHeaderData();
}