mirror of
https://github.com/RustyRaptor/plasma-keyboard.git
synced 2026-12-03 15:55:19 -07:00
Currently layouts are created with the KeyboardLayout component. When we switch to alternate layouts (i.e. numpad, symbols), the Keyboard switches out the KeyboardLayout completely to the alternate layout's KeyboardLayout. We currently don't have a "holding" object for a keyboard layout, preventing us from having a shared TextComposer session between all of the "sublayouts" within a layout (ex. QWERTY <-> symbols <-> numpad) This is problematic for CJK because the TextComposer gets reset when we switch to other pages, like the symbols page. --- This MR introduces a "KeyboardLayoutDefinition" holding component for layouts, so that we can retain state within a keyboard layout. In this case, we keep the TextComposer on the KeyboardLayoutDefinition rather than the KeyboardLayout so it isn't reset when we switch to other keyboard pages. I also replaced the JSON-specified alternate layouts with it now being specified on the KeyboardLayoutDefinition, which makes things a bit more centralized. --- Kind of annoying that I had to do this after porting the layouts, but this was a big oversight I missed that came up during CJK testing :/
53 lines
1.4 KiB
QML
53 lines
1.4 KiB
QML
/*
|
|
SPDX-FileCopyrightText: 2026 Devin Lin <devin@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
*/
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.plasma.keyboard.virtualkeyboard
|
|
|
|
ColumnLayout {
|
|
id: root
|
|
|
|
/**
|
|
* Default weight of keys.
|
|
*/
|
|
property real defaultKeyWeight: 100
|
|
|
|
/**
|
|
* Default height weight of keyboard rows.
|
|
*/
|
|
property real defaultRowHeightWeight: 100
|
|
|
|
/**
|
|
* Set a maximum width of the keyboard in relation to its height (so it doesn't stretch forever).
|
|
*/
|
|
property real maxWidthToHeightRatio: -1
|
|
|
|
/**
|
|
* Multiplier for the keyboard panel height. Use this for layouts with extra rows.
|
|
*/
|
|
property real panelHeightFactor: 1
|
|
|
|
property string packageId: ""
|
|
property string layoutId: ""
|
|
property var virtualKeyboardContext: null
|
|
readonly property var inputEngine: virtualKeyboardContext ? virtualKeyboardContext.inputEngine : VirtualKeyboard.inputEngine
|
|
|
|
/**
|
|
* Text composer to use while this layout is shown, instead of the one from the KeyboardLayoutDefinition (which is shared by all of its layout types).
|
|
*
|
|
* The active text composer is inputEngine.textComposer.
|
|
*/
|
|
property QtObject textComposer: null
|
|
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
width: parent ? parent.width : implicitWidth
|
|
height: parent ? parent.height : implicitHeight
|
|
spacing: 0
|
|
}
|