Forums

OverviewFelgo 2 Support (Qt 5) › App draw button not visible on android theme.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17880

    Lorne

    I having a problem where the app drawer is not showing up when starting in the android theme. I have the code for two qml files which show the problem. The app drawer button will not show up in the navigation bar. If I use the menu to switch to another theme and then back to android, it will show up. You can see I’m using a loader to load the TopPage.qml. If I don’t use the loader and put the TopPage directly into the App, the app drawer starts just fine. So it’s something to do with the loader. Also, this only happend when I recently updated to the newest version of vplay. On older versions, this worked fine.

    Thanks for any help

    Main.qml:

    import Felgo 3.0
    import QtQuick 2.5
    
    App {
      id: app;
    
      onInitTheme: {
        Theme.platform = "android";
      }
    
      signal pageChanged(string name);
      
      Loader {
        id: appLoader;
        objectName: "appLoader";
        asynchronous: true;
        source: "TopPage.qml";
        anchors.fill: parent;
        visible: false;
        onLoaded: {
          appLoader.item.parent = appContent;
          app.pageChanged(appLoader.source);
        }
    
        function changePage(page) {
    
          appLoader.source = page;
        }  // changePage()
      }
    
      Rectangle {
        id: appContent;
        anchors.fill: parent;
      }
    }
    

     

    import Felgo 3.0
    import QtQuick 2.0
    
    Page {
      id: topPage;
      title: qsTr("Top Page");
      
      Navigation {
        id: nav;
    
        NavigationItem {
          id: testNavItem1;
          title: qsTr("test1");
          icon: IconType.square;
    
          NavigationStack {
            Page {
              title: "Page one";
              AppText {
                text: "text one";
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.verticalCenter: parent.verticalCenter
              }
            }
          }  
        }
    
        NavigationItem {
          id: testNavItem2;
          title: qsTr("test2");
          icon: IconType.circle;
    
          NavigationStack {
            Page {
              title: "Page two";
              AppText {
                text: "text two";
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.verticalCenter: parent.verticalCenter
              }
            }
          }  
        }
      }
    }
    

     

    #17885

    Günther
    Felgo Team

    Hi Lorne,

    I can verify the issue, and I’m also able to get it working together with the Loader, when setting the Loader to asynchronous: false.

    We need to investigate a bit to see why a synchronous Loader breaks the initialization of the drawer button.
    I’ll get back to you once we know more!

    Best,
    Günther

    #17889

    Lorne

    I have set a asynchronous to false and that worked.  Thank you.

    #17904

    Felgo User

    After more experimenting, just setting asynchronous to false is not enough.  It will show the app drawer, but my loader doesn’t work properly.  I eagerly await any news of fixing this bug.

    #17914

    Günther
    Felgo Team

    Hi!

    We’ve had a closer look and added some fixes to the Navigation type, which should initialize the drawer correctly now for this use-case with the Loader.

    Until this fix is public with the next Felgo update, you can use the following workaround to manually update the drawer after your item was loaded:

    Loader {
        id: appLoader;
        asynchronous: true;
        
        // ...
    
        onLoaded: {
          appLoader.item.parent = appContent;
          app.pageChanged(appLoader.source);
    
          // update Android menu icon for app drawer
          item.navigation.tabs.updateAppDrawerIcon();
        }
    }

    NOTE: To get access to your navigation within top page, you can add an alias:

    Page {
          id: topPage;
          title: qsTr("Top Page");
    
          property alias navigation: nav
    
          Navigation {
            id: nav;
            // ...
          }
    }

     

    Best,
    Günther

    #18283

    Felgo User

    I’ve updated to 2.15 and tested asynchronous: true loading again.  It’s better but still not perfect.  I’ll maintain the work around I used with asynchronous: false loading.  I think I like how it works better anyways.

    #18285

    Günther
    Felgo Team

    Hi,

    thanks for the info!

    So you still run into an issue with the Android drawer and Loader / asynchronous setting?
    Which scenario still makes troubles for you?

    Using the workaround of calling the updateDrawerIcon method is not really recommended from our point of view. Internal Navigation changes in the future can lead to the workaround not being available anymore.

    Best,
    Günther

Viewing 7 posts - 1 through 7 (of 7 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support