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


C++ QDjangoQuerySet类代码示例

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


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

示例1: QT_VERSION_CHECK

void tst_QDjango::databaseThreaded()
{
    if (QDjango::database().databaseName() == QLatin1String(":memory:"))
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
        QSKIP("Threaded test cannot work with in-memory SQLite database.");
#else
        QSKIP("Threaded test cannot work with in-memory SQLite database.", SkipAll);
#endif

    QDjangoQuerySet<Author> qs;
    QCOMPARE(qs.count(), 0);

    QEventLoop loop;
    Worker worker;
    QThread workerThread;

    // fire up worker
    worker.moveToThread(&workerThread);
    connect(&worker, SIGNAL(done()), &loop, SLOT(quit()));

    workerThread.start();
    QTimer::singleShot(0, &worker, SLOT(doIt()));
    loop.exec();

    // check database
    QCOMPARE(qs.count(), 1);

    // stop thread
    workerThread.quit();
    workerThread.wait();
}
开发者ID:Dem0n3D,项目名称:qdjango,代码行数:31,代码来源:tst_qdjango.cpp

示例2: 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

示例3: QCOMPARE

/** Test eager loading of foreign keys.
 */
void tst_QDjangoModel::selectRelated()
{
    // 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);
    }

    // without eager loading
    QDjangoQuerySet<Owner> qs;
    Owner *owner = qs.get(QDjangoWhere("name", QDjangoWhere::Equals, "owner"));
    QVERIFY(owner != 0);
    QCOMPARE(owner->item1()->name(), QLatin1String("first"));
    QCOMPARE(owner->item2()->name(), QLatin1String("second"));
    delete owner;

    // with eager loading
    owner = qs.selectRelated().get(QDjangoWhere("name", QDjangoWhere::Equals, "owner"));
    QVERIFY(owner != 0);
    QCOMPARE(owner->item1()->name(), QLatin1String("first"));
    QCOMPARE(owner->item2()->name(), QLatin1String("second"));
    delete owner;
}
开发者ID:explicitcall,项目名称:qdjango,代码行数:36,代码来源:main.cpp

示例4: test_ModelAPIs_schedule

void TestModels::test_ModelAPIs_schedule()
{
    const QDjangoQuerySet<Schedule> schedule_set;
    Schedule* schedule = schedule_set.get(QDjangoWhere("id", QDjangoWhere::Equals, 2));

    Schedule* schedule2 = ModelAPIs::Instance()->schedule(2);
    QCOMPARE(schedule->start(), schedule2->start());
}
开发者ID:ptmono,项目名称:eManual-gui,代码行数:8,代码来源:test_models.cpp

示例5: QDjangoWhere

QDjangoQuerySet<Project> DatabaseController::listProjects(QDateTime from, QDateTime to=QDateTime::currentDateTime()){
    QDjangoQuerySet<Project> projects;

    projects = projects.filter( QDjangoWhere("start_date", QDjangoWhere::GreaterOrEquals, from) &&
                                QDjangoWhere("start_date", QDjangoWhere::LessOrEquals, to) );

    return projects;
}
开发者ID:Metalab,项目名称:kassomat,代码行数:8,代码来源:databasecontroller.cpp

示例6: test_ModelAPIs_lastSchedule

void TestModels::test_ModelAPIs_lastSchedule()
{
    
    const QDjangoQuerySet<Schedule> schedule_set;
    QList< QMap<QString, QVariant> > schedule_map = schedule_set.all().values();

    
    QCOMPARE(schedule_map.last(), ModelAPIs::Instance()->lastSchedule());
}
开发者ID:ptmono,项目名称:eManual-gui,代码行数:9,代码来源:test_models.cpp

示例7: on_btAnnuler_clicked

void NouveauxProduitsDialog::on_btAnnuler_clicked()
{
    QDjangoQuerySet< Core::Temp > produits;
    produits.remove();
    produitsModel->select();

    effacerChamps();

    btValider->setEnabled( false );
}
开发者ID:Shiryu,项目名称:ManShop,代码行数:10,代码来源:nouveauxproduitsdialog.cpp

示例8: 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

示例9: test_ModelAPIs_groups

void TestModels::test_ModelAPIs_groups()
{
    const QDjangoQuerySet<Group> groups_set;
    QList< QMap<QString, QVariant> > groups_map = groups_set.all().values();

    QList<QString> result;
    for (int i = 0; i < groups_map.count(); i++){
	result << groups_map[i]["name"].toString();
    }

    QList<QString> result2;
    result2 = ModelAPIs::Instance()->groups();
    QCOMPARE(result, result2);
}
开发者ID:ptmono,项目名称:eManual-gui,代码行数:14,代码来源:test_models.cpp

示例10: 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

示例11: show

void NouveauxProduitsDialog::on_btTerminer_clicked()
{
    if( QMessageBox::question( this, "Question", "Voulez-vous vraiment fermer cette boîte de dialogue ?\n"
                               "Toutes les modifications non enregistrées seront perdues",
                               QMessageBox::Yes | QMessageBox::No ) == QMessageBox::No )
        show();
    else
    {
        QDjangoQuerySet< Core::Temp > produits;
        produits.remove();

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

示例12: test_ModelAPIs_elements

void TestModels::test_ModelAPIs_elements()
{
    const QDjangoQuerySet<Element> elements_set;
    QList< QMap<QString, QVariant> > elements_map = elements_set.all().values();

    //qDebug() << elements_map;
    QList<QString> result;
    for (int i = 0; i < elements_map.count(); i++){
     	result << elements_map[i]["name"].toString();
    }

    QList<QString> result2;
    result2 = ModelAPIs::Instance()->elements();
    QCOMPARE(result, result2);
}
开发者ID:ptmono,项目名称:eManual-gui,代码行数:15,代码来源:test_models.cpp

示例13: selectAllPromission

QStringList PromissionModel::selectAllPromission()
{
    QStringList tmp;
    tmp.clear();

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

    QDjangoQuerySet<Promission> proms;

    QList<QVariantMap> propertyMaps =
            proms.values(QStringList() << "name" << "signature" << "constant");
    foreach (const QVariantMap &propertyMap, propertyMaps) {
        tmp.append(propertyMap["name"].toString());
    }
开发者ID:gen1izh,项目名称:cpp,代码行数:16,代码来源:promissionmodel.cpp

示例14: test_ModelAPIs_units

void TestModels::test_ModelAPIs_units()
{
    // Our result
    const QDjangoQuerySet<Unit> units_set;
    QList< QList<QVariant> > units = units_set.all().valuesList();

    QList<QString> result;
    for (int i = 0; i < units.count(); i++){
	result << units[i][1].toString();
    }

    // From method
    QList<QString> result2;
    result2 = ModelAPIs::Instance()->units();
    QCOMPARE(result, result2);
}
开发者ID:ptmono,项目名称:eManual-gui,代码行数:16,代码来源:test_models.cpp

示例15: 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


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