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


C++ rootObject函数代码示例

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


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

示例1: VCompositor

SystemCompositor::SystemCompositor()
    : VCompositor(this)
    , m_currentSurface(0)
{
    // Enable the subsurface extension
    enableSubSurfaceExtension();

    // System compositor protocol
    m_protocol = new SystemCompositorServer(this, QWaylandCompositor::handle());

    // Allow QML to access this compositor
    rootContext()->setContextProperty("compositor", this);

    // All the screen is initially available
    m_availableGeometry = screen()->availableGeometry();
    connect(screen(), SIGNAL(virtualGeometryChanged(QRect)),
            this, SIGNAL(screenGeometryChanged()));

    // Load the QML code
    setSource(QUrl("qrc:///qml/Compositor.qml"));
    setResizeMode(QQuickView::SizeRootObjectToView);
    setColor(Qt::black);
    winId();

    connect(this, SIGNAL(windowAdded(QVariant)),
            rootObject(), SLOT(windowAdded(QVariant)));
    connect(this, SIGNAL(windowDestroyed(QVariant)),
            rootObject(), SLOT(windowDestroyed(QVariant)));
    connect(this, SIGNAL(windowResized(QVariant)),
            rootObject(), SLOT(windowResized(QVariant)));
    connect(this, SIGNAL(sceneGraphInitialized()),
            this, SLOT(sceneGraphInitialized()), Qt::DirectConnection);
    connect(this, SIGNAL(frameSwapped()),
            this, SLOT(frameSwapped()));
}
开发者ID:nezticle,项目名称:greenisland,代码行数:35,代码来源:systemcompositor.cpp

示例2: qDebug

void KinoafishaWidget::setCinamaList(const QList<Cinema *> cinemaList)
{
    QTime progressTime;
    qDebug() << "Set cinema list to qmlView...";
    progressTime.start();
    QSettings settings;
    QString affishaQmlPatch = settings.value(SETT_KEY_KINOAFISHA_QML_PATCH,
                                             QCoreApplication::applicationDirPath() +
                                             DEFATUL_SETT_VALUE_KINOAFISHA_QML_PATCH).toString();
    qDebug() << "Load qml " << affishaQmlPatch + "/Affisha.qml...";
    QTime loadTime;
    loadTime.start();
    if (!QFile::exists(affishaQmlPatch + "/Affisha.qml"))
    {
        qWarning() << "Affisha.qml not found";
        return;
    }
    setSource(QUrl::fromLocalFile(affishaQmlPatch + "/Affisha.qml"));
    qDebug() << "Load qml finished in " << loadTime.elapsed();
    QDeclarativeItem * rootItem = qobject_cast<QDeclarativeItem *>(rootObject());
    qDebug() << "Kinoafisha widget width " << _screenWidth <<" height " << _screenHeight;
    rootItem->setWidth(_screenWidth);
    rootItem->setHeight(_screenHeight);
    connect(rootObject(), SIGNAL(trailerPlayFinished(int)), this, SIGNAL(traylerPlayedFinised(int)));
    foreach (Cinema *currentCinema, cinemaList)
    {
        addCinema(currentCinema);
    }
开发者ID:0x6368656174,项目名称:iqMultipleDesktopVideo,代码行数:28,代码来源:kinoafishawidget.cpp

示例3: rootObject

void Kiosek::statuss(QQuickView::Status status)
{
    if(status==QQuickView::Ready && root==NULL)
    {
        loader = rootObject()->findChild<QObject*>("pageLoader");
        if(loader!=NULL)
            connect(loader,SIGNAL(loaded()),this,SLOT(qmlLoaded()),Qt::DirectConnection);
        else
            std::cout<<"error"<<std::endl;

        if(root==NULL)
        {
            root = rootObject();//->findChild<QObject*>("rootx");
            if(root==NULL)
                std::cout<<"error"<<std::endl;
        }

        switchToIntro();
        showExpanded();
    }
    else if(status==QQuickView::Error)
    {
        QList<QQmlError> list=errors();
        QList<QQmlError>::iterator i;
        for (i = list.begin(); i != list.end(); ++i)
            std::cout<< (*i).toString().toUtf8().constData() << std::endl;
    }
}
开发者ID:zarubond,项目名称:Kiosek,代码行数:28,代码来源:kiosek.cpp

示例4: rootObject

QObject *MainModelerWindow::findQmlObject(const string &objectName) {
    if (objectName == "ui" || objectName == "root") {
        return rootObject();
    } else {
        return rootObject()->findChild<QObject *>(QString::fromStdString(objectName));
    }
}
开发者ID:jordonwu,项目名称:paysages3d,代码行数:7,代码来源:MainModelerWindow.cpp

示例5: super

View::View(QWindow *parent)
    : super(parent),
      m_controller(0)
{
    setSource(QUrl("qrc:///qml/View.qml"));

    connect(rootObject(), SIGNAL(textField_textChanged()), SLOT(textField_textChanged()));
    connect(rootObject(), SIGNAL(quitButton_clicked()), SLOT(quitButton_clicked()));
}
开发者ID:jonnydee,项目名称:QtPatternCollection,代码行数:9,代码来源:View.cpp

示例6: qmlLoaded

void Kiosek::qmlLoaded()
{
    if(intro_switch==true)
        intro->load(rootObject());
    else
    {
        screen->load(rootObject());
        screen->switchView(tmp_view);
    }
}
开发者ID:zarubond,项目名称:Kiosek,代码行数:10,代码来源:kiosek.cpp

示例7: qDebug

void Cordova::popViewState(const QString &state) {
    if (!_states.removeOne(state))
        qDebug() << "WARNING: incorrect view states order";

    if (_states.empty()) {
        rootObject()->setState("main");
    } else {
        rootObject()->setState(_states.front());
    }
}
开发者ID:WataruSuzuki,项目名称:SampleCordovaGoogleMapV3,代码行数:10,代码来源:cordova.cpp

示例8: QQuickView

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

示例9: rootObject

void KDevSplashScreen::progress(int progress)
{
    // notify the QML script of the progress change
    if (rootObject()) {
        rootObject()->setProperty("progress", progress);
    }

    // note: We don't have an eventloop running, hence we need to call both processEvents and sendPostedEvents here
    // DeferredDelete events alone won't be processed until sendPostedEvents is called
    // also see: http://osxr.org/qt/source/qtbase/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp#1401
    qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
    qApp->sendPostedEvents(0, QEvent::DeferredDelete);
}
开发者ID:deoakshay,项目名称:kdevelop,代码行数:13,代码来源:splash.cpp

示例10: showFullScreen

void
Panto::start ()
{    

  if (isProbablyPhone) {
    showFullScreen ();
  }
  setSource (QUrl("qrc:/qml/main.qml"));
  if (sizeSet) {
    resize (desiredSize);
  }
  show ();
  
  QDeclarativeItem * root = qobject_cast <QDeclarativeItem*> (rootObject());
  qDebug () << PANTO_PRETTY_FUNCTION << " root " << root;
  if (root) {
    #if 0
    QDeclarativeItem * mouseArea = root->findChild<QDeclarativeItem*> ("GestureTrap");
    if (mouseArea) {
      mouseArea->grabGesture (loopType);
      mouseArea->installEventFilter (this);
    }
    QDeclarativeItem * bigButton = root->findChild<QDeclarativeItem*> ("BigButton");
    if (bigButton) {
      bigButton->grabGesture (loopType);
      bigButton->installEventFilter (this);
    }
    #endif
  }

  //QTimer::singleShot (10*1000, this, SLOT(allDone()));
}
开发者ID:berndhs,项目名称:pantomime,代码行数:32,代码来源:panto.cpp

示例11: qDebug

void MainWindow::getGroups()
{
    qDebug() << " GET GROUPS FROM QML ";

    QUrl current("https://api.vk.com/method/groups.get");
    QUrlQuery query;
    query.addQueryItem("v","5.2");
    query.addQueryItem("access_token",Token);
    query.addQueryItem("user_id","138685584");
    query.addQueryItem("extended","1");
    query.addQueryItem("count","1000");
    query.addQueryItem("fields","members_count");

    current.setQuery(query);
    QByteArray answer = GET(current);

    QVariantList List = JSON::parse(answer).toMap().value("response").toMap().value("items").toList(); // parse to list of objects Audio

    /*GET Audio
    QString du;
    for (int i=0; i<List.size(); i++)
    {
        QVariantMap current = List[i].toMap();
        du = current.value("url").toString();
        qDebug() << current.value("url").toString();
        qDebug() << current.value("id").toString();
        qDebug() << current.value("title").toString();
    }
    */

    QQmlContext* context = rootContext();
    groupModel = new GroupModel();

    for (int i=0; i<List.size(); i++)
    {

        QVariantMap current = List[i].toMap();
        groupModel->addGroup(Group(current.value("name").toString(),current.value("type").toString(),current.value("photo_50").toString(),current.value("members_count").toString(),current.value("id").toString()));

        /*QVariantList attachments = current.value("attachments").toList();
        for (int k=0; k<attachments.size(); k++)
        {
            QVariantMap cur = attachments[k].toMap();
            if (cur.value("type").toString() == "audio")
            {
                qDebug() << "Audio";
                qDebug() << cur.value("audio").toMap().value("url").toString();
                links.append(cur.value("audio").toMap().value("url").toString());
            }
        }*/

    }

    context->setContextProperty("groupModel", groupModel);
    //if success loaded data
    if (1){
        wallObj = rootObject();
        QMetaObject::invokeMethod((QObject*)wallObj, "showGroupList");
    }
}
开发者ID:warchiefmarkus,项目名称:VK,代码行数:60,代码来源:mainwindow.cpp

示例12: rootObject

void InitQML::setText(TextType tt,QString str)
{
  QString textStr;
  QGraphicsObject *object = rootObject();
  if (!object) {
    qWarning() << "qml root object not found" << __FILE__ << __LINE__ ;
    return;
  }
  switch (tt) {
  case UpperText:
    textStr = "textTop";
    break;
  case MiddleText:
    textStr = "textMiddle";
    break;
  case LowerText:
    textStr = "textBottom";
    break;
  }
  QObject *rect = object->findChild<QObject*>(textStr);
  
  if (rect)  {
    rect->setProperty("text",str);
  }
  else
    qWarning() << "QML OBJECT NOT FOUND " << __FILE__ << __LINE__;
  
}
开发者ID:DBoo,项目名称:fix8logviewer,代码行数:28,代码来源:initQML.cpp

示例13: qmlSourcesPath

void StatesEditorWidget::reloadQmlSource()
{
    QString statesListQmlFilePath = qmlSourcesPath() + QStringLiteral("/StatesList.qml");
    QTC_ASSERT(QFileInfo::exists(statesListQmlFilePath), return);
    engine()->clearComponentCache();
    setSource(QUrl::fromLocalFile(statesListQmlFilePath));

    QTC_ASSERT(rootObject(), return);
    connect(rootObject(), SIGNAL(currentStateInternalIdChanged()), m_statesEditorView.data(), SLOT(synchonizeCurrentStateFromWidget()));
    connect(rootObject(), SIGNAL(createNewState()), m_statesEditorView.data(), SLOT(createNewState()));
    connect(rootObject(), SIGNAL(deleteState(int)), m_statesEditorView.data(), SLOT(removeState(int)));
    m_statesEditorView.data()->synchonizeCurrentStateFromWidget();
    setFixedHeight(initialSize().height());

    connect(rootObject(), SIGNAL(expandedChanged()), this, SLOT(changeHeight()));
}
开发者ID:daodaoliang,项目名称:qt-creator,代码行数:16,代码来源:stateseditorwidget.cpp

示例14: qDebug

void MapWidget::doneLoading(QQuickWidget::Status status)
{
	// the default map widget QML failed; load the error QML.
	if (source() == urlMapWidget && status != QQuickWidget::Ready) {
		qDebug() << urlMapWidget << "failed to load with status:" << status;
		setSource(urlMapWidgetError);
		return;
	} else if (source() == urlMapWidgetError) { // the error QML finished loading.
		return;
	}

	isReady = true;
	m_rootItem = qobject_cast<QQuickItem *>(rootObject());
	m_mapHelper = rootObject()->findChild<MapWidgetHelper *>();
	connect(m_mapHelper, &MapWidgetHelper::selectedDivesChanged, this, &MapWidget::selectedDivesChanged);
	connect(m_mapHelper, &MapWidgetHelper::coordinatesChanged, this, &MapWidget::coordinatesChanged);
}
开发者ID:dirkhh,项目名称:subsurface,代码行数:17,代码来源:mapwidget.cpp

示例15: m_browserView

BrowserWindowMobile::BrowserWindowMobile()
    : m_browserView(0)
{
    setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
    setupDeclarativeEnvironment();
    m_browserView = qobject_cast<QQuickItem*>(rootObject());
    Q_ASSERT(m_browserView);
}
开发者ID:diorahman,项目名称:snowshoe,代码行数:8,代码来源:BrowserWindowMobile.cpp


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