Results 1 to 7 of 7

Thread: About qtopia an virtual keyboard

  1. #1
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default About qtopia an virtual keyboard

    Hello,

    I have read that qtopia support virtual keyboard. is it true?
    I have downloaded qtopia 4.3.5, and later, I configured it :

    ./configure -embedded x86 -depths 8,16,24,32 -big-endian -no-cups -qt-gif -qt-libjpeg -qt-libpng -qt-zlib -qt-mouse-linuxtp -no-kbd-tty -qt-kbd-qvfb -qt-mouse-tslib -L /home/john/GeodeProject/Qt-embedded/tslib-src/compilado/lib -I /home/john/GeodeProject/Qt-embedded/tslib-src/compilado/include -lts

    Theese options: "-no-kbd-tty -qt-kbd-qvfb" I have supposed that it is to disable tty keyboard and enable virtual keyboard , but it does not work.

    any advice??

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: About qtopia an virtual keyboard

    I'm not an expert on that but from what I know you made a wrong assumption

    Qtopia (QtExtended) has its own virtual keyboard which can be used regardless of the real keyboard. You can do that probably by calling some method from Qt Extended API (QWSServer:penKeyboard() maybe?). Qt Embedded has support for multiple keyboard drivers compilation of which is enabled or disabled by configure options. It doesn't state which driver will actually be used by Qtopia. You do that using the QWS_KEYBOARD environment variable.

    Another thing is that you can create your own (virtual or not) keyboard if the underlying window system doesn't provide one. You do that with the use of QWSServer::sendKeyEvent() which will feed the input system with the key you pass to the method.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    webquinty (22nd February 2009)

  4. #3
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: About qtopia an virtual keyboard

    Hello, and thank you for your answer.

    I am not a expert too, but your idea to use QWSServer::sendKeyEvent() to make my own keyboard is very good. I will try to use it.

    By other hand, perhpas you could help me with other problem.
    I have a QLine Edit as input data. I would like to use a virtual keyboard to write data in it, but the problem is that QLineEdit has not click signal like QButton to launch keyboard.
    is it possible to modify QlineEdit class to add click event or create my own wigdet with this event???

    Best regards

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: About qtopia an virtual keyboard

    You can react on focusIn event of the line edit, I think that would be the best option. You can even apply an event filter on the application so that you have a single place to react on all focusIn and focusOut events of all line edits. On the other hand you can use soft keys to open and close the keyboard regardless of the current focus.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: About qtopia an virtual keyboard

    Hello wysota,

    Finally, I have used this to detect a click event on QlineEdit:

    firts, Constructor Class:
    Qt Code:
    1. lineEdit1->installEventFilter(this);
    To copy to clipboard, switch view to plain text mode 

    and later...

    Qt Code:
    1. bool MyDialog::eventFilter(QObject* call_object, QEvent* pevent)
    2. {
    3. unsigned long contador;
    4. unsigned long contador2;
    5. QString aux_contador;
    6.  
    7. contador2++;
    8. aux_contador.setNum(contador2);
    9. textLabel3->setText(aux_contador);
    10. if (pevent->MouseButtonPress == QEvent::MouseButtonPress)
    11. {
    12. if (call_object == lineEdit1)
    13. {
    14. contador++;
    15. aux_contador.setNum(contador);
    16. textLabel4->setText(aux_contador);
    17. retunr true;
    18. }
    19. }else
    20. return false;
    21. }
    To copy to clipboard, switch view to plain text mode 

    This function works fine, but only enter once, and no more. I do not find what is the problem. Could you help??

    Best regards.
    Last edited by wysota; 23rd February 2009 at 20:27. Reason: Changed [quote] to [code]

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,364
    Thanks
    3
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: About qtopia an virtual keyboard

    What is this code supposed to do? I admit I don't see any sense in it

    I'd do it more or less like this:
    Qt Code:
    1. qApp->installEventFilter(myKeyboardObject);
    2. //...
    3. bool myKeyboardClass::eventFilter(QObject *o, QEvent *e){
    4. QLineEdit *le = qobject_cast<QLineEdit*>(o);
    5. if(!le) return QtopiaApplication::eventFilter(o, e);
    6. if(e->type()==QEvent::focusIn){
    7. this->show();
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    May 2008
    Location
    Spain
    Posts
    90
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: About qtopia an virtual keyboard

    Hello,

    we have a bit problem with qobject_cast.
    Qt Code:
    1. bool MyDialog::eventFilter(QObject* call_object, QEvent* pevent)
    2. {
    3. Touchpad *myTouchpad;
    4.  
    5. QLineEdit *isQLineEdit = qobject_cast<QLineEdit*>(call_object);
    6.  
    7. if (pevent->type() == QEvent::MouseButtonPress)
    8. {
    9. }
    10. }
    To copy to clipboard, switch view to plain text mode 

    mydialog.cpp: In member function ‘virtual bool MyDialog::eventFilter(QObject*, QEvent*)’:
    mydialog.cpp:540: error: ‘qobject_cast’ was not declared in this scope
    mydialog.cpp:540: error: expected primary-expression before ‘*’ token
    mydialog.cpp:540: error: expected primary-expression before ‘>’ token
    But If I use this code...

    Qt Code:
    1. bool MyDialog::eventFilter(QObject* call_object, QEvent* pevent)
    2. {
    3. Touchpad *myTouchpad;
    4.  
    5. QLineEdit *isQLineEdit = static_cast<QLineEdit*>(call_object);
    6.  
    7. if(!isQLineEdit) return false; // Si no se trata de un QLineEdit, no se hace nada
    8.  
    9. if (pevent->type() == QEvent::MouseButtonPress)
    10. {
    11. myTouchpad = new Touchpad(isQLineEdit,0,TRUE,WStyle_Customize | WStyle_NoBorder);
    12. myTouchpad->txt_dato->setText(isQLineEdit->text());
    13.  
    14. myTouchpad->show();
    15. return true;
    16.  
    17. }else
    18. return false;
    19. }
    To copy to clipboard, switch view to plain text mode 

    the application works fine. So, the question is, what is the difference between static_cast and qobject_cast??

    Best regards.
    Last edited by webquinty; 2nd March 2009 at 10:13.

Similar Threads

  1. virtual keyboard done with qt4-designer
    By Klaus_EAN in forum Qt Programming
    Replies: 17
    Last Post: 30th December 2010, 09:47
  2. Q3ScrollView resists to scroll down to the garbage bin
    By sivrisinek in forum Qt Programming
    Replies: 0
    Last Post: 5th February 2009, 18:50
  3. qtopia , serial port and keyboard
    By anafor2004 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 19th January 2008, 13:19
  4. How to Launch Virtual Keyboard on top of TouchScreen
    By arunvv in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 21st June 2007, 19:31
  5. Virtual Keyboard on Qtopia 4.2.1
    By shapirlex in forum Qt for Embedded and Mobile
    Replies: 2
    Last Post: 11th April 2007, 16:51

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.