2
* Copyright 2013 Canonical Ltd.
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as published by
6
* the Free Software Foundation; version 3.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
property var content: c1
25
property string symbols: "languages/Keyboard_symbols.qml"
26
property bool capsLock: false
32
Component.onCompleted:
38
onWidthChanged: calculateKeyWidth()
39
onHeightChanged: calculateKeyHeight();
41
function numberOfRows() {
42
return content.children.length;
45
// we don´t use a QML layout, because we want all keys to be equally sized
46
function calculateKeyWidth() {
47
var width = panel.width;
50
for (var i = 0; i < numberOfRows(); ++i) {
51
if (content.children[i].children.length > maxNrOfKeys)
52
maxNrOfKeys = content.children[i].children.length;
55
var maxSpaceForKeys = panel.width / maxNrOfKeys;
57
panel.keyWidth = maxSpaceForKeys;
60
function calculateKeyHeight() {
61
panel.keyHeight = panel.height / numberOfRows();