Getting Started With Qt for Android

Ready to try out Qt’s Android toolchain and leverage some of those fresh Qt 6 modules in your Android app? Or perhaps you’re already using the Qt API but want to see what Qt Creator can do?

Check the video below, which covers:

  • Installing Qt for Android
  • Setting up Qt Creator to work with the Android SDK and OpenSSL
  • Tweaking an example app
  • Deploying an app to hardware or emulators
  • Debugging an android app running on a device

Basically, everything you need to develop cross-platform capable code that shines on Android. Don’t believe me? Try it yourself!

 

For in-depth info see the recently re-vamped Qt for Android documentation.

Do you have a question or can't find what you’re looking for in the video or the documentation? Leave a comment below and tell us what you want us to post next.

 

 


Blog Topics:

Comments

Commenting for this post has ended.

Nils Jeisecke
2 points
15 months ago

Splendid! I see ComboBox and ToolTip using a real popup lurking around the corner ;-)

Can we hope for an OS WebView based Qt WebView on desktop platforms (without QtWebEngine)?

Tor Arne Vestbø
1 point
15 months ago

The goal is indeed for these kinds of controls (combo box drop downs, tooltips, etc) to be top level windows down the line.

The work to implement a Qt WebView backend using WebView2 on windows is tracked by QTBUG-75747. I don't know if there's an alternative for Linux, so there we likely need QtWebEngine for the foreseeable future. If you're in a hurry the new WindowContainer API should give you the building block to embed a WebView2 manually.

David Boosalis
1 point
15 months ago

The second window in the initial app with the dialog at the top does not minimize correctly in my view on Windows, it certainly does not minimize with the same behavior as the primary window (Commenting out the flags property) . The secondary window gets minimized as a tiny title bar and does not seem to expand to the original size when clicked. For me the work around has been to create a second window in C++.Also I wish the QML dialogs were not embedded into its parent component. This might be proper behavior on a embedded device but I think it should be a normal independent window on a desktop (having tried it on Linux). Qt/QML is getting better with every release. Thank you Qt engineers for making such a great opensource product

Tor Arne Vestbø
0 points
15 months ago

Thanks for the support David!

The dialog window in the initial example will be a transient child of the main window, as a result of the automatic transient parent logic for Qt Quick windows. One of the effects of a window being a transient child is that it may have a different representation in the system task switcher UI. If you prefer the dialog window to be an independent top level window you can override the transient parent by setting it to null.

For QML dialogs (and related controls such as Popup) we're working on making them top level windows on relevant platforms. Stay tuned! :)

Mike Trahearn
0 points
15 months ago

This may have a big impact on the roadmap of Qt Application Manager framework!

Dominic Létourneau
0 points
15 months ago

I was wondering if this can be extended to the WebAssembly version of Qt. Could we "embed" an HTML/javascript/CSS document provided by the browser? The typical application I am looking for is embedding a WebRTC application inside a QML Window for instance. Any thoughts ?

Tor Arne Vestbø
0 points
15 months ago

The plan is definitely to enable this for Qt for WebAssembly. It requires support for foreign windows on WASM, which is tracked by QTBUG-116185. The foreign window WId would likely be an emscripten::val representing a HTML element. With a bit of plumbing on the application side you should then be able to embed your <div> or <iframe>.

M
Michael
0 points
15 months ago

I think I have been waiting for this for 10 years. This means that we can finally render a QML interface on top of a window that's being managed by a game engine like Ogre or Panda, right ? It's something that I managed to do with QtWidget, which was a great way to create game editors... but I had never been able to do it with QML, which would've been perfect for in-game interfaces. That's great news. Goodbye Awesomium.

Tor Arne Vestbø
0 points
14 months ago

Actually, the use-case you are describing (embedding Qt UIs into other non-Qt UIs) is the opposite of what this new Qt Quick feature is about (embedding non-Qt UIs into Qt Quick UIs). They are definitely related though, and some of the work for this new feature has likely improved the other use-case as well. To embed a Qt Quick UI in a non-Qt UI you can use QWindow::fromWinId to wrap the non-Qt window, and then use setParent on the QQuickWindow to reparent it into the foreign UI.

Arun PK
0 points
14 months ago

Very Nice! I was trying out a simple use case to have a movable window inside main window. here is my code snippet. ``` import QtQuick import QtQuick.Controls

Window { id: mainWindow width: 640 height: 480 visible: true

Window {
    id: childWindow
    color: "steelblue"
    parent: mainWindow
    visible: true
    flags: Qt.FramelessWindowHint

    MouseArea {
        anchors.fill: parent
        property var clickPos: Qt.point(0, 0)

        onPressed:(mouse) => {
                      clickPos  = Qt.point(mouse.x,mouse.y)
                  }

        onPositionChanged: (mouse) =>{
                               var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
                               childWindow.x += delta.x;
                               childWindow.y += delta.y;
                           }
    }

    Column {
        anchors.centerIn: parent
        Label {
            anchors.horizontalCenter: parent.horizontalCenter
            text: `Drag to move !\n${childWindow.x}, ${childWindow.y}`
        }

        Button {
            text: childWindow.parent === null ? "Attach" : "Detach"
            onClicked: {
                childWindow.parent = childWindow.parent === mainWindow ? null : mainWindow
            }
        }
    }
}

} ```

If you detach the widow and drag it using the MouseArea the window moves fine, but if I do the same when it is being inside I see weird flickering because of wrong position while dragging. How do I fix it?

Tor Arne Vestbø
0 points
14 months ago

Please file a bug report and CC me, thanks!

Sai Krishna Sangapu
-3 points
15 months ago

Provide the code snippets is python so that we know the intended type of usage

Tor Arne Vestbø
1 point
15 months ago

The snippets in this blog post are QML, showcasing the QML APIs for window containment. If you're referring to the windowembedding manual test, that's just a minimal C++ wrapper. You'll find matching Python APIs in Qt for Python to e.g. create a foreign window.