Offer Products Case Studies Expertises About us Contact Blog
FR EN

Configuration

Word prediction

Enabled by default. Disable it globally on the component or at runtime via the singleton:

VirtualKeyboard { predictionEnabled: false }

// or at runtime:
Lnvk.predictionEnabled = false

Prediction is automatically disabled for fields with Qt.ImhNoPredictiveText, Qt.ImhSensitiveData, Qt.ImhHiddenText, or any numeric, dial, date, or time hint. Read-only properties Lnvk.effectivePredictionEnabled and Lnvk.imeInteractionEnabled reflect the active hint mask (see Input method hints).

Custom prediction dictionaries

Provide domain-specific prediction dictionaries (medical, legal, product names, etc.) per language.

Step 1: Build a .pred file

Use the packaged compiler from your LNVK bundle:

# From package root
./bin/lndict-compiler --flat my-words.txt prediction-en-custom.pred

Input formats accepted by --flat:

  • Word list (one word per line): word
  • Word + frequency: word<TAB>frequency
  • Full prediction TSV: word<TAB>word<TAB>frequency

Word-list rows automatically get a high default frequency so custom entries rank near the top.

Step 2: Register custom dictionaries in your app

Register one dictionary per language/tag.

From QML (via the Lnvk singleton):

import Ln.VirtualKeyboard 1.0

Component.onCompleted: {
    Lnvk.setCustomPredictionDictionary("en", "/opt/mydicts/prediction-en-custom.pred")
    Lnvk.setCustomPredictionDictionary("en-US", "/opt/mydicts/prediction-en-us-custom.pred")
}

From C++:

#include <lnvk>

auto *kb = lnvk::qt::KeyboardManager::instance();
kb->setCustomPredictionDictionary("en", "/opt/mydicts/prediction-en-custom.pred");
kb->setCustomPredictionDictionary("en-US", "/opt/mydicts/prediction-en-us-custom.pred");

Both paths refer to the same singleton instance; calls made from C++ are visible from QML and vice versa.

Language resolution order:

  1. exact BCP47 tag (for example en-US)
  2. primary tag fallback (for example en)

Step 3: Choose merge mode

VirtualKeyboard {
    customPredictionMode: Lnvk.Supersede
}

// or on the singleton:
Lnvk.customPredictionMode = Lnvk.Supersede

From C++:

auto *kb = lnvk::qt::KeyboardManager::instance();
kb->setCustomPredictionMode(lnvk::qt::KeyboardManager::Supersede);

Modes:

  • Disabled: ignore custom dictionaries; use built-in only
  • Replace: use custom dictionary only for matching language/tag (fallback to built-in if missing/invalid)
  • Supersede: custom candidates first, then built-in candidates

Clear mappings at runtime:

Lnvk.clearCustomPredictionDictionary("en-US")
Lnvk.clearCustomPredictionDictionaries()
kb->clearCustomPredictionDictionary("en-US");
kb->clearCustomPredictionDictionaries();

Number row

Show a persistent row of digit keys above the letter row:

VirtualKeyboard { numberRowEnabled: true }

Lnvk.numberRowEnabled = true

Learning

The keyboard learns from typed words to improve future predictions. Disable persistence across sessions with rememberLearning:

VirtualKeyboard { rememberLearning: false }

Lnvk.rememberLearning = false
Privacy: all learning is on-device. No data leaves the device. Setting rememberLearning: false discards learned words when the application exits.

Input method hints

The keyboard adapts automatically to inputMethodHints on the focused TextInput or TextEdit:

HintLayoutIMEPrediction
Qt.ImhNoneProfile layoutonon (if enabled)
Qt.ImhDigitsOnlyNumeric keypadoffoff
Qt.ImhDialableCharactersOnlyDial padoffoff
Qt.ImhFormattedNumbersOnlyNumbers with decimal/signoffoff
Qt.ImhDateDate input layoutoffoff
Qt.ImhTimeTime input layoutoffoff
Qt.ImhPreferNumbersNumbers with letter accessoffoff
Qt.ImhEmailCharactersOnlyEmail keys on alphabetic layoutoffon
Qt.ImhUrlCharactersOnlyURL keys on alphabetic layoutoffon
Qt.ImhNoPredictiveTextProfile layoutoffoff
Qt.ImhSensitiveDataProfile layoutoffoff
Qt.ImhHiddenTextPassword mode (numeric if also sensitive)offoff

When IME is off, any active composition is cleared. The candidate bar remains visible for word prediction when effectivePredictionEnabled is true. When imeInteractionEnabled is true, the bar also appears during IME composition and post-commit character suggestions.