[Interest] Adding icons to android action bar

Robert Iakobashvili coroberti at gmail.com
Sun Apr 30 14:33:39 CEST 2017


On Sun, Apr 30, 2017 at 2:57 PM, Nikos Chantziaras <realnc at gmail.com> wrote:
> Is there a way to add action icons to the Android action bar?
>
> I'm using QMainWindow and QMenuBar (so QWidgets, not QML). QMenuBar doesn't
> have any options for this. I tried QMainWindow::addToolBar(), but the tool
> bar appears below the action bar.
>
> The action bar only has the three vertical "..." dots in it. Isn't there a
> way to populate it with anything more useful?
>

Hi Nicos,
It seems that you need to use JNI or build-in Qt QAndroidJniObject to
call something like this
in your Java file.

public boolean setAppBarTitle(String theNewTitle) {

        final String theFinalTitle = theNewTitle;

        m_qtActivityInstance.runOnUiThread(new Runnable() {
            @Override
            public void run()
            {
                //Log.d(TAG, "::setAppBarTitle - prior to setAppBarTitle");
                m_qtActivityInstance.setAppBarTitle(theFinalTitle);
            }
        });

        return true;
    }



Kind regards,
Robert



More information about the Interest mailing list