89737

qml virtual keyboard: keyboardDesignWidth and Height

Question:

I am looking at the QML Style for the virtual keyboard. What is the purpose of keyboardDesignWidth and Height? I seem to have a lot of trouble managing the width and height of the keyboard and can never set it to how I want it. Setting the keyboardHeight and Width directly also does not help much.

The issue is that the component background size is somehow computed behind the scenes. So, even when I have the keyboard buttons and size how I want, the extraneous background covers some of my other control and it is very difficult to have a fine grained control over the size of the keyboard.

What is the right way to control the width and size of the virtual keyboard directly?

Answer1:

To Quote from the <a href="https://doc.qt.io/qt-5/qml-qtquick-virtualkeyboard-inputpanel.html#details" rel="nofollow">Documentation</a>

<blockquote>

The keyboard size is automatically calculated from the available width; that is, the keyboard maintains the aspect ratio specified by the current style. Therefore the application should only set the width and y coordinates of the InputPanel, and not the height.

</blockquote>

So if you want to have a specific height, you need to set the width accordingly.

<blockquote>

What is the right way to control the width and size of the virtual keyboard directly?

</blockquote>

e.g.

InputPanel { anchors.fill: parent anchors.leftMargin: 100 anchors.rightMargin: 100 }

e.g.

InputPanel { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom width: 30 }

So what's the deal with the keyboardDesignHeight/Width? Well this seems to be the dimensions of the keyboard, when it is not necessary to scale it:

<blockquote>

<strong>scaleHint : real</strong><br /> The keyboard style scale hint. This value is determined by dividing keyboardHeight by keyboardDesignHeight. All pixel dimensions must be proportional to this value.<br /><em>This property is readonly!</em>

</blockquote>

So setting those will not disable the automatic resizing of your input panel in dependence of the width.

You might use them maybe, to calculate a ratio, and from this set the width to achieve your desired height.

Maybe this example helps you to understand this property:

import QtQuick 2.6 import QtQuick.Window 2.0 import QtQuick.Controls 2.0 import QtQuick.VirtualKeyboard 2.0 ApplicationWindow { id:appwindow visible: true width: 800 height: 600 title: qsTr("Test") InputPanel { id: ip anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom width: 800 Component.onCompleted: console.log(Object.keys(ip.keyboard.style).sort()) } Slider { id: sl from: 0 to: 3000 } Binding { target: ip.keyboard.style property: 'keyboardDesignHeight' value: sl.value } }

Recommend

  • Request and session in Servlet
  • Alternative to Lock.tryLock() in Java 1.4
  • How to plot predictions of binomial GLM that has both continuous and categorical variables
  • flex-shrink behaviour in different browsers [duplicate]
  • Where to get negative sample images for Haar training? [closed]
  • How can I create a list of elements with the same xpath using selenium with python?
  • KineticJS : scaling issue while using custom clipFunc on 2x pixel aspect display
  • Individual Preferences for each item in a ListView?
  • Alternate (Free) to AOP PostSharp for method tracing (and exception)
  • Expand header row into multiple child rows
  • Hadoop/map-reduce: Total time spent by all maps in occupied slots vs. Total time spent by all map ta
  • Displaying and sizing a grayscale from a QImage in Qt
  • Is creating a new version of an object in AWS S3 eventually consistent or read-after-write consisten
  • ASP.NET MVC - Detect Time Spent on Page
  • Picasso Taking time to load images
  • How does ActiveSupport do month sums?
  • Failed to find version-tag string. File must be updated
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • How to access meteor package name inside package?
  • Cannot access Public method in Web Control's Page_Load event
  • Xamarin Android | Layout style
  • Salesforce Different WSDL files and when to use
  • SAXReader not re-ecape characters
  • how does System.Web.HttpRequest::PathInfo work?
  • How to do unit test for HttpContext.Current.Server.MapPath
  • QLineEdit password safety
  • NetLogo BehaviorSpace - Measure runs using reporters
  • Nant, Vault & Windows Integrated Authentication
  • swift auto completion not working in Xcode6-Beta
  • Bug in WPF DataGrid
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • Excel - Autoshape get it's name from cell (value)
  • jQuery tmpl and DataLink beta
  • How can I estimate amount of memory left with calling System.gc()?
  • PHP: When would you need the self:: keyword?
  • Acquiring multiple attributes from .xml file in c#
  • Hits per day in Google Big Query
  • reshape alternating columns in less time and using less memory
  • How can I use threading to 'tick' a timer to be accessed by other threads?