Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Alter virtual keyboard styles without editing Qt source



  • How might I go about altering the Qt virtualKeyboard styles without directly altering the source code? Is there an established method for doing this?


  • Lifetime Qt Champion

    Hi,

    What kind of alterations do you have in mind ?



  • @SGaist
    To make the changes easier for you to visualize I have attached two images. One is the current virtual keyboard and the second is an alphanumeric keypad I created. I essentially need to alter the virtual keyboard to look like my alphanumeric keypad. It doesn't have to be exact but as close as I can get it without altering the layouts. For instance I wont need to change the enter symbol of the keyboard from the arrow or anything like that. I mean if I could make them look almost exact that would be great but I don't believe I can. Essentially, I would like to change the panel color and expand it's size s/t I can add in a title and a textbox to display what's being typed. I want to change the button color to a lighter gray and change the font to black. I would also like to alter the dimensions s/t the panel itself is shaped like my alphanumeric keypad panel, changes such as that.

    Essentially I want the QTVK's languages. I dont want to create a custom keyboard with 15 different layouts...

    0_1563824061651_virtualKeyboard.png

    0_1563824076573_keypad.png



  • Perhaps there is some way I could pull the styles folder into my project? For instance, could I copy say the retro style and paste it into my project and then reference the folder that's inside the project instead of the one located @ src/virtualkeyboard/content? We don't want to have to alter Qt source code as this GUI application could be used on a different project or on a different platform. Which would mean that the change made here would have to be made there as well and potentially anywhere where Qt is being used.

    This does not seem to be working but I could be doing it wrong. I tried adding the retro style to one of my projects but I renamed it test and made the alterations as shown in the technical guide for adding a custom style. Then in main I tried referencing the new location:

    qputenv("QT_VIRTUALKEYBOARD_STYLE","qrc:/test");
    

    also tried:

    qputenv("QT_VIRTUALKEYBOARD_STYLE",":/test/");
    

    and

    qputenv("QT_VIRTUALKEYBOARD_STYLE","~/home/rob/untitled/test");
    

    however; each time I try it tells me that it cannot find the location:

    WARNING: Cannot find style "~/home/rob/untitled/test" - fallback: "default"
    

  • Lifetime Qt Champion

    The tild character won't work as it is expanded by the shell. Use the full path to the folder you want to use.


Log in to reply