本文整理汇总了C++中QQuickView::screen方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickView::screen方法的具体用法?C++ QQuickView::screen怎么用?C++ QQuickView::screen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQuickView
的用法示例。
在下文中一共展示了QQuickView::screen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void ZLibrary::run(ZLApplication* aApp)
{
if (ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())) {
qApp->setLayoutDirection(Qt::RightToLeft);
}
QString qml(QString::fromStdString(BaseDirectory + BOOKS_QML_FILE));
HDEBUG("qml file" << qPrintable(qml));
QQuickView* view = SailfishApp::createView();
QQmlContext* root = view->rootContext();
QSize screenSize(view->screen()->size());
booksPPI =
#if defined(__i386__)
(screenSize == QSize(1536,2048)) ? 330 : 300;
#elif defined(__arm__)
(screenSize == QSize(540,960)) ? 245 : 290;
#else
# error Unexpected architechture
#endif
HDEBUG("screen" << screenSize << booksPPI << "dpi");
root->setContextProperty("PointsPerInch", booksPPI);
root->setContextProperty("MaximumHintCount", 1);
view->setTitle(qtTrId("books-app-name"));
view->setSource(QUrl::fromLocalFile(qml));
view->show();
HDEBUG("started");
qApp->exec();
HDEBUG("exiting...");
}
示例2: main
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
// qmlRegisterType<TraceView>("SysViz", 1, 0, "TraceView");
qmlRegisterType<ThreadSliceView>("SysViz", 1, 0, "ThreadSliceView");
qmlRegisterType<GraphItem> ("SysViz", 1, 0, "GraphItem");
qmlRegisterType<TraceModel>();
qmlRegisterType<QAbstractListModel>();
qmlRegisterType<CpuFrequencyModel>();
qmlRegisterType<GpuFrequencyModel>();
TraceModel model;
QQuickView view;
QSurfaceFormat format = view.requestedFormat();
format.setSamples(16);
view.setFormat(format);
view.rootContext()->setContextProperty("traceModel", &model);
view.rootContext()->setContextProperty("cm", view.screen()->physicalDotsPerInch() / 2.54);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setSource(QUrl::fromLocalFile("qml/main.qml"));
view.setTitle("sysviz");
view.show();
#ifdef QT_DQML_LIB
DQmlLocalServer server(view.engine(), &view, "qml/main.qml");
server.fileTracker()->track("qml", "qml");
#endif
app.exec();
}