Commit b8b2e0e5 authored by Damien Caliste's avatar Damien Caliste

[fingerterm] Update keyboard columns and rows when changing layout. Contributes TJC#214381

parent 8f9a4d5f
......@@ -35,7 +35,7 @@ KeyLoader::~KeyLoader()
{
}
bool KeyLoader::loadLayout(QString layout)
bool KeyLoader::loadLayout(const QString &layout)
{
bool ret = false;
if(layout.isEmpty() || !iUtil)
......@@ -155,6 +155,8 @@ bool KeyLoader::loadLayoutInternal(QIODevice &from)
if (!ret)
iKeyData.clear();
else
emit vkbChanged();
return ret;
}
......
......@@ -36,20 +36,23 @@ struct KeyData {
class KeyLoader : public QObject
{
Q_OBJECT
Q_PROPERTY(int vkbRows READ vkbRows NOTIFY vkbChanged)
Q_PROPERTY(int vkbColumns READ vkbColumns NOTIFY vkbChanged)
public:
explicit KeyLoader(QObject *parent = 0);
virtual ~KeyLoader();
void setUtil(Util* util) { iUtil = util; }
Q_INVOKABLE bool loadLayout(QString layout);
Q_INVOKABLE bool loadLayout(const QString &layout);
Q_INVOKABLE int vkbRows() { return iVkbRows; }
Q_INVOKABLE int vkbColumns() { return iVkbColumns; }
int vkbRows() const { return iVkbRows; }
int vkbColumns() const { return iVkbColumns; }
Q_INVOKABLE QVariantList keyAt(int row, int col);
Q_INVOKABLE const QStringList availableLayouts();
signals:
void vkbChanged();
public slots:
......
......@@ -38,7 +38,7 @@ Item {
property int outmargins: util.keyboardMargins
property int keyspacing: 6
property int keysPerRow: keyLoader.vkbColumns()
property int keysPerRow: keyLoader.vkbColumns
property real keywidth: (keyboard.width - keyspacing*keysPerRow - outmargins*2)/keysPerRow;
width: parent.width
......@@ -56,14 +56,14 @@ Item {
Repeater {
id: rowRepeater
model: keyLoader.vkbRows()
model: keyLoader.vkbRows
delegate: Row {
spacing: keyboard.keyspacing
Repeater {
id: colRepeater
property int rowIndex: index
model: keyLoader.vkbColumns()
model: keyLoader.vkbColumns
delegate: Key {
property var keydata: keyLoader.keyAt(colRepeater.rowIndex, index)
label: keydata[0]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment