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())); }
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); }
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; } }
QObject *MainModelerWindow::findQmlObject(const string &objectName) { if (objectName == "ui" || objectName == "root") { return rootObject(); } else { return rootObject()->findChild<QObject *>(QString::fromStdString(objectName)); } }
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())); }
void Kiosek::qmlLoaded() { if(intro_switch==true) intro->load(rootObject()); else { screen->load(rootObject()); screen->switchView(tmp_view); } }
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()); } }
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 "; } }
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); }
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())); }
DeclarativeWindow::DeclarativeWindow (const QUrl& url, QVariantMap params, const QPoint& orig, ViewManager *viewMgr, ICoreProxy_ptr proxy, QWidget *parent) : QDeclarativeView (parent) { new Util::AutoResizeMixin (orig, [viewMgr] () { return viewMgr->GetFreeCoords (); }, this); if (!params.take ("keepOnFocusLeave").toBool ()) new Util::UnhoverDeleteMixin (this, SLOT (beforeDelete ())); setStyleSheet ("background: transparent"); setWindowFlags (Qt::Tool | Qt::FramelessWindowHint); setAttribute (Qt::WA_TranslucentBackground); for (const auto& cand : Util::GetPathCandidates (Util::SysPath::QML, "")) engine ()->addImportPath (cand); rootContext ()->setContextProperty ("colorProxy", new Util::ColorThemeProxy (proxy->GetColorThemeManager (), this)); for (const auto& key : params.keys ()) rootContext ()->setContextProperty (key, params [key]); engine ()->addImageProvider ("ThemeIcons", new Util::ThemeImageProvider (proxy)); setSource (url); connect (rootObject (), SIGNAL (closeRequested ()), this, SLOT (deleteLater ())); }
void E6Irc::run (const QSize & desktopSize) { CertStore::IF().Init(); control->fillContext(isProbablyPhone); setSource (QUrl ("qrc:///qml/Main.qml")); channelGroup->Start(); control->Run (); QObject * qmlRoot = rootObject(); QDeclarativeItem * qmlItem = qobject_cast<QDeclarativeItem*> (qmlRoot); if (qmlItem) { qDebug () << __PRETTY_FUNCTION__ << " phone ? " << isProbablyPhone; QMetaObject::invokeMethod (qmlItem, "phoneSettings", Q_ARG (QVariant, isProbablyPhone)); } if (!isFullScreen()) { QSize defaultSize = size(); QSize newsize = Settings().value ("sizes/e6irc", defaultSize).toSize(); if (newsize.isEmpty()) { showMaximized(); newsize = desktopSize; resize (newsize); } else { resize (newsize); } qDebug () << __PRETTY_FUNCTION__ << " resize to " << newsize << " result is " << size(); } show (); Settings().sync (); objectCount = 0; fixCaps (qmlRoot); qDebug () << objectCount << " objects"; }
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"); } }
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__; }
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())); }
TabUnhideListView::TabUnhideListView (const QList<TabClassInfo>& tcs, ICoreProxy_ptr proxy, QWidget *parent) : QDeclarativeView (parent) , Model_ (new UnhideListModel (this)) { new Util::UnhoverDeleteMixin (this); const auto& file = Util::GetSysPath (Util::SysPath::QML, "sb2", "TabUnhideListView.qml"); if (file.isEmpty ()) { qWarning () << Q_FUNC_INFO << "file not found"; deleteLater (); return; } setStyleSheet ("background: transparent"); setWindowFlags (Qt::ToolTip); setAttribute (Qt::WA_TranslucentBackground); rootContext ()->setContextProperty ("unhideListModel", Model_); rootContext ()->setContextProperty ("colorProxy", new Util::ColorThemeProxy (proxy->GetColorThemeManager (), this)); engine ()->addImageProvider ("ThemeIcons", new ThemeImageProvider (proxy)); setSource (QUrl::fromLocalFile (file)); for (const auto& tc : tcs) { auto item = new QStandardItem; item->setData (tc.TabClass_, UnhideListModel::Roles::TabClass); item->setData (tc.VisibleName_, UnhideListModel::Roles::TabName); item->setData (tc.Description_, UnhideListModel::Roles::TabDescription); item->setData (Util::GetAsBase64Src (tc.Icon_.pixmap (32, 32).toImage ()), UnhideListModel::Roles::TabIcon); Model_->appendRow (item); } connect (rootObject (), SIGNAL (closeRequested ()), this, SLOT (deleteLater ())); connect (rootObject (), SIGNAL (tabUnhideRequested (QString)), this, SLOT (unhide (QString)), Qt::QueuedConnection); }
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); }
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); }
QuarkUnhideListView::QuarkUnhideListView (const QuarkComponents_t& components, ViewManager *viewMgr, ICoreProxy_ptr proxy, QWidget *parent) : Util::UnhideListViewBase (proxy, [&components, &proxy, viewMgr] (QStandardItemModel *model) { for (const auto& comp : components) { std::unique_ptr<QuarkManager> qm; try { qm.reset (new QuarkManager (comp, viewMgr, proxy)); } catch (const std::exception& e) { qWarning () << Q_FUNC_INFO << "error creating manager for quark" << comp->Url_; continue; } const auto& manifest = qm->GetManifest (); auto item = new QStandardItem; item->setData (manifest.GetID (), Util::UnhideListModel::Roles::ItemClass); item->setData (manifest.GetName (), Util::UnhideListModel::Roles::ItemName); item->setData (manifest.GetDescription (), Util::UnhideListModel::Roles::ItemDescription); item->setData (Util::GetAsBase64Src (manifest.GetIcon ().pixmap (32, 32).toImage ()), Util::UnhideListModel::Roles::ItemIcon); model->appendRow (item); } }, parent) , ViewManager_ (viewMgr) { for (const auto& comp : components) { try { const auto& manager = std::make_shared<QuarkManager> (comp, ViewManager_, proxy); const auto& manifest = manager->GetManifest (); ID2Component_ [manifest.GetID ()] = { comp, manager }; } catch (const std::exception& e) { qWarning () << Q_FUNC_INFO << "skipping component" << comp->Url_ << ":" << e.what (); } } connect (rootObject (), SIGNAL (itemUnhideRequested (QString)), this, SLOT (unhide (QString)), Qt::QueuedConnection); }
bool DiscoverMainWindow::eventFilter(QObject * object, QEvent * event) { if (object!=rootObject()) return false; if (event->type() == QEvent::Close) { if (ResourcesModel::global()->isBusy()) { qWarning() << "not closing because there's still pending tasks"; Q_EMIT preventedClose(); return true; } KConfigGroup window(KSharedConfig::openConfig(), "Window"); window.writeEntry("geometry", rootObject()->geometry()); window.writeEntry<int>("visibility", rootObject()->visibility()); } return false; }
void IrcFloat::CheckQml () { QGraphicsObject * qr = rootObject (); if (qmlRoot != qr && qmlRoot != 0) { qDebug () << __PRETTY_FUNCTION__ << " QML Root Changed !! " << qmlRoot << qr; qmlRoot = qr; } }
void MainWindow::changeUserPass() { QGraphicsObject *obj = rootObject(); obj->setProperty("authed", false); m_userStream->streamDisconnect(); m_tweetListModel->clear(); m_mentionsListModel->clear(); // ### TODO Clear tokens in .ini? }
nsresult StartupCacheDebugOutputStream::WriteSingleRefObject(nsISupports* aObject) { nsCOMPtr<nsISupports> rootObject(do_QueryInterface(aObject)); NS_ASSERTION(rootObject.get() == aObject, "bad call to WriteSingleRefObject -- call WriteCompoundObject!"); bool check = CheckReferences(aObject); NS_ENSURE_TRUE(check, NS_ERROR_FAILURE); return mBinaryStream->WriteSingleRefObject(aObject); }
BrowserWindow::BrowserWindow(const QStringList& arguments) : m_urlsFromCommandLine(arguments) , m_browserView(0) { setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); qmlRegisterType<Shortcut>("Snowshoe", 1, 0, "Shortcut"); restoreWindowGeometry(); setupDeclarativeEnvironment(); m_browserView = qobject_cast<QQuickItem*>(rootObject()); Q_ASSERT(m_browserView); }
void InitQML::resetImage() { QGraphicsObject *object = rootObject(); QObject *bgImage = object->findChild<QObject*>("bgPixmap"); rip->resetDone = true; if (bgImage) { bgImage->setProperty("source","image://background/snapshot.png"); } else qWarning() << "ERROR COULD NOT FIND BG PIXMAP " << __FILE__ << __LINE__; }
MainWindow::MainWindow(QWindow *parent) : QQuickView(parent) , reply_(nullptr) { setSource(QUrl("qrc:/Main.qml")); QObject *root = qobject_cast<QObject *>(rootObject()); QObject *button = root->findChild<QObject *>("button"); if (button) connect(button, SIGNAL(clicked()), SLOT(buttonClicked())); }
bool App::event(QEvent *event) { if (event->type() == QEvent::Close) { if (m_doc->isModified()) { QMetaObject::invokeMethod(rootObject(), "saveBeforeExit"); return false; } } return QQuickView::event(event); }
void EditorApplication::destroyFacade() { if (mFacade != 0) { OgreItem* view = rootObject()->findChild<OgreItem*>(mViewItemId.c_str()); if(view) { view->setEngine(0); } delete mFacade; mFacade = 0; } }
KDevSplashScreen::KDevSplashScreen() : QQuickView() { setFlags(Qt::FramelessWindowHint | Qt::SplashScreen); setResizeMode(QQuickView::SizeViewToRootObject); setSource(QUrl(QStringLiteral("qrc:/kdevelop/splash.qml"))); if (!rootObject()) { qWarning() << "Could not load KDevelop splash screen"; hide(); // hide instead of showing garbage return; } if (rootObject()) { rootObject()->setProperty("appIcon", QUrl::fromLocalFile(KIconLoader().iconPath("kdevelop", -48))); rootObject()->setProperty("appVersionMajor", VERSION_MAJOR); rootObject()->setProperty("appVersionMinor", VERSION_MINOR); rootObject()->setProperty("appVersionPatch", VERSION_PATCH); } QRect geo = geometry(); geo.moveCenter(screen()->geometry().center()); setGeometry(geo); }
QString GaugeWidget::setFile(QString file) { setSource(QUrl::fromLocalFile(file)); if (rootObject()) { for (int i=0;i<rootObject()->childItems().size();i++) { QGraphicsObject *obj = qobject_cast<QGraphicsObject*>(rootObject()->childItems()[i]); if (obj) { propertylist.append(obj->property("propertyMapProperty").toString()); } } if (rootObject()->property("plugincompat").isValid()) { QString plugincompat = rootObject()->property("plugincompat").toString(); QLOG_DEBUG() << "Plugin compatability:" << plugincompat; return plugincompat; } } return ""; }