[Solved] Setting ToolBar height on Android
-
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: toolbarRowLayout { 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)!
-
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.
-
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)