Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

A good Android emulator and way of coding



  • Hello all,

    Like many ones, I, too, have always had problems with Android emulators from built-in system images on Qt Creator (when they're downloaded on SDK) up to 3rd-party ones. They have frequently been too slow making testing mobile apps on them almost impossible. Lately I was familiar with BlueStack. It was fine but the issue with that is the output of Qt Quick apps on it differ from the output on a real Android Device. I had to put it away.
    Recently I'm using Genymotion (for personal use). It's been very good and its results have been quite close to the output of a real Android Device. But yesterday it showed a flaw for the simple code below:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtQuick.Controls 2.12
    import QtQuick.Layouts 1.12
    import QtQuick.Dialogs 1.2
    
    ApplicationWindow {
        id: appWin
        visibility: Window.Maximized
    
        RowLayout {
            layoutDirection: Qt.RightToLeft
            Layout.fillWidth: true
    
            Button {
                text: qsTr("Full Name")
                font.pixelSize: appWin.width / 80
                leftPadding: -1
                rightPadding: -1
            }
            Button {
                text: qsTr("Account Details")
                implicitWidth: appWin.width / 1.50
                font.pixelSize: appWin.width / 80
                leftPadding: -1
                rightPadding: -1
            }
            Button {
                text: qsTr("Details")
                implicitWidth: appWin.width / 19
                font.pixelSize: appWin.width / 80
                leftPadding: -1
                rightPadding: -1
    
            }
            Button {
                text: qsTr("Status")
                implicitWidth: appWin.width / 22
                font.pixelSize: appWin.width / 80
                leftPadding: -1
                rightPadding: -1
    
            }
            Button {
                text: qsTr("Close")
                implicitWidth: appWin.width / 22
                font.pixelSize: appWin.width / 80
                leftPadding: -1
                rightPadding: -1
            }
        }
    }
    

    When the Genymotion Android Emulator is on landscape, it shows the buttons properly. (Of course in the original project I've used my eastern language instead of English) But in a real Android phone, the Full Name button exceeds the screen's border and only part of it is shown.
    I can understand that almost no emulator can act exactly like a real Android device. But do you, by any chance, know an emulator which is said to be better and have least number of flaws compared to others, please?
    Incidentally, does the code above suffer from any incorrect settings?



  • Hi, you can try to use Screen.width and Screen.height for the ApplicationWindow's height and width properties.

    ApplicationWindow {
        width: Screen.width
        height: Screen.height
    }
    
    

    For the emulators thing, i can't help you I always use my phone for testing.

    Regards


Log in to reply