├── LICENSE.GPL.txt ├── ReadMe.md ├── plugin ├── .qmake.conf ├── main.cpp ├── plugin.pro ├── qvkimplatforminputcontext.cpp ├── qvkimplatforminputcontext.h └── vkim.json ├── server ├── keyboard.cpp ├── keyboard.h ├── main.cpp └── server.pro └── src.pro /LICENSE.GPL.txt: -------------------------------------------------------------------------------- 1 | The virtual keyboard demo software is Copyright (C) 2015 Klaralvdalens Datakonsult AB. 2 | 3 | You may use, distribute and copy the virtual keyboard software under the terms of 4 | the GNU General Public License version 2 or under the terms of GNU General 5 | Public License version 3 both of which are displayed below. 6 | 7 | ------------------------------------------------------------------------- 8 | 9 | GNU GENERAL PUBLIC LICENSE 10 | 11 | 12 | Version 2, June 1991 13 | 14 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 16 | Everyone is permitted to copy and distribute verbatim copies 17 | of this license document, but changing it is not allowed. 18 | 19 | Preamble 20 | 21 | The licenses for most software are designed to take away your 22 | freedom to share and change it. By contrast, the GNU General Public 23 | License is intended to guarantee your freedom to share and change free 24 | software--to make sure the software is free for all its users. This 25 | General Public License applies to most of the Free Software 26 | Foundation's software and to any other program whose authors commit to 27 | using it. (Some other Free Software Foundation software is covered by 28 | the GNU Lesser General Public License instead.) You can apply it to 29 | your programs, too. 30 | 31 | When we speak of free software, we are referring to freedom, not 32 | price. Our General Public Licenses are designed to make sure that you 33 | have the freedom to distribute copies of free software (and charge for 34 | this service if you wish), that you receive source code or can get it 35 | if you want it, that you can change the software or use pieces of it 36 | in new free programs; and that you know you can do these things. 37 | 38 | To protect your rights, we need to make restrictions that forbid 39 | anyone to deny you these rights or to ask you to surrender the rights. 40 | These restrictions translate to certain responsibilities for you if you 41 | distribute copies of the software, or if you modify it. 42 | 43 | For example, if you distribute copies of such a program, whether 44 | gratis or for a fee, you must give the recipients all the rights that 45 | you have. You must make sure that they, too, receive or can get the 46 | source code. And you must show them these terms so they know their 47 | rights. 48 | 49 | We protect your rights with two steps: (1) copyright the software, and 50 | (2) offer you this license which gives you legal permission to copy, 51 | distribute and/or modify the software. 52 | 53 | Also, for each author's protection and ours, we want to make certain 54 | that everyone understands that there is no warranty for this free 55 | software. If the software is modified by someone else and passed on, we 56 | want its recipients to know that what they have is not the original, so 57 | that any problems introduced by others will not reflect on the original 58 | authors' reputations. 59 | 60 | Finally, any free program is threatened constantly by software 61 | patents. We wish to avoid the danger that redistributors of a free 62 | program will individually obtain patent licenses, in effect making the 63 | program proprietary. To prevent this, we have made it clear that any 64 | patent must be licensed for everyone's free use or not licensed at all. 65 | 66 | The precise terms and conditions for copying, distribution and 67 | modification follow. 68 | 69 | GNU GENERAL PUBLIC LICENSE 70 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 71 | 72 | 0. This License applies to any program or other work which contains 73 | a notice placed by the copyright holder saying it may be distributed 74 | under the terms of this General Public License. The "Program", below, 75 | refers to any such program or work, and a "work based on the Program" 76 | means either the Program or any derivative work under copyright law: 77 | that is to say, a work containing the Program or a portion of it, 78 | either verbatim or with modifications and/or translated into another 79 | language. (Hereinafter, translation is included without limitation in 80 | the term "modification".) Each licensee is addressed as "you". 81 | 82 | Activities other than copying, distribution and modification are not 83 | covered by this License; they are outside its scope. The act of 84 | running the Program is not restricted, and the output from the Program 85 | is covered only if its contents constitute a work based on the 86 | Program (independent of having been made by running the Program). 87 | Whether that is true depends on what the Program does. 88 | 89 | 1. You may copy and distribute verbatim copies of the Program's 90 | source code as you receive it, in any medium, provided that you 91 | conspicuously and appropriately publish on each copy an appropriate 92 | copyright notice and disclaimer of warranty; keep intact all the 93 | notices that refer to this License and to the absence of any warranty; 94 | and give any other recipients of the Program a copy of this License 95 | along with the Program. 96 | 97 | You may charge a fee for the physical act of transferring a copy, and 98 | you may at your option offer warranty protection in exchange for a fee. 99 | 100 | 2. You may modify your copy or copies of the Program or any portion 101 | of it, thus forming a work based on the Program, and copy and 102 | distribute such modifications or work under the terms of Section 1 103 | above, provided that you also meet all of these conditions: 104 | 105 | a) You must cause the modified files to carry prominent notices 106 | stating that you changed the files and the date of any change. 107 | 108 | b) You must cause any work that you distribute or publish, that in 109 | whole or in part contains or is derived from the Program or any 110 | part thereof, to be licensed as a whole at no charge to all third 111 | parties under the terms of this License. 112 | 113 | c) If the modified program normally reads commands interactively 114 | when run, you must cause it, when started running for such 115 | interactive use in the most ordinary way, to print or display an 116 | announcement including an appropriate copyright notice and a 117 | notice that there is no warranty (or else, saying that you provide 118 | a warranty) and that users may redistribute the program under 119 | these conditions, and telling the user how to view a copy of this 120 | License. (Exception: if the Program itself is interactive but 121 | does not normally print such an announcement, your work based on 122 | the Program is not required to print an announcement.) 123 | 124 | These requirements apply to the modified work as a whole. If 125 | identifiable sections of that work are not derived from the Program, 126 | and can be reasonably considered independent and separate works in 127 | themselves, then this License, and its terms, do not apply to those 128 | sections when you distribute them as separate works. But when you 129 | distribute the same sections as part of a whole which is a work based 130 | on the Program, the distribution of the whole must be on the terms of 131 | this License, whose permissions for other licensees extend to the 132 | entire whole, and thus to each and every part regardless of who wrote it. 133 | 134 | Thus, it is not the intent of this section to claim rights or contest 135 | your rights to work written entirely by you; rather, the intent is to 136 | exercise the right to control the distribution of derivative or 137 | collective works based on the Program. 138 | 139 | In addition, mere aggregation of another work not based on the Program 140 | with the Program (or with a work based on the Program) on a volume of 141 | a storage or distribution medium does not bring the other work under 142 | the scope of this License. 143 | 144 | 3. You may copy and distribute the Program (or a work based on it, 145 | under Section 2) in object code or executable form under the terms of 146 | Sections 1 and 2 above provided that you also do one of the following: 147 | 148 | a) Accompany it with the complete corresponding machine-readable 149 | source code, which must be distributed under the terms of Sections 150 | 1 and 2 above on a medium customarily used for software interchange; or, 151 | 152 | b) Accompany it with a written offer, valid for at least three 153 | years, to give any third party, for a charge no more than your 154 | cost of physically performing source distribution, a complete 155 | machine-readable copy of the corresponding source code, to be 156 | distributed under the terms of Sections 1 and 2 above on a medium 157 | customarily used for software interchange; or, 158 | 159 | c) Accompany it with the information you received as to the offer 160 | to distribute corresponding source code. (This alternative is 161 | allowed only for noncommercial distribution and only if you 162 | received the program in object code or executable form with such 163 | an offer, in accord with Subsection b above.) 164 | 165 | The source code for a work means the preferred form of the work for 166 | making modifications to it. For an executable work, complete source 167 | code means all the source code for all modules it contains, plus any 168 | associated interface definition files, plus the scripts used to 169 | control compilation and installation of the executable. However, as a 170 | special exception, the source code distributed need not include 171 | anything that is normally distributed (in either source or binary 172 | form) with the major components (compiler, kernel, and so on) of the 173 | operating system on which the executable runs, unless that component 174 | itself accompanies the executable. 175 | 176 | If distribution of executable or object code is made by offering 177 | access to copy from a designated place, then offering equivalent 178 | access to copy the source code from the same place counts as 179 | distribution of the source code, even though third parties are not 180 | compelled to copy the source along with the object code. 181 | 182 | 4. You may not copy, modify, sublicense, or distribute the Program 183 | except as expressly provided under this License. Any attempt 184 | otherwise to copy, modify, sublicense or distribute the Program is 185 | void, and will automatically terminate your rights under this License. 186 | However, parties who have received copies, or rights, from you under 187 | this License will not have their licenses terminated so long as such 188 | parties remain in full compliance. 189 | 190 | 5. You are not required to accept this License, since you have not 191 | signed it. However, nothing else grants you permission to modify or 192 | distribute the Program or its derivative works. These actions are 193 | prohibited by law if you do not accept this License. Therefore, by 194 | modifying or distributing the Program (or any work based on the 195 | Program), you indicate your acceptance of this License to do so, and 196 | all its terms and conditions for copying, distributing or modifying 197 | the Program or works based on it. 198 | 199 | 6. Each time you redistribute the Program (or any work based on the 200 | Program), the recipient automatically receives a license from the 201 | original licensor to copy, distribute or modify the Program subject to 202 | these terms and conditions. You may not impose any further 203 | restrictions on the recipients' exercise of the rights granted herein. 204 | You are not responsible for enforcing compliance by third parties to 205 | this License. 206 | 207 | 7. If, as a consequence of a court judgment or allegation of patent 208 | infringement or for any other reason (not limited to patent issues), 209 | conditions are imposed on you (whether by court order, agreement or 210 | otherwise) that contradict the conditions of this License, they do not 211 | excuse you from the conditions of this License. If you cannot 212 | distribute so as to satisfy simultaneously your obligations under this 213 | License and any other pertinent obligations, then as a consequence you 214 | may not distribute the Program at all. For example, if a patent 215 | license would not permit royalty-free redistribution of the Program by 216 | all those who receive copies directly or indirectly through you, then 217 | the only way you could satisfy both it and this License would be to 218 | refrain entirely from distribution of the Program. 219 | 220 | If any portion of this section is held invalid or unenforceable under 221 | any particular circumstance, the balance of the section is intended to 222 | apply and the section as a whole is intended to apply in other 223 | circumstances. 224 | 225 | It is not the purpose of this section to induce you to infringe any 226 | patents or other property right claims or to contest validity of any 227 | such claims; this section has the sole purpose of protecting the 228 | integrity of the free software distribution system, which is 229 | implemented by public license practices. Many people have made 230 | generous contributions to the wide range of software distributed 231 | through that system in reliance on consistent application of that 232 | system; it is up to the author/donor to decide if he or she is willing 233 | to distribute software through any other system and a licensee cannot 234 | impose that choice. 235 | 236 | This section is intended to make thoroughly clear what is believed to 237 | be a consequence of the rest of this License. 238 | 239 | 8. If the distribution and/or use of the Program is restricted in 240 | certain countries either by patents or by copyrighted interfaces, the 241 | original copyright holder who places the Program under this License 242 | may add an explicit geographical distribution limitation excluding 243 | those countries, so that distribution is permitted only in or among 244 | countries not thus excluded. In such case, this License incorporates 245 | the limitation as if written in the body of this License. 246 | 247 | 9. The Free Software Foundation may publish revised and/or new versions 248 | of the General Public License from time to time. Such new versions will 249 | be similar in spirit to the present version, but may differ in detail to 250 | address new problems or concerns. 251 | 252 | Each version is given a distinguishing version number. If the Program 253 | specifies a version number of this License which applies to it and "any 254 | later version", you have the option of following the terms and conditions 255 | either of that version or of any later version published by the Free 256 | Software Foundation. If the Program does not specify a version number of 257 | this License, you may choose any version ever published by the Free Software 258 | Foundation. 259 | 260 | 10. If you wish to incorporate parts of the Program into other free 261 | programs whose distribution conditions are different, write to the author 262 | to ask for permission. For software which is copyrighted by the Free 263 | Software Foundation, write to the Free Software Foundation; we sometimes 264 | make exceptions for this. Our decision will be guided by the two goals 265 | of preserving the free status of all derivatives of our free software and 266 | of promoting the sharing and reuse of software generally. 267 | 268 | NO WARRANTY 269 | 270 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 271 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 272 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 273 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 274 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 275 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 276 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 277 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 278 | REPAIR OR CORRECTION. 279 | 280 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 281 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 282 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 283 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 284 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 285 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 286 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 287 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 288 | POSSIBILITY OF SUCH DAMAGES. 289 | 290 | END OF TERMS AND CONDITIONS 291 | 292 | How to Apply These Terms to Your New Programs 293 | 294 | If you develop a new program, and you want it to be of the greatest 295 | possible use to the public, the best way to achieve this is to make it 296 | free software which everyone can redistribute and change under these terms. 297 | 298 | To do so, attach the following notices to the program. It is safest 299 | to attach them to the start of each source file to most effectively 300 | convey the exclusion of warranty; and each file should have at least 301 | the "copyright" line and a pointer to where the full notice is found. 302 | 303 | 304 | Copyright (C) 305 | 306 | This program is free software; you can redistribute it and/or modify 307 | it under the terms of the GNU General Public License as published by 308 | the Free Software Foundation; either version 2 of the License, or 309 | (at your option) any later version. 310 | 311 | This program is distributed in the hope that it will be useful, 312 | but WITHOUT ANY WARRANTY; without even the implied warranty of 313 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 314 | GNU General Public License for more details. 315 | 316 | You should have received a copy of the GNU General Public License along 317 | with this program; if not, write to the Free Software Foundation, Inc., 318 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 319 | 320 | Also add information on how to contact you by electronic and paper mail. 321 | 322 | If the program is interactive, make it output a short notice like this 323 | when it starts in an interactive mode: 324 | 325 | Gnomovision version 69, Copyright (C) year name of author 326 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 327 | This is free software, and you are welcome to redistribute it 328 | under certain conditions; type `show c' for details. 329 | 330 | The hypothetical commands `show w' and `show c' should show the appropriate 331 | parts of the General Public License. Of course, the commands you use may 332 | be called something other than `show w' and `show c'; they could even be 333 | mouse-clicks or menu items--whatever suits your program. 334 | 335 | You should also get your employer (if you work as a programmer) or your 336 | school, if any, to sign a "copyright disclaimer" for the program, if 337 | necessary. Here is a sample; alter the names: 338 | 339 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 340 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 341 | 342 | , 1 April 1989 343 | Ty Coon, President of Vice 344 | 345 | This General Public License does not permit incorporating your program into 346 | proprietary programs. If your program is a subroutine library, you may 347 | consider it more useful to permit linking proprietary applications with the 348 | library. If this is what you want to do, use the GNU Lesser General 349 | Public License instead of this License. 350 | 351 | 352 | ------------------------------------------------------------------------- 353 | 354 | GNU GENERAL PUBLIC LICENSE 355 | Version 3, 29 June 2007 356 | 357 | Copyright (C) 2007 Free Software Foundation, Inc. 358 | Everyone is permitted to copy and distribute verbatim copies 359 | of this license document, but changing it is not allowed. 360 | 361 | Preamble 362 | 363 | The GNU General Public License is a free, copyleft license for 364 | software and other kinds of works. 365 | 366 | The licenses for most software and other practical works are designed 367 | to take away your freedom to share and change the works. By contrast, 368 | the GNU General Public License is intended to guarantee your freedom to 369 | share and change all versions of a program--to make sure it remains free 370 | software for all its users. We, the Free Software Foundation, use the 371 | GNU General Public License for most of our software; it applies also to 372 | any other work released this way by its authors. You can apply it to 373 | your programs, too. 374 | 375 | When we speak of free software, we are referring to freedom, not 376 | price. Our General Public Licenses are designed to make sure that you 377 | have the freedom to distribute copies of free software (and charge for 378 | them if you wish), that you receive source code or can get it if you 379 | want it, that you can change the software or use pieces of it in new 380 | free programs, and that you know you can do these things. 381 | 382 | To protect your rights, we need to prevent others from denying you 383 | these rights or asking you to surrender the rights. Therefore, you have 384 | certain responsibilities if you distribute copies of the software, or if 385 | you modify it: responsibilities to respect the freedom of others. 386 | 387 | For example, if you distribute copies of such a program, whether 388 | gratis or for a fee, you must pass on to the recipients the same 389 | freedoms that you received. You must make sure that they, too, receive 390 | or can get the source code. And you must show them these terms so they 391 | know their rights. 392 | 393 | Developers that use the GNU GPL protect your rights with two steps: 394 | (1) assert copyright on the software, and (2) offer you this License 395 | giving you legal permission to copy, distribute and/or modify it. 396 | 397 | For the developers' and authors' protection, the GPL clearly explains 398 | that there is no warranty for this free software. For both users' and 399 | authors' sake, the GPL requires that modified versions be marked as 400 | changed, so that their problems will not be attributed erroneously to 401 | authors of previous versions. 402 | 403 | Some devices are designed to deny users access to install or run 404 | modified versions of the software inside them, although the manufacturer 405 | can do so. This is fundamentally incompatible with the aim of 406 | protecting users' freedom to change the software. The systematic 407 | pattern of such abuse occurs in the area of products for individuals to 408 | use, which is precisely where it is most unacceptable. Therefore, we 409 | have designed this version of the GPL to prohibit the practice for those 410 | products. If such problems arise substantially in other domains, we 411 | stand ready to extend this provision to those domains in future versions 412 | of the GPL, as needed to protect the freedom of users. 413 | 414 | Finally, every program is threatened constantly by software patents. 415 | States should not allow patents to restrict development and use of 416 | software on general-purpose computers, but in those that do, we wish to 417 | avoid the special danger that patents applied to a free program could 418 | make it effectively proprietary. To prevent this, the GPL assures that 419 | patents cannot be used to render the program non-free. 420 | 421 | The precise terms and conditions for copying, distribution and 422 | modification follow. 423 | 424 | TERMS AND CONDITIONS 425 | 426 | 0. Definitions. 427 | 428 | "This License" refers to version 3 of the GNU General Public License. 429 | 430 | "Copyright" also means copyright-like laws that apply to other kinds of 431 | works, such as semiconductor masks. 432 | 433 | "The Program" refers to any copyrightable work licensed under this 434 | License. Each licensee is addressed as "you". "Licensees" and 435 | "recipients" may be individuals or organizations. 436 | 437 | To "modify" a work means to copy from or adapt all or part of the work 438 | in a fashion requiring copyright permission, other than the making of an 439 | exact copy. The resulting work is called a "modified version" of the 440 | earlier work or a work "based on" the earlier work. 441 | 442 | A "covered work" means either the unmodified Program or a work based 443 | on the Program. 444 | 445 | To "propagate" a work means to do anything with it that, without 446 | permission, would make you directly or secondarily liable for 447 | infringement under applicable copyright law, except executing it on a 448 | computer or modifying a private copy. Propagation includes copying, 449 | distribution (with or without modification), making available to the 450 | public, and in some countries other activities as well. 451 | 452 | To "convey" a work means any kind of propagation that enables other 453 | parties to make or receive copies. Mere interaction with a user through 454 | a computer network, with no transfer of a copy, is not conveying. 455 | 456 | An interactive user interface displays "Appropriate Legal Notices" 457 | to the extent that it includes a convenient and prominently visible 458 | feature that (1) displays an appropriate copyright notice, and (2) 459 | tells the user that there is no warranty for the work (except to the 460 | extent that warranties are provided), that licensees may convey the 461 | work under this License, and how to view a copy of this License. If 462 | the interface presents a list of user commands or options, such as a 463 | menu, a prominent item in the list meets this criterion. 464 | 465 | 1. Source Code. 466 | 467 | The "source code" for a work means the preferred form of the work 468 | for making modifications to it. "Object code" means any non-source 469 | form of a work. 470 | 471 | A "Standard Interface" means an interface that either is an official 472 | standard defined by a recognized standards body, or, in the case of 473 | interfaces specified for a particular programming language, one that 474 | is widely used among developers working in that language. 475 | 476 | The "System Libraries" of an executable work include anything, other 477 | than the work as a whole, that (a) is included in the normal form of 478 | packaging a Major Component, but which is not part of that Major 479 | Component, and (b) serves only to enable use of the work with that 480 | Major Component, or to implement a Standard Interface for which an 481 | implementation is available to the public in source code form. A 482 | "Major Component", in this context, means a major essential component 483 | (kernel, window system, and so on) of the specific operating system 484 | (if any) on which the executable work runs, or a compiler used to 485 | produce the work, or an object code interpreter used to run it. 486 | 487 | The "Corresponding Source" for a work in object code form means all 488 | the source code needed to generate, install, and (for an executable 489 | work) run the object code and to modify the work, including scripts to 490 | control those activities. However, it does not include the work's 491 | System Libraries, or general-purpose tools or generally available free 492 | programs which are used unmodified in performing those activities but 493 | which are not part of the work. For example, Corresponding Source 494 | includes interface definition files associated with source files for 495 | the work, and the source code for shared libraries and dynamically 496 | linked subprograms that the work is specifically designed to require, 497 | such as by intimate data communication or control flow between those 498 | subprograms and other parts of the work. 499 | 500 | The Corresponding Source need not include anything that users 501 | can regenerate automatically from other parts of the Corresponding 502 | Source. 503 | 504 | The Corresponding Source for a work in source code form is that 505 | same work. 506 | 507 | 2. Basic Permissions. 508 | 509 | All rights granted under this License are granted for the term of 510 | copyright on the Program, and are irrevocable provided the stated 511 | conditions are met. This License explicitly affirms your unlimited 512 | permission to run the unmodified Program. The output from running a 513 | covered work is covered by this License only if the output, given its 514 | content, constitutes a covered work. This License acknowledges your 515 | rights of fair use or other equivalent, as provided by copyright law. 516 | 517 | You may make, run and propagate covered works that you do not 518 | convey, without conditions so long as your license otherwise remains 519 | in force. You may convey covered works to others for the sole purpose 520 | of having them make modifications exclusively for you, or provide you 521 | with facilities for running those works, provided that you comply with 522 | the terms of this License in conveying all material for which you do 523 | not control copyright. Those thus making or running the covered works 524 | for you must do so exclusively on your behalf, under your direction 525 | and control, on terms that prohibit them from making any copies of 526 | your copyrighted material outside their relationship with you. 527 | 528 | Conveying under any other circumstances is permitted solely under 529 | the conditions stated below. Sublicensing is not allowed; section 10 530 | makes it unnecessary. 531 | 532 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 533 | 534 | No covered work shall be deemed part of an effective technological 535 | measure under any applicable law fulfilling obligations under article 536 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 537 | similar laws prohibiting or restricting circumvention of such 538 | measures. 539 | 540 | When you convey a covered work, you waive any legal power to forbid 541 | circumvention of technological measures to the extent such circumvention 542 | is effected by exercising rights under this License with respect to 543 | the covered work, and you disclaim any intention to limit operation or 544 | modification of the work as a means of enforcing, against the work's 545 | users, your or third parties' legal rights to forbid circumvention of 546 | technological measures. 547 | 548 | 4. Conveying Verbatim Copies. 549 | 550 | You may convey verbatim copies of the Program's source code as you 551 | receive it, in any medium, provided that you conspicuously and 552 | appropriately publish on each copy an appropriate copyright notice; 553 | keep intact all notices stating that this License and any 554 | non-permissive terms added in accord with section 7 apply to the code; 555 | keep intact all notices of the absence of any warranty; and give all 556 | recipients a copy of this License along with the Program. 557 | 558 | You may charge any price or no price for each copy that you convey, 559 | and you may offer support or warranty protection for a fee. 560 | 561 | 5. Conveying Modified Source Versions. 562 | 563 | You may convey a work based on the Program, or the modifications to 564 | produce it from the Program, in the form of source code under the 565 | terms of section 4, provided that you also meet all of these conditions: 566 | 567 | a) The work must carry prominent notices stating that you modified 568 | it, and giving a relevant date. 569 | 570 | b) The work must carry prominent notices stating that it is 571 | released under this License and any conditions added under section 572 | 7. This requirement modifies the requirement in section 4 to 573 | "keep intact all notices". 574 | 575 | c) You must license the entire work, as a whole, under this 576 | License to anyone who comes into possession of a copy. This 577 | License will therefore apply, along with any applicable section 7 578 | additional terms, to the whole of the work, and all its parts, 579 | regardless of how they are packaged. This License gives no 580 | permission to license the work in any other way, but it does not 581 | invalidate such permission if you have separately received it. 582 | 583 | d) If the work has interactive user interfaces, each must display 584 | Appropriate Legal Notices; however, if the Program has interactive 585 | interfaces that do not display Appropriate Legal Notices, your 586 | work need not make them do so. 587 | 588 | A compilation of a covered work with other separate and independent 589 | works, which are not by their nature extensions of the covered work, 590 | and which are not combined with it such as to form a larger program, 591 | in or on a volume of a storage or distribution medium, is called an 592 | "aggregate" if the compilation and its resulting copyright are not 593 | used to limit the access or legal rights of the compilation's users 594 | beyond what the individual works permit. Inclusion of a covered work 595 | in an aggregate does not cause this License to apply to the other 596 | parts of the aggregate. 597 | 598 | 6. Conveying Non-Source Forms. 599 | 600 | You may convey a covered work in object code form under the terms 601 | of sections 4 and 5, provided that you also convey the 602 | machine-readable Corresponding Source under the terms of this License, 603 | in one of these ways: 604 | 605 | a) Convey the object code in, or embodied in, a physical product 606 | (including a physical distribution medium), accompanied by the 607 | Corresponding Source fixed on a durable physical medium 608 | customarily used for software interchange. 609 | 610 | b) Convey the object code in, or embodied in, a physical product 611 | (including a physical distribution medium), accompanied by a 612 | written offer, valid for at least three years and valid for as 613 | long as you offer spare parts or customer support for that product 614 | model, to give anyone who possesses the object code either (1) a 615 | copy of the Corresponding Source for all the software in the 616 | product that is covered by this License, on a durable physical 617 | medium customarily used for software interchange, for a price no 618 | more than your reasonable cost of physically performing this 619 | conveying of source, or (2) access to copy the 620 | Corresponding Source from a network server at no charge. 621 | 622 | c) Convey individual copies of the object code with a copy of the 623 | written offer to provide the Corresponding Source. This 624 | alternative is allowed only occasionally and noncommercially, and 625 | only if you received the object code with such an offer, in accord 626 | with subsection 6b. 627 | 628 | d) Convey the object code by offering access from a designated 629 | place (gratis or for a charge), and offer equivalent access to the 630 | Corresponding Source in the same way through the same place at no 631 | further charge. You need not require recipients to copy the 632 | Corresponding Source along with the object code. If the place to 633 | copy the object code is a network server, the Corresponding Source 634 | may be on a different server (operated by you or a third party) 635 | that supports equivalent copying facilities, provided you maintain 636 | clear directions next to the object code saying where to find the 637 | Corresponding Source. Regardless of what server hosts the 638 | Corresponding Source, you remain obligated to ensure that it is 639 | available for as long as needed to satisfy these requirements. 640 | 641 | e) Convey the object code using peer-to-peer transmission, provided 642 | you inform other peers where the object code and Corresponding 643 | Source of the work are being offered to the general public at no 644 | charge under subsection 6d. 645 | 646 | A separable portion of the object code, whose source code is excluded 647 | from the Corresponding Source as a System Library, need not be 648 | included in conveying the object code work. 649 | 650 | A "User Product" is either (1) a "consumer product", which means any 651 | tangible personal property which is normally used for personal, family, 652 | or household purposes, or (2) anything designed or sold for incorporation 653 | into a dwelling. In determining whether a product is a consumer product, 654 | doubtful cases shall be resolved in favor of coverage. For a particular 655 | product received by a particular user, "normally used" refers to a 656 | typical or common use of that class of product, regardless of the status 657 | of the particular user or of the way in which the particular user 658 | actually uses, or expects or is expected to use, the product. A product 659 | is a consumer product regardless of whether the product has substantial 660 | commercial, industrial or non-consumer uses, unless such uses represent 661 | the only significant mode of use of the product. 662 | 663 | "Installation Information" for a User Product means any methods, 664 | procedures, authorization keys, or other information required to install 665 | and execute modified versions of a covered work in that User Product from 666 | a modified version of its Corresponding Source. The information must 667 | suffice to ensure that the continued functioning of the modified object 668 | code is in no case prevented or interfered with solely because 669 | modification has been made. 670 | 671 | If you convey an object code work under this section in, or with, or 672 | specifically for use in, a User Product, and the conveying occurs as 673 | part of a transaction in which the right of possession and use of the 674 | User Product is transferred to the recipient in perpetuity or for a 675 | fixed term (regardless of how the transaction is characterized), the 676 | Corresponding Source conveyed under this section must be accompanied 677 | by the Installation Information. But this requirement does not apply 678 | if neither you nor any third party retains the ability to install 679 | modified object code on the User Product (for example, the work has 680 | been installed in ROM). 681 | 682 | The requirement to provide Installation Information does not include a 683 | requirement to continue to provide support service, warranty, or updates 684 | for a work that has been modified or installed by the recipient, or for 685 | the User Product in which it has been modified or installed. Access to a 686 | network may be denied when the modification itself materially and 687 | adversely affects the operation of the network or violates the rules and 688 | protocols for communication across the network. 689 | 690 | Corresponding Source conveyed, and Installation Information provided, 691 | in accord with this section must be in a format that is publicly 692 | documented (and with an implementation available to the public in 693 | source code form), and must require no special password or key for 694 | unpacking, reading or copying. 695 | 696 | 7. Additional Terms. 697 | 698 | "Additional permissions" are terms that supplement the terms of this 699 | License by making exceptions from one or more of its conditions. 700 | Additional permissions that are applicable to the entire Program shall 701 | be treated as though they were included in this License, to the extent 702 | that they are valid under applicable law. If additional permissions 703 | apply only to part of the Program, that part may be used separately 704 | under those permissions, but the entire Program remains governed by 705 | this License without regard to the additional permissions. 706 | 707 | When you convey a copy of a covered work, you may at your option 708 | remove any additional permissions from that copy, or from any part of 709 | it. (Additional permissions may be written to require their own 710 | removal in certain cases when you modify the work.) You may place 711 | additional permissions on material, added by you to a covered work, 712 | for which you have or can give appropriate copyright permission. 713 | 714 | Notwithstanding any other provision of this License, for material you 715 | add to a covered work, you may (if authorized by the copyright holders of 716 | that material) supplement the terms of this License with terms: 717 | 718 | a) Disclaiming warranty or limiting liability differently from the 719 | terms of sections 15 and 16 of this License; or 720 | 721 | b) Requiring preservation of specified reasonable legal notices or 722 | author attributions in that material or in the Appropriate Legal 723 | Notices displayed by works containing it; or 724 | 725 | c) Prohibiting misrepresentation of the origin of that material, or 726 | requiring that modified versions of such material be marked in 727 | reasonable ways as different from the original version; or 728 | 729 | d) Limiting the use for publicity purposes of names of licensors or 730 | authors of the material; or 731 | 732 | e) Declining to grant rights under trademark law for use of some 733 | trade names, trademarks, or service marks; or 734 | 735 | f) Requiring indemnification of licensors and authors of that 736 | material by anyone who conveys the material (or modified versions of 737 | it) with contractual assumptions of liability to the recipient, for 738 | any liability that these contractual assumptions directly impose on 739 | those licensors and authors. 740 | 741 | All other non-permissive additional terms are considered "further 742 | restrictions" within the meaning of section 10. If the Program as you 743 | received it, or any part of it, contains a notice stating that it is 744 | governed by this License along with a term that is a further 745 | restriction, you may remove that term. If a license document contains 746 | a further restriction but permits relicensing or conveying under this 747 | License, you may add to a covered work material governed by the terms 748 | of that license document, provided that the further restriction does 749 | not survive such relicensing or conveying. 750 | 751 | If you add terms to a covered work in accord with this section, you 752 | must place, in the relevant source files, a statement of the 753 | additional terms that apply to those files, or a notice indicating 754 | where to find the applicable terms. 755 | 756 | Additional terms, permissive or non-permissive, may be stated in the 757 | form of a separately written license, or stated as exceptions; 758 | the above requirements apply either way. 759 | 760 | 8. Termination. 761 | 762 | You may not propagate or modify a covered work except as expressly 763 | provided under this License. Any attempt otherwise to propagate or 764 | modify it is void, and will automatically terminate your rights under 765 | this License (including any patent licenses granted under the third 766 | paragraph of section 11). 767 | 768 | However, if you cease all violation of this License, then your 769 | license from a particular copyright holder is reinstated (a) 770 | provisionally, unless and until the copyright holder explicitly and 771 | finally terminates your license, and (b) permanently, if the copyright 772 | holder fails to notify you of the violation by some reasonable means 773 | prior to 60 days after the cessation. 774 | 775 | Moreover, your license from a particular copyright holder is 776 | reinstated permanently if the copyright holder notifies you of the 777 | violation by some reasonable means, this is the first time you have 778 | received notice of violation of this License (for any work) from that 779 | copyright holder, and you cure the violation prior to 30 days after 780 | your receipt of the notice. 781 | 782 | Termination of your rights under this section does not terminate the 783 | licenses of parties who have received copies or rights from you under 784 | this License. If your rights have been terminated and not permanently 785 | reinstated, you do not qualify to receive new licenses for the same 786 | material under section 10. 787 | 788 | 9. Acceptance Not Required for Having Copies. 789 | 790 | You are not required to accept this License in order to receive or 791 | run a copy of the Program. Ancillary propagation of a covered work 792 | occurring solely as a consequence of using peer-to-peer transmission 793 | to receive a copy likewise does not require acceptance. However, 794 | nothing other than this License grants you permission to propagate or 795 | modify any covered work. These actions infringe copyright if you do 796 | not accept this License. Therefore, by modifying or propagating a 797 | covered work, you indicate your acceptance of this License to do so. 798 | 799 | 10. Automatic Licensing of Downstream Recipients. 800 | 801 | Each time you convey a covered work, the recipient automatically 802 | receives a license from the original licensors, to run, modify and 803 | propagate that work, subject to this License. You are not responsible 804 | for enforcing compliance by third parties with this License. 805 | 806 | An "entity transaction" is a transaction transferring control of an 807 | organization, or substantially all assets of one, or subdividing an 808 | organization, or merging organizations. If propagation of a covered 809 | work results from an entity transaction, each party to that 810 | transaction who receives a copy of the work also receives whatever 811 | licenses to the work the party's predecessor in interest had or could 812 | give under the previous paragraph, plus a right to possession of the 813 | Corresponding Source of the work from the predecessor in interest, if 814 | the predecessor has it or can get it with reasonable efforts. 815 | 816 | You may not impose any further restrictions on the exercise of the 817 | rights granted or affirmed under this License. For example, you may 818 | not impose a license fee, royalty, or other charge for exercise of 819 | rights granted under this License, and you may not initiate litigation 820 | (including a cross-claim or counterclaim in a lawsuit) alleging that 821 | any patent claim is infringed by making, using, selling, offering for 822 | sale, or importing the Program or any portion of it. 823 | 824 | 11. Patents. 825 | 826 | A "contributor" is a copyright holder who authorizes use under this 827 | License of the Program or a work on which the Program is based. The 828 | work thus licensed is called the contributor's "contributor version". 829 | 830 | A contributor's "essential patent claims" are all patent claims 831 | owned or controlled by the contributor, whether already acquired or 832 | hereafter acquired, that would be infringed by some manner, permitted 833 | by this License, of making, using, or selling its contributor version, 834 | but do not include claims that would be infringed only as a 835 | consequence of further modification of the contributor version. For 836 | purposes of this definition, "control" includes the right to grant 837 | patent sublicenses in a manner consistent with the requirements of 838 | this License. 839 | 840 | Each contributor grants you a non-exclusive, worldwide, royalty-free 841 | patent license under the contributor's essential patent claims, to 842 | make, use, sell, offer for sale, import and otherwise run, modify and 843 | propagate the contents of its contributor version. 844 | 845 | In the following three paragraphs, a "patent license" is any express 846 | agreement or commitment, however denominated, not to enforce a patent 847 | (such as an express permission to practice a patent or covenant not to 848 | sue for patent infringement). To "grant" such a patent license to a 849 | party means to make such an agreement or commitment not to enforce a 850 | patent against the party. 851 | 852 | If you convey a covered work, knowingly relying on a patent license, 853 | and the Corresponding Source of the work is not available for anyone 854 | to copy, free of charge and under the terms of this License, through a 855 | publicly available network server or other readily accessible means, 856 | then you must either (1) cause the Corresponding Source to be so 857 | available, or (2) arrange to deprive yourself of the benefit of the 858 | patent license for this particular work, or (3) arrange, in a manner 859 | consistent with the requirements of this License, to extend the patent 860 | license to downstream recipients. "Knowingly relying" means you have 861 | actual knowledge that, but for the patent license, your conveying the 862 | covered work in a country, or your recipient's use of the covered work 863 | in a country, would infringe one or more identifiable patents in that 864 | country that you have reason to believe are valid. 865 | 866 | If, pursuant to or in connection with a single transaction or 867 | arrangement, you convey, or propagate by procuring conveyance of, a 868 | covered work, and grant a patent license to some of the parties 869 | receiving the covered work authorizing them to use, propagate, modify 870 | or convey a specific copy of the covered work, then the patent license 871 | you grant is automatically extended to all recipients of the covered 872 | work and works based on it. 873 | 874 | A patent license is "discriminatory" if it does not include within 875 | the scope of its coverage, prohibits the exercise of, or is 876 | conditioned on the non-exercise of one or more of the rights that are 877 | specifically granted under this License. You may not convey a covered 878 | work if you are a party to an arrangement with a third party that is 879 | in the business of distributing software, under which you make payment 880 | to the third party based on the extent of your activity of conveying 881 | the work, and under which the third party grants, to any of the 882 | parties who would receive the covered work from you, a discriminatory 883 | patent license (a) in connection with copies of the covered work 884 | conveyed by you (or copies made from those copies), or (b) primarily 885 | for and in connection with specific products or compilations that 886 | contain the covered work, unless you entered into that arrangement, 887 | or that patent license was granted, prior to 28 March 2007. 888 | 889 | Nothing in this License shall be construed as excluding or limiting 890 | any implied license or other defenses to infringement that may 891 | otherwise be available to you under applicable patent law. 892 | 893 | 12. No Surrender of Others' Freedom. 894 | 895 | If conditions are imposed on you (whether by court order, agreement or 896 | otherwise) that contradict the conditions of this License, they do not 897 | excuse you from the conditions of this License. If you cannot convey a 898 | covered work so as to satisfy simultaneously your obligations under this 899 | License and any other pertinent obligations, then as a consequence you may 900 | not convey it at all. For example, if you agree to terms that obligate you 901 | to collect a royalty for further conveying from those to whom you convey 902 | the Program, the only way you could satisfy both those terms and this 903 | License would be to refrain entirely from conveying the Program. 904 | 905 | 13. Use with the GNU Affero General Public License. 906 | 907 | Notwithstanding any other provision of this License, you have 908 | permission to link or combine any covered work with a work licensed 909 | under version 3 of the GNU Affero General Public License into a single 910 | combined work, and to convey the resulting work. The terms of this 911 | License will continue to apply to the part which is the covered work, 912 | but the special requirements of the GNU Affero General Public License, 913 | section 13, concerning interaction through a network will apply to the 914 | combination as such. 915 | 916 | 14. Revised Versions of this License. 917 | 918 | The Free Software Foundation may publish revised and/or new versions of 919 | the GNU General Public License from time to time. Such new versions will 920 | be similar in spirit to the present version, but may differ in detail to 921 | address new problems or concerns. 922 | 923 | Each version is given a distinguishing version number. If the 924 | Program specifies that a certain numbered version of the GNU General 925 | Public License "or any later version" applies to it, you have the 926 | option of following the terms and conditions either of that numbered 927 | version or of any later version published by the Free Software 928 | Foundation. If the Program does not specify a version number of the 929 | GNU General Public License, you may choose any version ever published 930 | by the Free Software Foundation. 931 | 932 | If the Program specifies that a proxy can decide which future 933 | versions of the GNU General Public License can be used, that proxy's 934 | public statement of acceptance of a version permanently authorizes you 935 | to choose that version for the Program. 936 | 937 | Later license versions may give you additional or different 938 | permissions. However, no additional obligations are imposed on any 939 | author or copyright holder as a result of your choosing to follow a 940 | later version. 941 | 942 | 15. Disclaimer of Warranty. 943 | 944 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 945 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 946 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 947 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 948 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 949 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 950 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 951 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 952 | 953 | 16. Limitation of Liability. 954 | 955 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 956 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 957 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 958 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 959 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 960 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 961 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 962 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 963 | SUCH DAMAGES. 964 | 965 | 17. Interpretation of Sections 15 and 16. 966 | 967 | If the disclaimer of warranty and limitation of liability provided 968 | above cannot be given local legal effect according to their terms, 969 | reviewing courts shall apply local law that most closely approximates 970 | an absolute waiver of all civil liability in connection with the 971 | Program, unless a warranty or assumption of liability accompanies a 972 | copy of the Program in return for a fee. 973 | 974 | END OF TERMS AND CONDITIONS 975 | 976 | How to Apply These Terms to Your New Programs 977 | 978 | If you develop a new program, and you want it to be of the greatest 979 | possible use to the public, the best way to achieve this is to make it 980 | free software which everyone can redistribute and change under these terms. 981 | 982 | To do so, attach the following notices to the program. It is safest 983 | to attach them to the start of each source file to most effectively 984 | state the exclusion of warranty; and each file should have at least 985 | the "copyright" line and a pointer to where the full notice is found. 986 | 987 | 988 | Copyright (C) 989 | 990 | This program is free software: you can redistribute it and/or modify 991 | it under the terms of the GNU General Public License as published by 992 | the Free Software Foundation, either version 3 of the License, or 993 | (at your option) any later version. 994 | 995 | This program is distributed in the hope that it will be useful, 996 | but WITHOUT ANY WARRANTY; without even the implied warranty of 997 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 998 | GNU General Public License for more details. 999 | 1000 | You should have received a copy of the GNU General Public License 1001 | along with this program. If not, see . 1002 | 1003 | Also add information on how to contact you by electronic and paper mail. 1004 | 1005 | If the program does terminal interaction, make it output a short 1006 | notice like this when it starts in an interactive mode: 1007 | 1008 | Copyright (C) 1009 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 1010 | This is free software, and you are welcome to redistribute it 1011 | under certain conditions; type `show c' for details. 1012 | 1013 | The hypothetical commands `show w' and `show c' should show the appropriate 1014 | parts of the General Public License. Of course, your program's commands 1015 | might be different; for a GUI interface, you would use an "about box". 1016 | 1017 | You should also get your employer (if you work as a programmer) or school, 1018 | if any, to sign a "copyright disclaimer" for the program, if necessary. 1019 | For more information on this, and how to apply and follow the GNU GPL, see 1020 | . 1021 | 1022 | The GNU General Public License does not permit incorporating your program 1023 | into proprietary programs. If your program is a subroutine library, you 1024 | may consider it more useful to permit linking proprietary applications with 1025 | the library. If this is what you want to do, use the GNU Lesser General 1026 | Public License instead of this License. But first, please read 1027 | . 1028 | 1029 | ------------------------------------------------------------------------- 1030 | -------------------------------------------------------------------------------- /ReadMe.md: -------------------------------------------------------------------------------- 1 | Introduction 2 | ============ 3 | This repository contains the demo code for the blog post about virtual keyboards 4 | implemented with the Qt input method framework. 5 | -------------------------------------------------------------------------------- /plugin/.qmake.conf: -------------------------------------------------------------------------------- 1 | load(qt_build_config) 2 | -------------------------------------------------------------------------------- /plugin/main.cpp: -------------------------------------------------------------------------------- 1 | #include "qvkimplatforminputcontext.h" 2 | 3 | #include 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | class QVkImPlatformInputContextPlugin : public QPlatformInputContextPlugin 9 | { 10 | Q_OBJECT 11 | Q_PLUGIN_METADATA(IID QPlatformInputContextFactoryInterface_iid FILE "vkim.json") 12 | 13 | public: 14 | QVkImPlatformInputContext *create(const QString&, const QStringList&) Q_DECL_OVERRIDE; 15 | }; 16 | 17 | QVkImPlatformInputContext *QVkImPlatformInputContextPlugin::create(const QString& system, const QStringList& paramList) 18 | { 19 | Q_UNUSED(paramList); 20 | 21 | if (system == QLatin1String("vkim")) { 22 | return new QVkImPlatformInputContext; 23 | } 24 | 25 | return 0; 26 | } 27 | 28 | QT_END_NAMESPACE 29 | 30 | #include "main.moc" 31 | -------------------------------------------------------------------------------- /plugin/plugin.pro: -------------------------------------------------------------------------------- 1 | TARGET = vkimplatforminputcontextplugin 2 | 3 | QT += dbus gui-private widgets 4 | SOURCES += $$PWD/qvkimplatforminputcontext.cpp \ 5 | $$PWD/main.cpp 6 | 7 | HEADERS += $$PWD/qvkimplatforminputcontext.h 8 | 9 | OTHER_FILES += $$PWD/vkim.json 10 | 11 | PLUGIN_TYPE = platforminputcontexts 12 | PLUGIN_EXTENDS = - 13 | PLUGIN_CLASS_NAME = QVkImPlatformInputContextPlugin 14 | load(qt_plugin) 15 | -------------------------------------------------------------------------------- /plugin/qvkimplatforminputcontext.cpp: -------------------------------------------------------------------------------- 1 | #include "qvkimplatforminputcontext.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | QVkImPlatformInputContext::QVkImPlatformInputContext() 11 | : m_focusObject(0) 12 | { 13 | m_keyboardInterface = new QDBusInterface("com.kdab.inputmethod", "/VirtualKeyboard", "local.server.Keyboard", QDBusConnection::sessionBus(), this); 14 | 15 | connect(m_keyboardInterface, SIGNAL(keyClicked(QString)), SLOT(keyboardKeyClicked(QString))); 16 | connect(m_keyboardInterface, SIGNAL(specialKeyClicked(int)), SLOT(keyboardSpecialKeyClicked(int))); 17 | } 18 | 19 | QVkImPlatformInputContext::~QVkImPlatformInputContext() 20 | { 21 | } 22 | 23 | bool QVkImPlatformInputContext::isValid() const 24 | { 25 | return m_keyboardInterface->isValid(); 26 | } 27 | 28 | void QVkImPlatformInputContext::setFocusObject(QObject *object) 29 | { 30 | m_focusObject = object; 31 | } 32 | 33 | void QVkImPlatformInputContext::showInputPanel() 34 | { 35 | QPoint globalPos(0, 0); 36 | 37 | QWidget *widget = qobject_cast(m_focusObject); 38 | if (widget) 39 | globalPos = widget->mapToGlobal(QPoint(0, widget->height())); 40 | 41 | m_keyboardInterface->call("showKeyboard", globalPos.x(), globalPos.y()); 42 | } 43 | 44 | void QVkImPlatformInputContext::hideInputPanel() 45 | { 46 | m_keyboardInterface->call("hideKeyboard"); 47 | } 48 | 49 | bool QVkImPlatformInputContext::isInputPanelVisible() const 50 | { 51 | const QDBusReply reply = m_keyboardInterface->call("keyboardVisible"); 52 | 53 | if (reply.isValid()) 54 | return reply.value(); 55 | else 56 | return false; 57 | } 58 | 59 | void QVkImPlatformInputContext::keyboardSpecialKeyClicked(int key) 60 | { 61 | if (!m_focusObject) 62 | return; 63 | 64 | if (key == Qt::Key_Enter) { 65 | QKeyEvent *pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier); 66 | QGuiApplication::postEvent(m_focusObject, pressEvent); 67 | 68 | QKeyEvent *releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier); 69 | QGuiApplication::postEvent(m_focusObject, releaseEvent); 70 | } else if (key == Qt::Key_Backspace) { 71 | QKeyEvent *pressEvent = new QKeyEvent(QEvent::KeyPress, Qt::Key_Backspace, Qt::NoModifier); 72 | QGuiApplication::postEvent(m_focusObject, pressEvent); 73 | 74 | QKeyEvent *releaseEvent = new QKeyEvent(QEvent::KeyRelease, Qt::Key_Backspace, Qt::NoModifier); 75 | QGuiApplication::postEvent(m_focusObject, releaseEvent); 76 | } 77 | } 78 | 79 | void QVkImPlatformInputContext::keyboardKeyClicked(const QString &characters) 80 | { 81 | if (!m_focusObject) 82 | return; 83 | 84 | QInputMethodEvent event; 85 | event.setCommitString(characters); 86 | 87 | QGuiApplication::sendEvent(m_focusObject, &event); 88 | } 89 | -------------------------------------------------------------------------------- /plugin/qvkimplatforminputcontext.h: -------------------------------------------------------------------------------- 1 | #ifndef QVKIMPLATFORMINPUTCONTEXT_H 2 | #define QVKIMPLATFORMINPUTCONTEXT_H 3 | 4 | #include 5 | 6 | QT_BEGIN_NAMESPACE 7 | 8 | class QDBusInterface; 9 | 10 | class QVkImPlatformInputContext : public QPlatformInputContext 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | QVkImPlatformInputContext(); 16 | ~QVkImPlatformInputContext(); 17 | 18 | bool isValid() const Q_DECL_OVERRIDE; 19 | void setFocusObject(QObject *object) Q_DECL_OVERRIDE; 20 | 21 | void showInputPanel() Q_DECL_OVERRIDE; 22 | void hideInputPanel() Q_DECL_OVERRIDE; 23 | bool isInputPanelVisible() const Q_DECL_OVERRIDE; 24 | 25 | private slots: 26 | void keyboardSpecialKeyClicked(int key); 27 | void keyboardKeyClicked(const QString &character); 28 | 29 | private: 30 | QDBusInterface *m_keyboardInterface; 31 | 32 | QObject *m_focusObject; 33 | }; 34 | 35 | QT_END_NAMESPACE 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /plugin/vkim.json: -------------------------------------------------------------------------------- 1 | { 2 | "Keys": [ "vkim" ] 3 | } 4 | -------------------------------------------------------------------------------- /server/keyboard.cpp: -------------------------------------------------------------------------------- 1 | #include "keyboard.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #define NEXT_ROW_MARKER 0 8 | 9 | struct KeyboardLayoutEntry{ 10 | int key; 11 | const char *label; 12 | }; 13 | 14 | KeyboardLayoutEntry keyboardLayout[] = { 15 | { Qt::Key_1, "1" }, 16 | { Qt::Key_2, "2" }, 17 | { Qt::Key_3, "3" }, 18 | { Qt::Key_4, "4" }, 19 | { Qt::Key_5, "5" }, 20 | { Qt::Key_6, "6" }, 21 | { Qt::Key_7, "7" }, 22 | { Qt::Key_8, "8" }, 23 | { Qt::Key_9, "9" }, 24 | { Qt::Key_0, "0" }, 25 | { Qt::Key_Backspace, "<-" }, 26 | { NEXT_ROW_MARKER, 0 }, 27 | { Qt::Key_Q, "q" }, 28 | { Qt::Key_W, "w" }, 29 | { Qt::Key_E, "e" }, 30 | { Qt::Key_R, "r" }, 31 | { Qt::Key_T, "t" }, 32 | { Qt::Key_Z, "z" }, 33 | { Qt::Key_U, "u" }, 34 | { Qt::Key_I, "i" }, 35 | { Qt::Key_O, "o" }, 36 | { Qt::Key_P, "p" }, 37 | { NEXT_ROW_MARKER, 0 }, 38 | { Qt::Key_A, "a" }, 39 | { Qt::Key_S, "s" }, 40 | { Qt::Key_D, "d" }, 41 | { Qt::Key_F, "f" }, 42 | { Qt::Key_G, "g" }, 43 | { Qt::Key_H, "h" }, 44 | { Qt::Key_J, "j" }, 45 | { Qt::Key_K, "k" }, 46 | { Qt::Key_L, "l" }, 47 | { NEXT_ROW_MARKER, 0 }, 48 | { Qt::Key_Y, "y" }, 49 | { Qt::Key_X, "x" }, 50 | { Qt::Key_C, "c" }, 51 | { Qt::Key_V, "v" }, 52 | { Qt::Key_B, "b" }, 53 | { Qt::Key_N, "n" }, 54 | { Qt::Key_M, "m" }, 55 | { Qt::Key_Enter, "Enter" } 56 | }; 57 | 58 | const static int layoutSize = (sizeof(keyboardLayout) / sizeof(KeyboardLayoutEntry)); 59 | 60 | static QString keyToCharacter(int key) 61 | { 62 | for (int i = 0; i < layoutSize; ++i) { 63 | if (keyboardLayout[i].key == key) 64 | return QString::fromLatin1(keyboardLayout[i].label); 65 | } 66 | 67 | return QString(); 68 | } 69 | 70 | Keyboard::Keyboard(QWidget *parent) 71 | : QWidget(parent) 72 | { 73 | setWindowFlags(Qt::WindowDoesNotAcceptFocus | Qt::Tool | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::BypassWindowManagerHint); 74 | 75 | QGridLayout *gridLayout = new QGridLayout(this); 76 | 77 | QSignalMapper *mapper = new QSignalMapper(this); 78 | connect(mapper, SIGNAL(mapped(int)), SLOT(buttonClicked(int))); 79 | 80 | int row = 0; 81 | int column = 0; 82 | 83 | for (int i = 0; i < layoutSize; ++i) { 84 | if (keyboardLayout[i].key == NEXT_ROW_MARKER) { 85 | row++; 86 | column = 0; 87 | continue; 88 | } 89 | 90 | QPushButton *button = new QPushButton; 91 | button->setFixedWidth(40); 92 | button->setText(QString::fromLatin1(keyboardLayout[i].label)); 93 | 94 | mapper->setMapping(button, keyboardLayout[i].key); 95 | connect(button, SIGNAL(clicked()), mapper, SLOT(map())); 96 | 97 | gridLayout->addWidget(button, row, column); 98 | column++; 99 | } 100 | } 101 | 102 | void Keyboard::showKeyboard(int globalX, int globalY) 103 | { 104 | QWidget::move(globalX, globalY); 105 | QWidget::show(); 106 | } 107 | 108 | void Keyboard::hideKeyboard() 109 | { 110 | QWidget::hide(); 111 | } 112 | 113 | bool Keyboard::keyboardVisible() const 114 | { 115 | return QWidget::isVisible(); 116 | } 117 | 118 | void Keyboard::buttonClicked(int key) 119 | { 120 | if ((key == Qt::Key_Enter) || (key == Qt::Key_Backspace)) 121 | emit specialKeyClicked(key); 122 | else 123 | emit keyClicked(keyToCharacter(key)); 124 | } 125 | -------------------------------------------------------------------------------- /server/keyboard.h: -------------------------------------------------------------------------------- 1 | #ifndef KEYBOARD_H 2 | #define KEYBOARD_H 3 | 4 | #include 5 | 6 | class Keyboard : public QWidget 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit Keyboard(QWidget *parent = Q_NULLPTR); 12 | 13 | public slots: 14 | void showKeyboard(int globalX, int globalY); 15 | void hideKeyboard(); 16 | bool keyboardVisible() const; 17 | 18 | signals: 19 | void specialKeyClicked(int key); 20 | void keyClicked(const QString &text); 21 | 22 | private slots: 23 | void buttonClicked(int key); 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /server/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "keyboard.h" 5 | 6 | int main(int argc, char **argv) 7 | { 8 | QApplication app(argc, argv); 9 | 10 | if (!QDBusConnection::sessionBus().registerService("com.kdab.inputmethod")) { 11 | qFatal("Unable to register at DBus"); 12 | return 1; 13 | } 14 | 15 | Keyboard keyboard; 16 | 17 | if (!QDBusConnection::sessionBus().registerObject("/VirtualKeyboard", &keyboard, QDBusConnection::ExportAllSignals | QDBusConnection::ExportAllSlots)) { 18 | qFatal("Unable to register object at DBus"); 19 | return 1; 20 | } 21 | 22 | return app.exec(); 23 | } 24 | -------------------------------------------------------------------------------- /server/server.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = server 3 | QT += widgets dbus 4 | INCLUDEPATH += . 5 | 6 | HEADERS += keyboard.h 7 | SOURCES += keyboard.cpp main.cpp 8 | -------------------------------------------------------------------------------- /src.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS = server plugin 4 | --------------------------------------------------------------------------------