Skip to content

Mobile and Embedded

The forum for developing everything embedded: Linux, WinCE, Symbian, MeeGo... you name it.
14.1k Topics 62.2k Posts
QtWS25 Last Chance
  • Is there a way to compile a Qt iOS project with xCode?

    Unsolved
    3
    1 Votes
    3 Posts
    448 Views
    KH-219DesignK
    In case anyone also is curious whether you can achieve an unattended continuous integration build of a Qt iOS project, here is how I got that to work in GitHub CI actions: https://github.com/219-design/qt-qml-project-template-with-ci/pull/34 I set it up in 2020, but as of today (Jan 2022) this CI job is still running. (The project uses Qt5, not 6)
  • Qlable.setpixmap showing segmentation fault

    Unsolved
    4
    0 Votes
    4 Posts
    549 Views
    JonBJ
    @swansorter I don't know why you are using threads --- about half the time people use them they don't need to. But assuming you do, you can only communicate with the main UI thread by sending a signal, with whatever (non-UI-type) parameters are necessary which the UI thread has a slot on and acts upon receiving the signal. For example, since I believe secondary threads can use QImage but cannot use QPixmap (and certainly not call QLabel::setPixmap()) I think you could emit imageCaptured(img) from image_plot() and have a slot MainWindow::onImageCaptured(const QImage &img) which does the ui->label->setPixmap(QPixmap::fromImage(img.rgbSwapped())); in the main thread.
  • if I use eglfs_kms, dose the qt use the graphics to render widget?

    Unsolved
    1
    0 Votes
    1 Posts
    113 Views
    No one has replied
  • Cross Compiling Qt5.15.2 for raspberry pi 4

    Solved
    2
    0 Votes
    2 Posts
    2k Views
    DehghannnD
    I used xuancong84 's solution on this post: https://forum.qt.io/topic/88588/qtbase-compilation-error-with-device-linux-rasp-pi3-g-qeglfskmsgbmwindow-cpp/9 and now it's fixed.
  • Call Java method from c++

    Solved
    3
    0 Votes
    3 Posts
    735 Views
    mrdebugM
    Below examples on how to use java methods with arguments Java public int Test01() { System.out.println("Test01"); return 0; } public int Test02(int Value) { System.out.println("Test02"); System.out.println(Value); return 0; } public int Test03(String Value) { System.out.println("Test03"); System.out.println(Value); return 0; } public String Test04(int Value) { System.out.println("Test04"); System.out.println(Value); return "Hello!!!"; } public String Test04b(String Value) { System.out.println("Test04b"); System.out.println(Value); return "Hello!!!"; } public String[] Test05(String Value1, String Value2) { System.out.println("Test05"); System.out.println(Value1); System.out.println(Value2); String[] Result= new String[2]; Result[0]= "Hello"; Result[1]= "world!!!"; return Result; } Qt / C++ qDebug() << "Test01 result:" << QtAndroid::androidActivity().callMethod<jint>("Test01"); qDebug() << "Test02 result:" << QtAndroid::androidActivity().callMethod<jint>("Test02", "(I)I", 10); QAndroidJniObject Value1= QAndroidJniObject::fromString("Value1"); QAndroidJniObject Value2= QAndroidJniObject::fromString("Value2"); qDebug() << "Test03 result:" << QtAndroid::androidActivity().callMethod<jint>("Test03", "(Ljava/lang/String;)I", Value1.object<jstring>()); qDebug() << "Test04 result:" << QAndroidJniObject(QtAndroid::androidActivity().callObjectMethod("Test04", "(I)Ljava/lang/String;", 123456)).toString(); qDebug() << "Test04b result:" << QAndroidJniObject(QtAndroid::androidActivity().callObjectMethod("Test04b", "(Ljava/lang/String;)Ljava/lang/String;", Value1.object<jstring>())).toString(); QAndroidJniObject stringArray= QtAndroid::androidActivity().callObjectMethod("Test05", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;", Value1.object<jstring>(), Value2.object<jstring>()); if (stringArray.isValid()) { jobjectArray objectArray= stringArray.object<jobjectArray>(); for (int count= 0; count< env->GetArrayLength(objectArray); count++) { QAndroidJniObject AndroidJniObject= env->GetObjectArrayElement(objectArray, count); qDebug() << AndroidJniObject.toString(); } }
  • anyone got qt oauth2 working on mobile device ?

    Unsolved
    1
    0 Votes
    1 Posts
    178 Views
    No one has replied
  • Write access to SD card in Android

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    M
    Hi everyone, The application is a Qt Widget project targetting Android 11 version (api 30). I was able to find my way through by realizing that Android does not allow by definition write access to any location if it is not allowed by the operating system itself. A few links that helped me were: #1: https://stackoverflow.com/questions/28655181/calling-java-function-from-qt-c #2: https://doc.qt.io/qt-6/qjniobject.html #3: https://web.archive.org/web/20200217035702/http://schorsch.efi.fh-nuernberg.de/roettger/index.php/QtOnAndroid/JNI #4: https://developer.android.com/about/versions/11/privacy/storage I had to fix a few things since my Qt version is 6.1.3. I basically had to write a function that calls java functions through the abstraction class QJniObject in order get my hands on the writable paths. Paths for the flash memory in Android can be retrieved with QStandardPaths::writableLocation(QStandardPaths::StandardLocation type). However my problem was writing / copying files & dirs from flash to the SD card. So using the abstraction class above i was able to put together a function with the help of link #3. I had to change the names of some classes like QAndroidJniEnvironment to QJniEnvironment, QAndroidJniObject to QJniObject etc. Your .pro file does not require module 'androidextras' and you do not need to include QtAndroidExtras header. However i had to conditionally include: #if defined (Q_OS_ANDROID) // To be replaced by <QtAndroid> in Qt 6.2 #include <QtCore/private/qjnihelpers_p.h> // Abstraction class #include <QJniObject> #endif The following function returns a QStringList of writeable paths. In my case i used it to embed both Android and Linux specific directories. // Return a list of writable paths QStringList getWritablePaths(void){ QStringList paths; #if defined (Q_OS_ANDROID) QJniObject context(QtAndroidPrivate::activity()); //QJniObject package = context.callObjectMethod("getPackageName", "()Ljava/lang/String;"); //notice("Package name: %s", package.toString().toStdString().c_str()); // Call a java function through the abstraction QJniObject dirs = context.callObjectMethod("getExternalFilesDirs", "(Ljava/lang/String;)[Ljava/io/File;", NULL); // Valid dirs exist if (dirs.isValid()){ QJniEnvironment env; // Size of dirs found jsize size = env->GetArrayLength(dirs.object<jarray>()); // Iterate through the dirs found and add them in the QStringList for (int ctr = 0; ctr<size; ctr++){ QJniObject dir = env->GetObjectArrayElement(dirs.object<jobjectArray>(), ctr); paths.push_back(dir.toString()); notice("External directory found [%d]: [%s]", ctr, dir.toString().toStdString().c_str()); } } #elif defined (Q_OS_LINUX) // Get the current working directory in Linux char cwd[128]; getcwd(cwd, 127); paths.push_back(QString(cwd)); #endif return paths; } Examples of path strings returned: Flash memory application specific path: "/storage/emulated/0/Android/data/org.qtproject.example.name_of_app/files" SD Card memory application specific path: "/storage/34FB-5BF5/Android/data/org.qtproject.example.name_of_app/files" One should not rely on the patterns seen above but rather use the function to get the actual path strings which will most probably change from maker to maker, across different android versions, different SD cards and also after re-formatting an SD card. Regarding SAF (Storage Application Framework) here is what I found: Qt supports it natively and transparently (i.e. for normal QDir/QFile operations) since https://code.qt.io/cgit/qt/qtbase.git/commit/?id=7d2d1eb9e051ad01dc5c5c3053c58364885bdc07 for "content://" URIs . However, for this particular case of backing up binary files to an app-specific location on external SD card it wasn't required. Regards Manos
  • Strange layout of main app window on iOS

    Unsolved ios
    2
    0 Votes
    2 Posts
    380 Views
    D
    @Dmitriano It is probably not a trivial question because, as far as I see, setting window width and height to Screen.width and Screen.height is not a solution, because there can be task bar and something else (I do not know what can it be on iOS) that partially occupies the screen.
  • Get data in customActivity from Qt

    Unsolved android
    2
    0 Votes
    2 Posts
    384 Views
    A
    My question is I want to send data and retrieve it in java. for exeomple void ActivityHandler::activityReceiver(int requestCode, int resultCode, const QAndroidJniObject &data) { if (requestCode == REQUEST_CODE) { if (resultCode == RESULT_OK) { const QAndroidJniObject key = QAndroidJniObject::fromString("message"); const QAndroidJniObject message = data.callObjectMethod( "getData", "(Ljava/lang/String;)Ljava/lang/String;", key.object()); if (message.isValid()) emit ActivityHandler::instance()->receiveFromActivityResult(message.toString()); } else { emit ActivityHandler::instance()->receiveFromActivityResult("Rejected!"); } } }
  • QtAndroid Extra

    Locked Unsolved
    3
    0 Votes
    3 Posts
    254 Views
    A
    That's right, I just signed up. Thank you for this reminder
  • Problem with the Mobile Qt Application development

    Unsolved
    5
    0 Votes
    5 Posts
    404 Views
    A
    Good morning, @jsulm, is that what happened, is that when compiling the application to Android, the buttons do not work well, that is, they do absolutely nothing
  • Build for jetson tx2nx

    Unsolved
    1
    0 Votes
    1 Posts
    135 Views
    No one has replied
  • QT to connect ft232 fifo mode

    Unsolved
    10
    0 Votes
    10 Posts
    733 Views
    S
    @mrdebug OS ubuntu16.04, If you know how to do that please help me.
  • Build For iOS

    Unsolved
    2
    0 Votes
    2 Posts
    224 Views
    jsulmJ
    @NullByte You need a Mac. Then you install XCode. Then you install Qt for iOS using Qt Online INstaller. Then you build your app. https://doc.qt.io/qt-5.15/ios.html
  • WebView load files on Android 11 API 30

    Unsolved
    4
    0 Votes
    4 Posts
    669 Views
    M
    Hi all I would like to change this settings - setAllowFileAccess(true) via java code. I can call static functions with AndroidJNI, I have created small class for that, but the problem is that I don't know ID of the WebView. In every example I see they use findViewById and it looks like this is ID from XML file describing layout. Anyone knows what can be the ID of WebView initialized by Qt ? Or can this be done otherwise ? import org.qtproject.qt5.android.bindings.QtApplication; import org.qtproject.qt5.android.bindings.QtActivity; import android.content.Intent; import android.app.Activity; import android.os.Bundle; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.os.Bundle; import java.io.File; import android.net.Uri; public class WebViewSettings extends QtActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public static boolean updateSettings(String dummy) { WebView webView = (WebView) findViewById(R.id.webview); WebSettings webSettings = webview.getSettings(); webSettings.setAllowFileAccess(true); return true; } } https://stackoverflow.com/questions/70412798/webview-setallowfileaccess-from-qt-application Best Regards Marek
  • setting up qt with beaglebone black

    Unsolved beaglebone bbb milosoutio embedded qt bbb
    1
    0 Votes
    1 Posts
    257 Views
    No one has replied
  • Qt Multimedia GStreamer video doesn't work on Rpi3

    Unsolved
    1
    2 Votes
    1 Posts
    297 Views
    No one has replied
  • How to link OpenSSL libraries in CMake Qt Android app?

    Solved
    5
    0 Votes
    5 Posts
    3k Views
    advmA
    @piervalli thank you so much for the provided links, this worked for me
  • Qtusb for Bulk Transfer

    Unsolved
    1
    0 Votes
    1 Posts
    332 Views
    No one has replied
  • Serial Communication(Android)

    Unsolved
    3
    0 Votes
    3 Posts
    347 Views
    H
    thank you but i dont find anything useful