本文整理汇总了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()));
}
示例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);
}
示例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;
}
}
示例4: rootObject
QObject *MainModelerWindow::findQmlObject(const string &objectName) {
if (objectName == "ui" || objectName == "root") {
return rootObject();
} else {
return rootObject()->findChild<QObject *>(QString::fromStdString(objectName));
}
}
示例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()));
}
示例6: qmlLoaded
void Kiosek::qmlLoaded()
{
if(intro_switch==true)
intro->load(rootObject());
else
{
screen->load(rootObject());
screen->switchView(tmp_view);
}
}
示例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());
}
}
示例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 ";
}
}
示例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);
}
示例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()));
}
示例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");
}
}
示例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__;
}
示例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()));
}
示例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);
}
示例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);
}