本文整理汇总了C++中QAndroidJniEnvironment::PushLocalFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QAndroidJniEnvironment::PushLocalFrame方法的具体用法?C++ QAndroidJniEnvironment::PushLocalFrame怎么用?C++ QAndroidJniEnvironment::PushLocalFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAndroidJniEnvironment
的用法示例。
在下文中一共展示了QAndroidJniEnvironment::PushLocalFrame方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retrieveDpi
int ScreenValues::retrieveDpi()
{
#ifdef Q_OS_ANDROID
QAndroidJniEnvironment env;
env->PushLocalFrame(9);
QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative",
"activity",
"()Landroid/app/Activity;");
QAndroidJniObject resources = activity.callObjectMethod("getResources",
"()Landroid/content/res/Resources;");
QAndroidJniObject displayMetrics = resources.callObjectMethod("getDisplayMetrics",
"()Landroid/util/DisplayMetrics;");
jint densityDpi = displayMetrics.getField<jint>("densityDpi");
int result = (int)densityDpi;
return result;
#else
return QGuiApplication::primaryScreen()->physicalDotsPerInch();
#endif
}
示例2: retrieveIsTablet
bool ScreenValues::retrieveIsTablet()
{
#ifdef Q_OS_ANDROID
QAndroidJniEnvironment env;
env->PushLocalFrame(9);
QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative",
"activity",
"()Landroid/app/Activity;");
QAndroidJniObject resources = activity.callObjectMethod("getResources",
"()Landroid/content/res/Resources;");
QAndroidJniObject configuration = resources.callObjectMethod("getConfiguration",
"()Landroid/content/res/Configuration;");
jint smallestScreenWidthDp = configuration.getField<jint>("smallestScreenWidthDp");
return smallestScreenWidthDp >= 600;
#else
return false;
#endif
}
示例3: retrieveDensity
float ScreenValues::retrieveDensity()
{
#ifdef Q_OS_ANDROID
QAndroidJniEnvironment env;
env->PushLocalFrame(9);
QAndroidJniObject activity = QAndroidJniObject::callStaticObjectMethod("org/qtproject/qt5/android/QtNative",
"activity",
"()Landroid/app/Activity;");
jclass activityClass = env->GetObjectClass(activity.object<jobject>());
jmethodID mIDGetResources = env->GetMethodID(activityClass,
"getResources",
"()Landroid/content/res/Resources;");
jobject resources = env->CallObjectMethod(activity.object<jobject>(), mIDGetResources);
jclass resourcesClass = env->GetObjectClass(resources);
jmethodID mIDGetDisplayMetrics = env->GetMethodID(resourcesClass,
"getDisplayMetrics",
"()Landroid/util/DisplayMetrics;");
jobject displayMetrics = env->CallObjectMethod(resources, mIDGetDisplayMetrics);
jclass displayMetricsClass = env->GetObjectClass(displayMetrics);
jfieldID fIDDensityDpi = env->GetFieldID(displayMetricsClass, "density", "F");
jfloat densityDpi = env->GetFloatField(displayMetrics, fIDDensityDpi);
float result = (float)densityDpi;
env->PopLocalFrame(NULL);
return result;
#else
return QGuiApplication::primaryScreen()->physicalDotsPerInch();
#endif
}