Quick Start
Minimal setup
Import the module and drop VirtualKeyboard into your window. The keyboard appears automatically whenever a TextInput or TextEdit receives focus.
import QtQuick 2.15
import Ln.VirtualKeyboard 1.0
Window {
width: 800; height: 600; visible: true
Column {
anchors.fill: parent
TextInput {
width: parent.width
font.pixelSize: 24
focus: true
}
VirtualKeyboard {
width: parent.width
}
}
}
Configuration example
Set input profiles, enable the number row, choose a theme, and configure prediction in a single block:
VirtualKeyboard {
width: parent.width
// Input profiles (56 bundled)
activeProfileIds: ["en-qwerty", "fr-azerty", "ja-romaji"]
currentProfileId: "en-qwerty"
numberRowEnabled: true
predictionEnabled: true
rememberLearning: true
customPredictionMode: Lnvk.Supersede
theme: Lnvk.Dark
panelBackground: "#1a1a2e"
accentColor: "#e94560"
}
Multi-page applications
Important: Instantiate
VirtualKeyboard once per application, not once per page. The keyboard responds to focus changes from any input field anywhere in the app.
Place the keyboard at the application root (outside the page stack) and leave room for it with anchors.bottomMargin:
import QtQuick 2.15
import QtQuick.Controls 2.15
import Ln.VirtualKeyboard 1.0
ApplicationWindow {
width: 800; height: 600; visible: true
StackView {
id: stackView
anchors.fill: parent
anchors.bottomMargin: keyboard.height
initialItem: Page {
header: Label { text: "Page 1" }
TextInput {
anchors.centerIn: parent
text: "Input on page 1"
}
}
Component {
id: page2
Page {
header: Label { text: "Page 2" }
TextInput {
anchors.centerIn: parent
text: "Input on page 2"
}
}
}
}
// Single keyboard instance at application level
VirtualKeyboard {
id: keyboard
width: parent.width
activeProfileIds: ["en-qwerty", "fr-azerty"]
}
}
The keyboard appears automatically when any input field on any page receives focus.
Attempting to create multiple instances will terminate the application with:
LNVK: Multiple instances detected. Only one VirtualKeyboard component may be instantiated per application.