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; } }
void MainWindow::launch() { #if defined( Q_WS_MAEMO_5 ) _navigator = new QmlApplicationViewer( this ); QGLFormat format = QGLFormat::defaultFormat(); format.setSampleBuffers(false); setAttribute(Qt::WA_Maemo5NonComposited, true); setAttribute(Qt::WA_Maemo5AutoOrientation, true); _glWidget = new QGLWidget(format); //### potentially faster, but causes junk to appear if top-level is Item, not Rectangle _glWidget->setAutoFillBackground(false); _glWidget->setAttribute(Qt::WA_Maemo5NonComposited, true); _navigator->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); _navigator->setAttribute(Qt::WA_Maemo5NonComposited, true); _navigator->setViewport(_glWidget); #else _navigator = new QmlApplicationViewer( this ); #endif _navigator->setOrientation(QmlApplicationViewer::ScreenOrientationAuto); _navigator->setSource(QUrl("qrc:///qml/QKnots.qml")); _navigator->setResizeMode(QDeclarativeView::SizeRootObjectToView); #if USE_DISK_CACHE _navigator->engine()->setNetworkAccessManagerFactory(new MyQmlNetworkCache ); #endif _videoPlayer = new QmlApplicationViewer( this ); _videoPlayer->setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape); _videoPlayer->setSource(QUrl("qrc:///qml/common/PlayingView.qml")); _videoPlayer->setResizeMode(QDeclarativeView::SizeRootObjectToView); _videoPlayer->setViewportUpdateMode(QGraphicsView::FullViewportUpdate); #if USE_DISK_CACHE _videoPlayer->engine()->setNetworkAccessManagerFactory(new MyQmlNetworkCache); #endif #if defined( Q_WS_MAEMO_5 ) _videoPlayer->setAttribute(Qt::WA_Maemo5NonComposited, true); #endif QObject::connect(_navigator->engine(), SIGNAL(quit()), QCoreApplication::instance(),SLOT(quit())); connect( QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(onQmlFinished())); switchViews(false); showExpanded(); }
void CourierQmlViewer::showWindow() { QDeclarativeContext *window = rootContext(); // 让QML控制窗口移动 window->setContextProperty("mainWindow", this); setOrientation(ScreenOrientationAuto); setAttribute(Qt::WA_TranslucentBackground); engine()->rootContext()->setContextObject(mUiHandler); setStyleSheet("background:transparent;"); // Connect signals and slots for QML mUiHandler->setUpSignalSlot(this); showExpanded(); //show(); }
void MainWindow::switchViews( bool showPlayer ) { if( showPlayer ) { _navigator->hide(); #if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) showFullScreen(); _videoPlayer->showFullScreen(); #else show(); _videoPlayer->show(); #endif } else { _navigator->showExpanded(); _videoPlayer->hide(); showExpanded(); } }