11 static unsigned short keys[3][10]={
12 { 0x0686, 0x06cb, 0x06d0, 0x0631, 0x062a, 0x064a, 0x06c7, 0x06ad, 0x0648, 0x067e }, //ch, w, e, r, t, y, u, ng, o, p
13 { 0x06be, 0x0633, 0x062f, 0x0627, 0x06d5, 0x0649, 0x0642, 0x0643, 0x0644, 0x061B }, //h, s, d, a, e, i, q, k, l, ؛
14 { 0x0632, 0x0634, 0x063a, 0x06c8, 0x0628, 0x0646, 0x0645, 0x060C, 0x002E, 0x0626 } //z, sh, gh,ü, b, n, m, ،, ., hemze
17 static unsigned short skeys[3][10]={
18 { 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039 }, //0, 1, 2, 3, 4, 5, 6, 7, 8, 9
19 { 0x00BB, 0x00AB, 0x0698, 0x0641, 0x06af, 0x062e, 0x062c, 0x06c6, 0x002B, 0x003A }, //», «, dr, f, g, x, j, ö, +, :
20 { 0x0021, 0x066A, 0x066D, 0x002f, 0x002d, 0x2014, 0x003D, 0x203a, 0x2039, 0x061F } //!, %, *, /, -, —, =, ›, ‹, ؟
23 static int BUTTON_MAXIMUM_HEIGHT = 50;
25 VKB::VKB(QWidget *parent) :
29 mUGFont = new QFont("UyghurEdit Riwaj");
30 QVBoxLayout *layout = new QVBoxLayout;
31 mvkb = createVKB(keys);
32 layout->addWidget(mvkb);
33 msvkb = createVKB(skeys);
34 layout->addWidget(msvkb);
37 layout->addWidget(mtbar);
38 layout->setSpacing(0);
47 void VKB::keyClicked()
49 QPushButton *clickedButton = qobject_cast<QPushButton *>(sender());
50 emit VKBButtonClicked(clickedButton->text());
53 void VKB::shiftButtonClicked()
68 void VKB::spaceButtonClicked()
70 emit VKBButtonClicked(QString(" "));
73 void VKB::enterButtonClicked()
75 emit VKBButtonClicked(QString("\n"));
78 QWidget* VKB::createVKB(const unsigned short keys[3][10])
80 QWidget *vkb = new QWidget();
81 QGridLayout *layout = new QGridLayout;
82 for (int i=0; i<3; i++) {
83 for (int j=0; j<10; j++) {
84 QPushButton *key = new QPushButton(QString(keys[i][j]));
85 qDebug()<<key->fontInfo().family();
86 key->setFont(*mUGFont);
87 key->setMaximumHeight(BUTTON_MAXIMUM_HEIGHT);
88 qDebug()<<key->fontInfo().family();
89 connect(key, SIGNAL(clicked()), this, SLOT(keyClicked()));
90 layout->addWidget(key, i, j);
93 layout->setSpacing(0);
94 vkb->setLayout(layout);
99 * toolbar always visible and it contains following buttons
101 * Save: save Text to a file
102 * Copy: copy the content to clipboard
103 * Shift: controls to switch between two VKB
104 * forward: move the cursor to the forward
105 * Space: input blank space
106 * backward: move the cursor to the backward
107 * Enter: input line break
108 * Backspace: delete the character before the cursor
110 void VKB::createToolBar()
112 mtbar = new QWidget();
113 QHBoxLayout *layout = new QHBoxLayout;
114 mOpen = new QPushButton(QIcon(":/images/open.png"), QString());
115 connect(mOpen, SIGNAL(clicked()), this, SIGNAL(openButtonClicked()));
116 layout->addWidget(mOpen);
118 mSave = new QPushButton(QIcon(":/images/save.png"), QString());
119 connect(mSave, SIGNAL(clicked()), this, SIGNAL(saveButtonClicked()));
120 layout->addWidget(mSave);
122 mCopy = new QPushButton(QIcon(":/images/copy.png"), QString());
123 connect(mCopy, SIGNAL(clicked()), this, SIGNAL(copyButtonClicked()));
124 layout->addWidget(mCopy);
126 mPaste = new QPushButton(QIcon(":/images/paste.png"), QString());
127 connect(mPaste, SIGNAL(clicked()), this, SIGNAL(pasteButtonClicked()));
128 layout->addWidget(mPaste);
130 mShift = new QPushButton(QIcon(":/images/shift.png"), QString());
131 connect(mShift, SIGNAL(clicked()), this, SLOT(shiftButtonClicked()));
132 layout->addWidget(mShift);
134 mFW = new QPushButton(style()->standardIcon(QStyle::SP_ArrowLeft), QString());
135 connect(mFW, SIGNAL(clicked()), this, SIGNAL(fwButtonClicked()));
136 layout->addWidget(mFW);
138 mSpace = new QPushButton(QIcon(":/images/space.png"), QString());
139 connect(mSpace, SIGNAL(clicked()), this, SLOT(spaceButtonClicked()));
140 layout->addWidget(mSpace);
142 mBW = new QPushButton(style()->standardIcon(QStyle::SP_ArrowRight), QString());
143 connect(mBW, SIGNAL(clicked()), this, SIGNAL(bwButtonClicked()));
144 layout->addWidget(mBW);
146 mEnter = new QPushButton(QIcon(":/images/enter.png"), QString());
147 connect(mEnter, SIGNAL(clicked()), this, SLOT(enterButtonClicked()));
148 layout->addWidget(mEnter);
150 mBSpace = new QPushButton(QIcon(":/images/bkspc.png"), QString());
151 connect(mBSpace, SIGNAL(clicked()), this, SIGNAL(bspaceButtonClicked()));
152 layout->addWidget(mBSpace);
153 layout->setSpacing(0);
154 mtbar->setLayout(layout);