Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Setting ToolBar height on Android

[Solved] Setting ToolBar height on Android

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    teamAR
    wrote on last edited by
    #1

    I'm new to Qt Quick, apologies in advance if the question is basic.

    I'm developing an app for iOS and Android on a Mac with OSX 10.9.5 using Qt 5.3.2 (with ArcGIS runtime SDK).

    When run under iOS the toolBar height adjusts to fit the largest icon size used in ToolButton (note this is within RowLayout). Looks great and works for me.

    The same code run on Android seem to default to a truly short toolbar height. I've tried to increase height using height: and its variants, and even dug back to the ToolBarStyle file and changed implicitHeight:, all without success. Larger icons also don't seem to make a difference, it appears something specific to the Android OS wants to override height regardless.

    Screen shots below...

    Is there something I'm missing? Thanks in advance for any help!

    @ toolBar: ToolBar {
    id: toolbar

        RowLayout {
            width: parent.width
            id: topMenu
            ToolButton{
                iconSource: "qrc:/bv_47dpi.png"
            }
            ToolButton{
                iconSource: "qrc:/ar.png"
            }
            ToolButton{
                iconSource: "qrc:/autocenter_on.png"
            }
        }
    

    @

    The following are screen captures from iPhone and Android runtime.

    Note the different toolBar heights.

    I'm still stumped as to how to adjust the Android toolBar height, is there a workaround or should I not use the ToolBar?

    Thanks, Chuck

    !http://i.imgur.com/P5NPIYQ.png(This is a screen capture from the iPhone runtime.)!

    !http://imgur.com/rYvRwGJ.png(This is a screen capture from the Android runtime)!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      teamAR
      wrote on last edited by
      #2

      Solved this myself, rather simple and just part of the learning curve.

      The ToolButton icon must be different size based on the platform. I used 48x48 pixels for iOS and 128x128 pixels for Android.

      Qt.platform.os provides OS type, so I created functions to select the icon based on this, and then simply call the function from ToolButton. Key lines of code:

      @ function getsettings_icon() {
      var src = "/settings-48.png"
      if(Qt.platform.os == "android") src = "/settings-128.png"
      return src
      }

       toolBar: ToolBar {
          id: toolbar
      
         RowLayout {
              width: parent.width
              id: topMenu
      
              ToolButton{ iconSource: getsettings_icon() }
        }
      

      }
      @

      Obviously lots of room for optimization, but that's toolbar height for Android solution.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        morte
        wrote on last edited by
        #3

        That ToolBar from pic looks strange for me, what Android version is on device and is there ApplicationWindow?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          teamAR
          wrote on last edited by
          #4

          I'm running Android 4.4.4 on a Samsung GalaxyS4. The example code is within ApplicationWindow. Below are the current screen shots (Android top, iPhone bottom)

          !http://i.imgur.com/Vnof5sM.png(Android)!

          !http://i.imgur.com/AeSWHeW.png(iOS)!

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved