[Qt-qml] Virtual keyboard and PageStack model

Harri Pasanen harri at mpaja.com
Sun Nov 13 20:35:06 CET 2011


On 11/13/2011 06:49 PM, Sivan Greenberg wrote:
> On Sun, Nov 13, 2011 at 5:33 PM, Harri Pasanen<harri at mpaja.com>  wrote:
>> I have a TextField and if I just set
>> focus = true the virtual keyboard pops up which was somewhat surprising.
> I'll also be glad to know how to have the text field in focus, or
> "highlighted" so user would know it is expecting input and only if a
> user pressed it to open the VKB.
You can probably juggle this with TextEdit property
enableSoftwareInputPanel and methods
*open- and closeSoftwareInputPanel 
<http://harmattan-dev.nokia.com/docs/library/html/qt-components/qt-components-meego-textfield.html?tab=1#openSoftwareInputPanel-method>*

>> More annoying for me is that the virtual keyboard does not overlap the
>> screen, but it pushes the active window contents up to make place for
>> itself.   Looking at the TextField documentation did not mention
>> anything in particular about this effect.  I honestly don't know in
>> which circumstances this would be the desirable behaviour, but how to
>> turn that off?
> So I'm working on a map application using the googlemaps qml example,
> and it overlaps it which is annoying because I want to be able to show
> the address text input even if the VKB is open :) I wonder how I can
> make it behave like it does for you.
>

I played with this a bit more, and the trigger seams to be that items 
are in a Column.

This illustrates the behaviour even on desktop:

import QtQuick 1.1
import com.nokia.meego 1.0

PageStackWindow {
     id: appWindow

     initialPage: Page {
         Column {
             id: column1
             spacing: 10
             anchors.right: parent.right
             anchors.rightMargin: 5
             anchors.left: parent.left
             anchors.leftMargin: 5
             anchors.bottom: parent.bottom

             Label {
                 height: 300
                 text: qsTr("Hello world 1")
             }

             Label {
                 height: 300
                 text: qsTr("Hello world 2")
             }

             TextField {
                 width: parent.width
             }
         }

     }
}

When textfield is clicked, everything moves up.
If I remove the Column as follows, everything stays put.

PageStackWindow {
     id: appWindow

     initialPage: Page {
         anchors.right: parent.right
         anchors.rightMargin: 5
         anchors.left: parent.left
         anchors.leftMargin: 5
         anchors.bottom: parent.bottom

         Label {
             y: 100
             height: 300
             text: qsTr("Hello world 1")
         }

         Label {
             y: 400
             height: 300
             text: qsTr("Hello world 2")
         }

         TextField {
             anchors.bottom: parent.bottom
             width: parent.width
         }
     }
}



/Harri



More information about the Qt-qml mailing list