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


C++ QQmlEngine::setNetworkAccessManagerFactory方法代码示例

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


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

示例1: synchronousNetworkAccessManager

void tst_qqmlengine::synchronousNetworkAccessManager()
{
    ImmediateFactory factory;
    QQmlEngine engine;
    engine.setNetworkAccessManagerFactory(&factory);
    QQmlComponent c(&engine, QUrl("myScheme://test.qml"));
    // reply is finished, so should not be in loading state.
    QVERIFY(!c.isLoading());
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:9,代码来源:tst_qqmlengine.cpp

示例2: if

MainWindow::MainWindow(QWindow *parent)
    : QQuickView(parent)
{
    setSource(QUrl::fromLocalFile("H:/VK/main.qml").toString());

    photoSize = "130";


    // !!! SET QNAM AND CACHE
    manager = new QNetworkAccessManager(this);
    cache = new QNetworkDiskCache(this);
    // 500 Mb
    cache->setMaximumCacheSize(500*1024*1024);
    cache->setCacheDirectory("cacheDir");
    manager->setCache(cache);

    // SET CACHED NAM TO QMLENGINE TO
    MyNetworkAccessManagerFactory* namFactory = new MyNetworkAccessManagerFactory();
    QQmlEngine* eng =  engine();
    eng->setNetworkAccessManagerFactory(namFactory);


    QQmlProperty((QObject*)rootObject(), "color").write("#F5F5F5");
    QQmlProperty((QObject*)rootObject(), "height").write(height());


    wallObj = rootObject();
    //wallObj->setProperty("color", "#F5F5F5");
    //wallObj->setProperty("height",height());

    connect((QObject*)wallObj, SIGNAL(login()),this,SLOT(login()));
    connect((QObject*)wallObj, SIGNAL(getGroups()),this, SLOT(getGroups()));
    connect((QObject*)wallObj, SIGNAL(getWall(QString)),this, SLOT(getWall(QString)));
    connect((QObject*)wallObj, SIGNAL(morePosts()), this, SLOT(morePosts()));
    connect((QObject*)wallObj, SIGNAL(setPhotoSize(QString)), this, SLOT(setPhotoSize(QString)));


    LoadIni("H:/VK/config.ini");
    // do we have token
    if( settings->contains("token")){
        // its a unlimit token
        qDebug() << " HAVE TOKEN ";
        if(ReadConfig("expires").toInt()==0){
            Token = ReadConfig("token").toString();
        }
        // if no doesnt it token expire
        else if(ReadConfig("expDate").toDate()<=QDate::currentDate()){
            Token = ReadConfig("token").toString();
        }
    // if havent token login
    }else{
        login();
        qDebug() << " NEED LOGIN ";
    }
}
开发者ID:warchiefmarkus,项目名称:VK,代码行数:55,代码来源:mainwindow.cpp

示例3: networkAccessManager

void tst_qqmlengine::networkAccessManager()
{
    QQmlEngine *engine = new QQmlEngine;

    // Test QQmlEngine created manager
    QPointer<QNetworkAccessManager> manager = engine->networkAccessManager();
    QVERIFY(manager != 0);
    delete engine;

    // Test factory created manager
    engine = new QQmlEngine;
    NetworkAccessManagerFactory factory;
    engine->setNetworkAccessManagerFactory(&factory);
    QCOMPARE(engine->networkAccessManagerFactory(), &factory);
    QNetworkAccessManager *engineNam = engine->networkAccessManager(); // calls NetworkAccessManagerFactory::create()
    QCOMPARE(engineNam, factory.manager);
    delete engine;
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:18,代码来源:tst_qqmlengine.cpp


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