Android menu without qml etc.



  • I have a presentation problem with using qmenubar, qmenu & qaction for an android tablet. Presently the menu "headers" appear within an options menu (the three box/bar icon located at the top right). However, once a particular menu "heading" has been selected the drop down menu appears in the top left of the screen.

    I wish to keep things simple and do not want to get involved in adding further dependencies to things like qml. So, I am looking for a solution that uses standard C++ calls or passing details to setstylesheet.

    Presently, I would be happy with solutions that relocates the dropdown menu adjacent to the "header" menu selected. I would be also interested to learn how to move the options icon (to the top left). I'm using qt creator 4.5/qt 5.10.



  • I see the same behaviour running this example: http://doc.qt.io/qt-5/qtquickcontrols-gallery-example.html

    Is this deemed to be a standard style? Seems awkward to have menus jumping around. Perhaps this is a bug? I have the Android 27 sdk.



  • Using NDK Revision 16.1.4479499



  • setNativeMenuBar(false) and using setStyleSheet() to modify menu font size enables a classic desktop presentation. Old, perhaps, but at least the menus appear where you expect them.

    Still interested in the native remedy.



  • Hi,
    for an easy native-styled Android menu (QML-based though), you can also have a look at V-Play Engine, which extends Qt and handles native features and styling for Android and iOS.

    E.g. for a native styled Navigation, with the V-Play Navigation Components:

    import VPlayApps 1.0
    
    App {
      Navigation {
        NavigationItem {
          title: "Home"
          icon: IconType.home
    
          NavigationStack {
            Page { title: "Home" }
          }
        }
    
        NavigationItem {
          title: "Favorites"
          icon: IconType.star
    
          NavigationStack {
            Page { title: "Favorites" }
          }
        }
      }
    }
    

    Best,
    GTDev


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.