当前位置: 首页>>代码示例>>C++>>正文


C++ QDjangoQuerySet::at方法代码示例

本文整理汇总了C++中QDjangoQuerySet::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QDjangoQuerySet::at方法的具体用法?C++ QDjangoQuerySet::at怎么用?C++ QDjangoQuerySet::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDjangoQuerySet的用法示例。


在下文中一共展示了QDjangoQuerySet::at方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: filtred_Patients

void Patient::filtred_Patients(){
    ui->lw_filtredPatients->clear();
    QDjangoQuerySet <Paciente> pat;
    if (!ui->le_patFILTER->text().isEmpty())
        pat = pat.filter(QDjangoWhere("nameP", QDjangoWhere::Contains, ui->le_patFILTER->text()));
else
    if(!ui->le_prontSearch->text().isEmpty())
        pat = pat.filter(QDjangoWhere("pront", QDjangoWhere::Contains, ui->le_prontSearch->text()));

    for (int i = 0; i < pat.count(); ++i){
        QListWidgetItem * itemP = new QListWidgetItem(pat.at(i)->nameP(), ui->lw_filtredPatients);
        itemP->setData(Qt::UserRole, pat.at(i)->pront());
    }
}
开发者ID:LCapanelli,项目名称:RP3,代码行数:14,代码来源:patient.cpp

示例2: filterRelated

/** Perform filtering on foreign keys.
 */
void tst_QDjangoModel::filterRelated()
{
    // load fixtures
    {
        Item *item1 = new Item;
        item1->setName("first");
        QCOMPARE(item1->save(), true);

        Item *item2 = new Item;
        item2->setName("second");
        QCOMPARE(item2->save(), true);

        Owner owner;
        owner.setName("owner");
        owner.setItem1(item1);
        owner.setItem2(item2);
        QCOMPARE(owner.save(), true);
    }

    // perform filtering
    QDjangoQuerySet<Owner> owners;

    QDjangoQuerySet<Owner> qs = owners.filter(
        QDjangoWhere("item1__name", QDjangoWhere::Equals, "first"));
    CHECKWHERE(qs.where(), QLatin1String("T0.\"name\" = ?"), QVariantList() << "first");
    QCOMPARE(qs.count(), 1);
    QCOMPARE(qs.size(), 1);

    Owner *owner = qs.at(0);
    QVERIFY(owner != 0);
    QCOMPARE(owner->name(), QLatin1String("owner"));
    delete owner;
}
开发者ID:explicitcall,项目名称:qdjango,代码行数:35,代码来源:main.cpp

示例3: listUpdate

void Explorer::listUpdate(){
    QDjangoQuerySet <Diagnostico> idDiag ,nomeD, num01, num02, idDom, definicao, cDefin, fRelac;
        QList<qint32> idList;
    QList <int> idDomList;
    QStringList nameList, num01List, num02List, defList, cDList, fRelList;

    //! Fills QLists whit content from Diagnostico ORM
    for(int i = 0; i < nomeD.count() && idDiag.count() && num01.count(); ++i){
        idList << idDiag.at(i)->idDiag();
        num01List << num01.at(i)->num01();
        nameList << nomeD.at(i)->nomeDiag();
        num02List << num02.at(i)->num02();
        idDomList << idDom.at(i)->idDom();
        defList << definicao.at(i)->definicao();
        cDList << cDefin.at(i)->cDefin();
        fRelList << fRelac.at(i)->fRelac();
    }

    //! Fills the GUI TableWidget by column from Diagnos DATA
    for(int i = 0; i < nameList.count(); ++i){
        ui->tW_showDiagnosReadyOnly->setRowCount(nameList.count());
        //ui->tW_showDiagnosReadyOnly->setItem(i, 0, new QTableWidgetItem(idList.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 0, new QTableWidgetItem(num01List.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 1, new QTableWidgetItem(nameList.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 2, new QTableWidgetItem(idDomList.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 3, new QTableWidgetItem(num02List.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 4, new QTableWidgetItem(defList.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 5, new QTableWidgetItem(cDList.at(i)));
        ui->tW_showDiagnosReadyOnly->setItem(i, 6, new QTableWidgetItem(fRelList.at(i)));
    }
}
开发者ID:LCapanelli,项目名称:RP3,代码行数:31,代码来源:explorer.cpp

示例4: saveMessage

static void saveMessage(const QXmppMessage &message, const QDateTime &now, bool received)
{
    const QString localJid = QXmppUtils::jidToBareJid(received ? message.to() : message.from());
    const QString remoteJid = QXmppUtils::jidToBareJid(received ? message.from() : message.to());

    // get or create collection
    int chatId;
    QDjangoQuerySet<ArchiveMessage> qs;
    qs = qs.filter(QDjangoWhere("chat__jid", QDjangoWhere::Equals, localJid));
    qs = qs.filter(QDjangoWhere("chat__with", QDjangoWhere::Equals, remoteJid));
    qs = qs.orderBy(QStringList() << "-date").limit(0, 1);
    ArchiveMessage tmp;
    if (qs.size() > 0 && qs.at(0, &tmp) && tmp.date().secsTo(now) < 3600) {
        chatId = tmp.property("chat_id").toInt();
    } else {
        ArchiveChat chat;
        chat.setJid(localJid);
        chat.setWith(remoteJid);
        chat.setStart(now);
        chat.save();
        chatId = chat.pk().toInt();
    }

    // save outgoing message
    ArchiveMessage msg;
    msg.setProperty("chat_id", chatId);
    msg.setBody(message.body());
    msg.setDate(now);
    msg.setReceived(received);
    msg.save();
}
开发者ID:jlaine,项目名称:xmpp-share-server,代码行数:31,代码来源:mod_archive.cpp

示例5: on_lw_filtredPatients_itemClicked

//! When a Patient is clicked those informations is showed in a QTableWidget
void Patient::on_lw_filtredPatients_itemClicked(QListWidgetItem* item)
{
    QDjangoQuerySet<Paciente> ptPront;
    ptPront = ptPront.filter(QDjangoWhere("nameP", QDjangoWhere::Equals, ui->lw_filtredPatients->currentItem()->text()));
    for(int i = 0; i < ptPront.count(); ++i){
        QString t;
        QSqlQuery s;
        s.prepare("SELECT pront FROM sae.paciente WHERE nameP = :name");
        s.bindValue(":name", ui->lw_filtredPatients->currentItem()->text());
        s.exec();
        while (s.next()){
            t = s.value(0).toString();
        }
        ui->tblW_selectedPatient->setItem(0, 0, new QTableWidgetItem(t));
        ui->tblW_selectedPatient->setItem(0, 1, new QTableWidgetItem(ptPront.at(i)->rg()));
        ui->tblW_selectedPatient->setItem(0, 2, new QTableWidgetItem(ptPront.at(i)->dBornP().toString("dd / MM / yyyy")));
        ui->tblW_selectedPatient->setItem(0, 3, new QTableWidgetItem(ptPront.at(i)->mailP()));
        ui->tblW_selectedPatient->setItem(0, 4, new QTableWidgetItem(ptPront.at(i)->ethn()));
    }
}
开发者ID:LCapanelli,项目名称:RP3,代码行数:21,代码来源:patient.cpp

示例6: getCurrentName

QString LoggerSettingsModel::getCurrentName()
{
    QDjangoQuerySet<LoggerSettingsQDjangoModel> settings;

    LoggerSettingsQDjangoModel setting;
    for (int i = 0; i < settings.size(); ++i) {
        if (settings.at(i, &setting)) {
            return setting.currentLoggerName();
        }
    }
    return QString("");
}
开发者ID:gen1izh,项目名称:cpp,代码行数:12,代码来源:loggersettingsmodel.cpp

示例7: existe

bool NouveauxProduitsDialog::existe( QString code )
{
    QDjangoQuerySet< Core::Produit > produits;
    int l = produits.size();

    for(  int i = 0; i < l; ++i )
    {
        Core::Produit *p = produits.at( i );
        if( p->getCode() == code )
            return true;
    }

    return false;
}
开发者ID:Shiryu,项目名称:ManShop,代码行数:14,代码来源:nouveauxproduitsdialog.cpp

示例8: setCurrentName

void LoggerSettingsModel::setCurrentName(const QString &currentName)
{
    QDjangoQuerySet<LoggerSettingsQDjangoModel> settings;

    for (int i = 0; i < settings.size(); ++i) {
        LoggerSettingsQDjangoModel setting;
        if (settings.at(i, &setting)) {
            setting.setCurrentLoggerName(currentName);
            setting.save();
            return;
        }
    }
    LoggerSettingsQDjangoModel *setting = new LoggerSettingsQDjangoModel;
    setting->setCurrentLoggerName(currentName);
    setting->save();
}
开发者ID:gen1izh,项目名称:cpp,代码行数:16,代码来源:loggersettingsmodel.cpp

示例9: renderData

void GroupsWidget::renderData() {
  FUNCTION
  QDjangoQuerySet<Group> gqs = QDjangoQuerySet<Group>().all();

  ui->groupsTW->setRowCount(gqs.size());

  for(qint32 i = 0; i < gqs.size(); ++i) {
    Group* group = gqs.at(i);
    _groups.append(group);

    QTableWidgetItem* item0 = new QTableWidgetItem(group->name());
    Normal* normal = QDjangoQuerySet<Normal>().get(QDjangoWhere("group_id", QDjangoWhere::Equals, group->pk()));
    QTableWidgetItem* item1 = new QTableWidgetItem(QString::number(normal->speed()));
    qint32 userCount = QDjangoQuerySet<User>().filter(QDjangoWhere("group_id", QDjangoWhere::Equals, group->pk())).size();
    QTableWidgetItem* item2 = new QTableWidgetItem(QString::number(userCount));

    ui->groupsTW->setItem(i, 0, item0);
    ui->groupsTW->setItem(i, 1, item1);
    ui->groupsTW->setItem(i, 2, item2);
  }
}
开发者ID:EPecherkin,项目名称:diplom,代码行数:21,代码来源:groupswidget.cpp

示例10: on_btValider_clicked

void NouveauxProduitsDialog::on_btValider_clicked()
{
    QDjangoQuerySet< Core::Temp > produits;
    int l = produits.size();

    for( int i = 0; i < l; ++i )
    {
        Core::Temp *t = produits.at( i );

        Core::Produit *p = new Core::Produit();
        p->setCode( t->getCode() );
        p->setConstructeur( t->getConstructeur() );
        p->setNom( t->getNom() );
        p->setDescription( t->getDescription() );
        p->setType( t->getType() );
        p->setPrixUnitaire( t->getPrixUnitaire() );
        p->save();
    }

    produits.remove();

}
开发者ID:Shiryu,项目名称:ManShop,代码行数:22,代码来源:nouveauxproduitsdialog.cpp

示例11: addPromission

PromissionModel::PromissionModel()
{
    QDjango::setDatabase(*Core::Base::instance().sessionDatabase());
    QDjango::registerModel<Promission>();
    QDjango::createTables();

    // Создаем роль по-умолчанию
    QDjangoQuerySet<Role> roles;
    roles = roles.filter(QDjangoWhere("name", QDjangoWhere::Equals, "Admin"));

    if (roles.count()==0) {
        messageLibrary msg;
        msg.createInfoMessage("Информация",
                              "Роль администратора отсутствует, разрешения по-умолчанию создать не могу!");
    }
    else {
        addPromission( tr("Возможность смотреть документацию приложения"),    "CAN_SEE_APP_DOCS",          "CONST", roles.at(0) );
        addPromission( tr("Возможность смотреть настройки приложения"),       "CAN_SEE_APP_SETTINGS",      "CONST", roles.at(0) );
        addPromission( tr("Возможность смотреть меню плагинов приложения"), "CAN_SEE_MANAGERS_MENU",     "CONST", roles.at(0) );
        addPromission( tr("Возможность управлять настройками плагинов"),    "CAN_SEE_MANAGERS_SETTINGS", "CONST", roles.at(0) );
        addPromission( tr("Возможность работать с панелями плагинов"),      "CAN_SEE_MANAGERS_TOOLBAR",  "CONST", roles.at(0) );

        addPromission( tr("Возможность работать с элементами управления плагина на уровне 0"), "CAN_SEE_MANAGER_CONROLS_LEVEL_0",     "CONST", roles.at(0) );
        addPromission( tr("Возможность работать с элементами управления плагина на уровне 1"), "CAN_SEE_MANAGER_CONROLS_LEVEL_1",     "CONST", roles.at(0) );
        addPromission( tr("Возможность работать с элементами управления плагина на уровне 2"), "CAN_SEE_MANAGER_CONROLS_LEVEL_2",     "CONST", roles.at(0) );

        addPromission( tr("Возможность работать с элементами управления плагина на уровне 0"), "CAN_SEE_MODULES_CONROLS_LEVEL_0",     "CONST", roles.at(0) );
        addPromission( tr("Возможность работать с элементами управления плагина на уровне 1"), "CAN_SEE_MODULES_CONROLS_LEVEL_1",     "CONST", roles.at(0) );
        addPromission( tr("Возможность работать с элементами управления плагина на уровне 2"), "CAN_SEE_MODULES_CONROLS_LEVEL_2",     "CONST", roles.at(0) );

        addPromission( tr("Возможность смотреть меню модулей приложения"),      "CAN_SEE_MODULES_MENU",            "CONST", roles.at(0) );
        addPromission( tr("Возможность смотреть настройки модулей приложения"), "CAN_SEE_MODULES_SETTINGS",        "CONST", roles.at(0) );
        addPromission( tr("Возможность смотреть панели модулей приложения"),    "CAN_SEE_MODULES_TOOLBAR",         "CONST", roles.at(0) );

        addPromission( tr("Возможность работать в отладочном режиме"), "DEBUG_MODE", "CONST", roles.at(0) );
    }
}
开发者ID:gen1izh,项目名称:cpp,代码行数:37,代码来源:promissionmodel.cpp

示例12: rsmFilter

void rsmFilter(QDjangoQuerySet<T1> &qs, const QXmppResultSetQuery &rsmQuery, QList<T2> &results, QXmppResultSetReply &rsmReply)
{
    // if count was requested, stop here
    if (rsmQuery.max() == 0) {
        rsmReply.setCount(qs.count());
        return;
    }

    rsmReply.setCount(qs.size());

    T1 result;
    if (rsmQuery.before().isNull()) {
        // page forwards
        bool rsmAfterReached = rsmQuery.after().isEmpty();
        for (int i = 0; i < qs.size(); ++i) {
            if (rsmQuery.max() >= 0 && results.size() >= rsmQuery.max())
                break;

            // fetch from database
            if (!qs.at(i, &result))
                break;
            const QString uid = result.pk().toString();

            // if an "after" was specified, check it was reached
            if (!rsmAfterReached) {
                if (uid == rsmQuery.after())
                    rsmAfterReached = true;
                continue;
            }

            if (results.isEmpty()) {
                rsmReply.setFirst(uid);
                rsmReply.setIndex(i);
            }
            rsmReply.setLast(uid);
            results << result;
        }
    } else {
        // page backwards
        bool rsmBeforeReached = rsmQuery.before().isEmpty();
        for (int i = qs.size() - 1; i >= 0; --i) {
            if (rsmQuery.max() >= 0 && results.size() >= rsmQuery.max())
                break;

            // fetch from database
            if (!qs.at(i, &result))
                break;
            const QString uid = result.pk().toString();

            // if a "before" was specified, check it was reached
            if (!rsmBeforeReached) {
                if (uid == rsmQuery.before())
                    rsmBeforeReached = true;
                continue;
            }

            if (results.isEmpty())
                rsmReply.setLast(uid);
            rsmReply.setFirst(uid);
            rsmReply.setIndex(i);
            results.prepend(result);
        }
    }
}
开发者ID:jlaine,项目名称:xmpp-share-server,代码行数:64,代码来源:mod_archive.cpp


注:本文中的QDjangoQuerySet::at方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。