- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
如果我在桌面(Linux 或 Windows)上使用,在应用程序中使用 qApp->primaryScreen()->availableGeometry();
时获取可用屏幕的大小,这对我是因为应用程序的每个元素的大小是根据屏幕上可用的高度和宽度计算的,但是在 ADV 上运行时总是返回 0x0,这会阻止正确的应用程序功能。如果我尝试在物理设备中部署,调试器和应用程序甚至不会开始。在我得到的完整日志中是这样的:
Debugging starts
D/dalvikvm( 4630): Not late-enabling CheckJNI (already on)
I/dalvikvm( 4630): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
I/dalvikvm( 4630): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
I/dalvikvm( 4630): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
I/dalvikvm( 4630): Zip is good, but no classes.dex inside, and no valid .odex file in the same directory
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libgnustl_shared.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libgnustl_shared.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libgnustl_shared.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Core.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Core.so 0xb2d01db8
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Gui.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Gui.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Gui.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Network.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Network.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Network.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Qml.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Qml.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Qml.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Quick.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Quick.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Quick.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Widgets.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Widgets.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Widgets.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Sql.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Sql.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Sql.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5Positioning.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5Positioning.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5Positioning.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5QuickParticles.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/lib/libQt5QuickParticles.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/lib/libQt5QuickParticles.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/plugins/platforms/android/libqtforandroid.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/plugins/platforms/android/libqtforandroid.so 0xb2d01db8
I/Qt ( 4630): qt start
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/plugins/bearer/libqandroidbearer.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/plugins/bearer/libqandroidbearer.so 0xb2d01db8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/local/tmp/qt/plugins/bearer/libqandroidbearer.so 0xb2d01db8, skipping init
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/lib/libQt5QuickParticles.so 0xb2d01db8
D/dalvikvm( 4630): Shared lib '/data/local/tmp/qt/lib/libQt5QuickParticles.so' already loaded in same CL 0xb2d01db8
D/dalvikvm( 4630): Trying to load lib /data/local/tmp/qt/plugins/position/libqtposition_android.so 0xb2d01db8
D/dalvikvm( 4630): Added shared lib /data/local/tmp/qt/plugins/position/libqtposition_android.so 0xb2d01db8
I/QtPositioning( 4630): Positioning start
D/dalvikvm( 4630): GC_CONCURRENT freed 189K, 9% free 2918K/3184K, paused 27ms+24ms, total 266ms
D/dalvikvm( 4630): Trying to load lib /data/app-lib/org.qtproject.example.appTurista-1/libappTurista.so 0xb2cda5c8
D/ ( 4630): (null):0 ((null)): QML debugging is enabled. Only use this in a safe environment.
D/dalvikvm( 4630): Added shared lib /data/app-lib/org.qtproject.example.appTurista-1/libappTurista.so 0xb2cda5c8
D/dalvikvm( 4630): No JNI_OnLoad found in /data/app-lib/org.qtproject.example.appTurista-1/libappTurista.so 0xb2cda5c8, skipping init
I/Qt JAVA ( 4630): DEBUGGER: extra parameters: Bundle[{debug_ping=true, gdbserver_socket=/data/data/org.qtproject.example.appTurista/debug-socket, qml_debug=true, gdbserver_command=/data/data/org.qtproject.example.appTurista/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.appTurista/debug-socket, qmljsdebugger=port:55091,block, ping_socket=org.qtproject.example.appTurista.ping_pong_socket}]
I/Qt JAVA ( 4630): DEBUGGER: removing gdb socket /data/data/org.qtproject.example.appTurista/debug-socket
I/Qt JAVA ( 4630): DEBUGGER: starting /data/data/org.qtproject.example.appTurista/lib/libgdbserver.so --multi +/data/data/org.qtproject.example.appTurista/debug-socket
I/Qt JAVA ( 4630): DEBUGGER: gdbserver started
I/Qt JAVA ( 4630): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.appTurista/debug-socket, attempt 0
I/Qt JAVA ( 4630): DEBUGGER: waiting for socket at /data/data/org.qtproject.example.appTurista/debug-socket, attempt 1
I/Qt JAVA ( 4630): DEBUGGER: socket ok
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Debug socket accepted
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Waiting for debug socket connect
Could not load shared library symbols for 88 libraries, e.g. /system/bin/linker.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.I/Qt JAVA ( 4630): DEBUGGER: go to sleep
I/Qt JAVA ( 4630): DEBUGGER: Incoming socket OK
I/Qt JAVA ( 4630): DEBUGGER: Got pid acknowledgment
I/Qt JAVA ( 4630): DEBUGGER: ping not requested
I/Qt JAVA ( 4630): DEBUGGER: pong not requested
W/Qt A11Y ( 4630): Could not activate platform accessibility.
D/ ( 4630): HostConnection::get() New Host Connection established 0xb7383e58, tid 4666
D/ ( 4630): HostConnection::get() New Host Connection established 0xb73891a8, tid 4630
W/EGL_emulation( 4630): eglSurfaceAttrib not implemented
D/OpenGLRenderer( 4630): Enabling debug mode 0
D/libappTurista.so( 4630): (null):0 ((null)): QML Debugger: Waiting for connection on port 55091...
D/libappTurista.so( 4630): ../appTurista/manejadorbd.cpp:11 (ManejadorBD::ManejadorBD(QObject*)): (ManejadorDB)Apertura de base de datos local: false
D/libappTurista.so( 4630): ../appTurista/manejadorbd.cpp:24 (bool ManejadorBD::cargarDatosDBLocal()): (ManejadorDB)Cargando datos desde DB Local
W/libappTurista.so( 4630): (null):0 ((null)): QSqlQuery::exec: database not open
D/libappTurista.so( 4630): ../appTurista/main.cpp:20 (int main(int, char**)): Error al obtener tamaño de la pantalla.
D/libappTurista.so( 4630): No se puede continuar asi.
D/libappTurista.so( 4630): ../appTurista/globalcontrolclass.cpp:30 (virtual GlobalControlClass::~GlobalControlClass()): (GlobalControlClass)Borrando controlador Global
D/libappTurista.so( 4630): ../appTurista/manejadorbd.cpp:14 (virtual ManejadorBD::~ManejadorBD()): (ManejadorDB)Liberando de memoria lista de promociones y Bases de Datos
D/dalvikvm( 4630): threadid=12: thread exiting, not yet detached (count=0)
Debugging has finished
"org.qtproject.example.appTurista" terminated.
我的 main.cpp:
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QDebug>
#include <QScreen>
#include <QQmlContext>
#include "globalcontrolclass.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QQmlApplicationEngine engine;
GlobalControlClass controlGlobal;
QRect z = qApp->primaryScreen()->availableGeometry();
controlGlobal.setWindowHeight(z.height());
controlGlobal.setWindowWidth(z.width());
if(z.height()<=0 || z.width()<=0){
qDebug()<<"Error al obtener tamaño de la pantalla.\nNo se puede continuar asi.";
return false;
}
qDebug()<<"Window Dip-> H:"<<controlGlobal.windowHeight()<<"W:"<<controlGlobal.windowWidth();
engine.rootContext()->setContextProperty("ControlGlobal", &controlGlobal);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
我使用 Qt Creator 3.3.1 Qt 5.4.1 (GCC 4.6.1, 64 位)AMV 是 ARM (armeabi-v7a) 目标:Android 4.4.2(API 级别 19)
最佳答案
按以下方式解决我的问题。将 qApp->primaryScreen()->availableGeometry();
更改为 qApp->desktop()->availableGeometry();
,如果我得到可用的屏幕尺寸,此解决方案对于主要函数以以下方式开始很重要 QApplication app(argc, argv);
主要.cpp:
#include <QApplication> // <== this is important
#include <QQmlApplicationEngine>
#include <QDebug> // <= with the intention of testing
#include <QScreen> // <== this is important
#include <QDesktopWidget> // <==
#include <QQmlContext>
#include "globalcontrolclass.h"
int main(int argc, char *argv[]){
QApplication app(argc, argv);
QQmlApplicationEngine engine;
GlobalControlClass controlGlobal;
QRect z = qApp->desktop()->screenGeometry();
controlGlobal.setWindowHeight(z.height());
controlGlobal.setWindowWidth(z.width());
qDebug()<<"Window Dip-> H:"<<controlGlobal.windowHeight()<<"W:"<<controlGlobal.windowWidth();
if(z.height()<=0 || z.width()<=0){
qDebug()<<"Error al obtener tamaño de la pantalla.\nNo se puede continuar asi.";
return false;
}
engine.rootContext()->setContextProperty("ControlGlobal", &controlGlobal);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
关于android - Qt Android qApp->primaryScreen()->availableGeometry() 返回 0x0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30175324/
我正在尝试使用 setFont() 方法来设置应用程序范围内更改的字体。我尝试了以下方法: qApp->setFont(); 然而,setFont()不是qApp的一个方法。我不确定如何为整个应用程序
我正在尝试使用 setFont() 方法来设置应用程序范围内更改的字体。我尝试了以下方法: qApp->setFont(); 然而,setFont()不是qApp的一个方法。我不确定如何为整个应用程序
我正在使用 QT 属性系统,我想在修改属性后立即运行特定函数。我关注了Qt documentation设置我的属性(property)及其不同的“插槽”(读、写、通知): class MyClass
据我所知,qApp 是全局指针,因此它应该可以在任何地方访问,但我收到此错误 error: qApp was not declared in this scope。 1 #include "tex
使用 PyQt5,这两个都返回应用程序对象: app = QtWidgets.QApplication.instance() app = QtWidgets.qApp for i in app.arg
我试图用 Qt 语言学家创建一个 Qt 应用程序多语言。我将这段代码放在我的 MainWindow 的一个函数中: translator.load(":/lang/English"); qApp->i
我正在尝试做一个项目,使用 Qt GUI C++ 5.6.2 在窗口上创建一些图形。我有两个名为“createVerticalSpeedIndicator”和“createAirSpeedIndica
如果我使用的是 QApplication 实例,调用 qApp->exec() 或 QCoreApplication::exec() 是否有效?因为它是一个静态函数,所以在这两种情况下 QCoreAp
我有一个执行大量 IO 的循环,所以我不时调用 qApp->processEvents() 以保持 GUI 的 react 性。在 Linux 上,这会导致严重错误,因为提前调用了事件。 是否有可能从
我正在尝试动态更改我的应用程序语言: void MainWindow::ChangeEvent(QEvent *event, QString *language) { if (event->t
我没有在 Qt 文档中找到解释 qApp->setProperty() 选项的部分(它可能在那里,但我不能'找不到它)。有人可以基本上向我解释它是如何工作的以及我应该在什么时候使用它吗? 我问它是因为
我的应用程序绘制图像并为其添加标签。当窗口在等待输入时关闭,应用程序仍然在后台运行。这是我的捕获标签的函数示例。我是否遗漏了一些让程序正常退出的东西? void CustomMainWindow::
你好, 我正在使用 QT (C++) 为自己开发一个小型“ServerManager”。到目前为止一切正常: 我使用 QSettings存储所有相关设置(如服务器、已安装的插件等)。 因为我不想实例化
如果我在桌面(Linux 或 Windows)上使用,在应用程序中使用 qApp->primaryScreen()->availableGeometry(); 时获取可用屏幕的大小,这对我是因为应用程
我是一名优秀的程序员,十分优秀!