|
|
@ -7,6 +7,9 @@ |
|
|
|
|
|
|
|
|
|
|
|
#include "keyboard.hpp" |
|
|
|
#include "keyboard.hpp" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const int DEFAULT_WIDTH = 1; |
|
|
|
|
|
|
|
const int SPACEBAR_WIDTH = 3; |
|
|
|
|
|
|
|
|
|
|
|
KeyboardLayout::KeyboardLayout(QWidget *parent, std::vector<QVector<QString>> layout) : QWidget(parent) { |
|
|
|
KeyboardLayout::KeyboardLayout(QWidget *parent, std::vector<QVector<QString>> layout) : QWidget(parent) { |
|
|
|
QVBoxLayout* vlayout = new QVBoxLayout; |
|
|
|
QVBoxLayout* vlayout = new QVBoxLayout; |
|
|
|
QButtonGroup* btn_group = new QButtonGroup(this); |
|
|
|
QButtonGroup* btn_group = new QButtonGroup(this); |
|
|
@ -24,14 +27,14 @@ KeyboardLayout::KeyboardLayout(QWidget* parent, std::vector<QVector<QString>> la |
|
|
|
for (QString p : s) { |
|
|
|
for (QString p : s) { |
|
|
|
QPushButton* btn = new QPushButton(p); |
|
|
|
QPushButton* btn = new QPushButton(p); |
|
|
|
btn->setFixedHeight(120); |
|
|
|
btn->setFixedHeight(120); |
|
|
|
|
|
|
|
btn_group->addButton(btn); |
|
|
|
|
|
|
|
hlayout->addSpacing(10); |
|
|
|
if (p == QString(" ")) { |
|
|
|
if (p == QString(" ")) { |
|
|
|
btn->setFixedWidth(1024); |
|
|
|
hlayout->addWidget(btn, SPACEBAR_WIDTH); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
hlayout->addWidget(btn, DEFAULT_WIDTH); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
btn_group->addButton(btn); |
|
|
|
|
|
|
|
hlayout->addSpacing(10); |
|
|
|
|
|
|
|
hlayout->addWidget(btn); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (i == 1) { |
|
|
|
if (i == 1) { |
|
|
|