Please nominate your Qt Champions for 2021!

Adding stackview qml pages to virtualkeyboard basic example

  • Hi,
    I am very new to qt and qml things...
    I am able to run virtual keyboard example on Raspberry Pi 3 EGLFS QT 5.9...
    It is running perfectly but now I want to add stack view so I can push pop qml pages at event of I modified the file basic-b2qt.qml as shown below and have commented out Basic:{} part and instead inserted stack view and after loading basic-b2qt.qml pushed "Basic.qml " page on stack..and it was showing perfectly on my raspberry pi screen 7" but auto scrolling is disabled by changing this when I touch text field at bottom of screen and type on virtual keyboard the text field stays there behind keyboard ...before adding stack push like this it was auto scrolling up to top edge of keyboard.

    Whole project files same as example just made this changes in basic-b2qt.qml file...

    I don not know about qt qml much just started learning... if this way is wrong how to do it..any suggestion .

    Thank you.

    ** Copyright (C) 2016 The Qt Company Ltd.
    ** Contact:
    ** This file is part of the Qt Virtual Keyboard module of the Qt Toolkit.
    ** Commercial License Usage
    ** Licensees holding valid commercial Qt licenses may use this file in
    ** accordance with the commercial license agreement provided with the
    ** Software or, alternatively, in accordance with the terms contained in
    ** a written agreement between you and The Qt Company. For licensing terms
    ** and conditions see For further
    ** information use the contact form at
    ** GNU General Public License Usage
    ** Alternatively, this file may be used under the terms of the GNU
    ** General Public License version 3 or (at your option) any later version
    ** approved by the KDE Free Qt Foundation. The licenses are as published by
    ** the Free Software Foundation and appearing in the file LICENSE.GPL3
    ** included in the packaging of this file. Please review the following
    ** information to ensure the GNU General Public License requirements will
    ** be met:
    import QtQuick 2.7
    import QtQuick.Window 2.2
    import QtQuick.VirtualKeyboard 2.2
    import QtQuick.VirtualKeyboard.Styles 2.2
    import QtQuick.Controls 2.2
    //import QtQuick.VirtualKeyboard.Settings 2.2
    import "content"
    Item {
        width: 1280
        height: 720
        Item {
            id: appContainer
            width: Screen.width < Screen.height ? parent.height : parent.width
            height: Screen.width < Screen.height ? parent.width : parent.height
            anchors.centerIn: parent
            rotation: Screen.width < Screen.height ? 90 : 0
            // Main stackview
                id: stackView
                focus: true
                anchors.fill: parent
            // After loading show initial Page
            Component.onCompleted: {
                stackView.push("qrc:/Basic.qml")   //initial page
    //        Basic {
    //            id: virtualKeyboard
    //            anchors.left: parent.left
    //            anchors.right: parent.right
    //            anchors.bottom:
    //        }
            /*  Handwriting input panel for full screen handwriting input.
                This component is an optional add-on for the InputPanel component, that
                is, its use does not affect the operation of the InputPanel component,
                but it also can not be used as a standalone component.
                The handwriting input panel is positioned to cover the entire area of
                application. The panel itself is transparent, but once it is active the
                user can draw handwriting on it.
            HandwritingInputPanel {
                z: 79
                id: handwritingInputPanel
                anchors.fill: parent
                inputPanel: inputPanel
                Rectangle {
                    z: -1
                    anchors.fill: parent
                    color: "black"
                    opacity: 0.10
            /*  Container area for the handwriting mode button.
                Handwriting mode button can be moved freely within the container area.
                In this example, a single click changes the handwriting mode and a
                double-click changes the availability of the full screen handwriting input.
            Item {
                z: 99
                visible: handwritingInputPanel.enabled && Qt.inputMethod.visible
                anchors { left: parent.left; top:; right: parent.right; bottom:; }
                HandwritingModeButton {
                    id: handwritingModeButton
                    anchors.right: parent.right
                    anchors.margins: 10
                    floating: true
                    flipable: true
                    width: 76
                    height: width
                    z: 1
                    visible: true
                    state: handwritingInputPanel.state
                    onClicked: = !
                    onDoubleClicked: handwritingInputPanel.available = !handwritingInputPanel.available
            /*  Keyboard input panel.
                The keyboard is anchored to the bottom of the application.
            InputPanel {
                id: inputPanel
                z: 89
                y: appContainer.height
                anchors.left: parent.left
                anchors.right: parent.right
                states: State {
                    name: "visible"
                    /*  The visibility of the InputPanel can be bound to the Qt.inputMethod.visible property,
                        but then the handwriting input panel and the keyboard input panel can be visible
                        at the same time. Here the visibility is bound to property instead,
                        which allows the handwriting panel to control the visibility when necessary.
                    PropertyChanges {
                        target: inputPanel
                        y: appContainer.height - inputPanel.height
                transitions: Transition {
                    id: inputPanelTransition
                    from: ""
                    to: "visible"
                    reversible: true
                    enabled: !VirtualKeyboardSettings.fullScreenMode
                    ParallelAnimation {
                        NumberAnimation {
                            properties: "y"
                            duration: 250
                            easing.type: Easing.InOutQuad
                Binding {
                    target: InputContext
                    property: "animating"
                    value: inputPanelTransition.running
                AutoScroller {}
            Binding {
                target: VirtualKeyboardSettings
                property: "fullScreenMode"
                value: appContainer.height > 0 && (appContainer.width / appContainer.height) > (16.0 / 9.0)

  • Changed this but issue still remains ...any suggestion about this..........

                id: stackView
                focus: true
                ayout.fillWidth: true
                Layout.fillHeight: true

  • got expected output....

Log in to reply