Results 1 to 4 of 4

Thread: Building florence virtual keyboard as plug in target

  1. #1
    Join Date
    Sep 2016
    Posts
    4
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Building florence virtual keyboard as plug in target

    Hi there. With much effort I have tried to build a florence plug in target. My goal is to be able to use the keyboard in Qt Designer and also be able to call the keyboard when line edits receive focus. I'm trying this build in a Qt 5.5.0 with the GCC compiler on Ubuntu 14.04 distribution. I get an error that some say have to do with the code in florence using an old deprecated library or method. However I don't know how I would be able to fix this. Can anyone help me build this plug in? It will be much appreciated. Attached is a picture with the errors, warnings and the specific line with the issue. Also as advised by members of the community I'm attaching the conflicting code in between #.

    Qt Code:
    1. void Florence::mouseMoveEvent( QMouseEvent *event )
    2. {
    3. if ( event->buttons() > Qt::NoButton ) {
    4. Key *k = static_cast<Key *>( this->scene()->itemAt( this->mapToScene( event->pos() ) ) );
    5. if ( k != this->focusKey ) {
    6. this->autoRepeatTimer->stop();
    7. if ( this->focusKey ) this->focusKey->hoverLeaveEvent();
    8. this->focusKey = k;
    9. if ( k ) {
    10. k->hoverEnterEvent();
    11. this->autoRepeatTimer->start( 1000 );
    12. }
    13. }
    14. }
    15. QGraphicsView::mouseMoveEvent( event );
    16. }
    To copy to clipboard, switch view to plain text mode 

    The specific error is as follows:
    Qt Code:
    1. /home/rey/Desktop/florence/qt/src/florence.cpp:147: error: no matching function for call to 'QGraphicsScene::itemAt(QPointF)'
    2. Key *k = static_cast<Key *>( this->scene()->itemAt( this->mapToScene( event->pos() ) ) );
    3. ^
    To copy to clipboard, switch view to plain text mode 

    **Update: I know the itemAt is the problem. I have looked online for refactored code from other developers on places like Github to see how they fixed the problem. Still I get new errors when I try to fix the problem.
    Attached Images Attached Images
    Last edited by anda_skoa; 7th October 2016 at 10:25. Reason: changed # to [code]

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Building florence virtual keyboard as plug in target

    Also as advised by members of the community I'm attaching the conflicting code in between #.
    LOL. Not exactly... read my signature block a bit more carefully.

    itemAt() expects a reference to a QTransform instance as the second argument. You could try something like the following:

    Qt Code:
    1. Key * k = static_cast< Key * >( scene()->itemAt( mapToScene( event->pos(), QTransform() ) ) );
    To copy to clipboard, switch view to plain text mode 

    This uses a default constructed (i.e. identity matrix) QTransform, which may or may not be the right transformation in this case. It will get you past the compilation error.

    Note that using "this->" in member functions is totally unnecessary; in a member function it is assumed that the current instance ("this") is to be used when calling member functions of the same class.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Sep 2016
    Posts
    4
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building florence virtual keyboard as plug in target

    Following your advise, I:
    #include <QTransform>

    The new piece of code looks like this:
    Qt Code:
    1. void Florence::mouseMoveEvent( QMouseEvent *event )
    2. {
    3. if ( event->buttons() > Qt::NoButton ) {
    4. Key *k = static_cast<Key *>( this->scene()->itemAt( this->mapToScene( event->pos() , QTransform() ) ) );
    5. if ( k != this->focusKey ) {
    6. this->autoRepeatTimer->stop();
    7. if ( this->focusKey ) this->focusKey->hoverLeaveEvent();
    8. this->focusKey = k;
    9. if ( k ) {
    10. k->hoverEnterEvent();
    11. this->autoRepeatTimer->start( 1000 );
    12. }
    13. }
    14. }
    15. QGraphicsView::mouseMoveEvent( event );
    16. }
    To copy to clipboard, switch view to plain text mode 

    The new error I get is as follows:
    Qt Code:
    1. /home/rey/Desktop/florence/qt/src/florence.cpp:148: error: no matching function for call to 'Florence::mapToScene(QPoint, QTransform)'
    2. Key *k = static_cast<Key *>( this->scene()->itemAt( this->mapToScene( event->pos() , QTransform() ) ) );
    3. ^
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by anda_skoa; 7th October 2016 at 18:18. Reason: missing [code] tags

  4. #4
    Join Date
    Sep 2016
    Posts
    4
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Building florence virtual keyboard as plug in target

    I looked at the Makefile on the florence directory I have been trying to build and it was build with Qt 5.2. Since I have had no luck in building the florence plug in with that file, I decided to try the same build steps I found in this same file, instead with the latest florence from [ https://sourceforge.net/projects/flo...urce=directory ]. Now again I'm having issues compiling and building the application.

    The error has to do with [ #include <gtk/gtk.h> ] and is as follows:
    #
    /home/rey/Desktop/florence-0.6.3/src/status.h:31: error: gtk/gtk.h: No such file or directory
    #include <gtk/gtk.h>
    ^
    #

    I have tried all of these to make sure the header files are within my ubuntu system:
    #
    sudo apt-get install libgtk2.0-dev
    sudo apt-get install libgtk2-dev
    sudo apt-get install libgtk3.0-dev
    sudo apt-get install libgtk3-dev
    sudo apt-get install gtk+2.0-dev
    sudo apt-get install gtk+3.0-dev
    #
    I have also ran pacman with:
    #
    pacman -Ql gtk3
    #
    as suggested in another forum to make sure the libraries are there. It ran.

    After doing all of this and opening the src.pro with all the files florence needs I still could not compile and build the application. I think my issue could be that I ran the wrong qmake command, as in it was incomplete. The command I ran was:
    #
    qmake -project
    #
    directly when I was in the src directory within florence-0.6.3 (the last one I downloaded from sourceforge.net). And then it build for me the src.pro which I could use to import the whole project in Qt Creator 5.5.

    Here are all the options that I have. I'm still learning linux so I don't fully understand what I must do to get the right .pro file if that's the actual problem.
    #
    rey@rey-VirtualBox:~/Desktop/florence-0.6.3/src$ qmake
    Usage: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake [mode] [options] [files]

    QMake has two modes, one mode for generating project files based on
    some heuristics, and the other for generating makefiles. Normally you
    shouldn't need to specify a mode, as makefile generation is the default
    mode for qmake, but you may use this to test qmake on an existing project

    Mode:
    -project Put qmake into project file generation mode
    In this mode qmake interprets files as files to
    be built,
    defaults to *; *; *; *.ts; *.xlf; *.qrc
    Note: The created .pro file probably will
    need to be edited. For example add the QT variable to
    specify what modules are required.
    -makefile Put qmake into makefile generation mode (default)
    In this mode qmake interprets files as project files to
    be processed, if skipped qmake will try to find a project
    file in your current working directory

    Warnings Options:
    -Wnone Turn off all warnings; specific ones may be re-enabled by
    later -W options
    -Wall Turn on all warnings
    -Wparser Turn on parser warnings
    -Wlogic Turn on logic warnings (on by default)
    -Wdeprecated Turn on deprecation warnings (on by default)

    Options:
    * You can place any variable assignment in options and it will be *
    * processed as if it was in [files]. These assignments will be parsed *
    * before [files]. *
    -o file Write output to file
    -d Increase debug level
    -t templ Overrides TEMPLATE as templ
    -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
    -help This help
    -v Version information
    -after All variable assignments after this will be
    parsed after [files]
    -norecursive Don't do a recursive search
    -recursive Do a recursive search
    -set <prop> <value> Set persistent property
    -unset <prop> Unset persistent property
    -query <prop> Query persistent property. Show all if <prop> is empty.
    -cache file Use file as cache [makefile mode only]
    -spec spec Use spec as QMAKESPEC [makefile mode only]
    -nocache Don't use a cache file [makefile mode only]
    -nodepend Don't generate dependencies [makefile mode only]
    -nomoc Don't generate moc targets [makefile mode only]
    -nopwd Don't look for files in pwd [project mode only]
    rey@rey-VirtualBox:~/Desktop/florence-0.6.3/src$ ls
    controller.c layoutreader.c service.h tools.h
    controller.h layoutreader.h settings.c trace.c
    florence-1.0.pc.in lib settings.h trace.h
    florence.c main.c settings-window.c trayicon.c
    florence.h Makefile settings-window.h trayicon.h
    florence.server.in.in Makefile.am src.pro.user view.c
    fsm.c Makefile.in status.c view.h
    fsm.h menu.c status.h xkeyboard.c
    keyboard.c menu.h style.c xkeyboard.h
    keyboard.h ramble.c style.h
    key.c ramble.h system.h
    key.h service.c tools.c
    rey@rey-VirtualBox:~/Desktop/florence-0.6.3/src$ qmake
    Usage: /usr/lib/x86_64-linux-gnu/qt5/bin/qmake [mode] [options] [files]

    QMake has two modes, one mode for generating project files based on
    some heuristics, and the other for generating makefiles. Normally you
    shouldn't need to specify a mode, as makefile generation is the default
    mode for qmake, but you may use this to test qmake on an existing project

    Mode:
    -project Put qmake into project file generation mode
    In this mode qmake interprets files as files to
    be built,
    defaults to *; *; *; *.ts; *.xlf; *.qrc
    Note: The created .pro file probably will
    need to be edited. For example add the QT variable to
    specify what modules are required.
    -makefile Put qmake into makefile generation mode (default)
    In this mode qmake interprets files as project files to
    be processed, if skipped qmake will try to find a project
    file in your current working directory

    Warnings Options:
    -Wnone Turn off all warnings; specific ones may be re-enabled by
    later -W options
    -Wall Turn on all warnings
    -Wparser Turn on parser warnings
    -Wlogic Turn on logic warnings (on by default)
    -Wdeprecated Turn on deprecation warnings (on by default)

    Options:
    * You can place any variable assignment in options and it will be *
    * processed as if it was in [files]. These assignments will be parsed *
    * before [files]. *
    -o file Write output to file
    -d Increase debug level
    -t templ Overrides TEMPLATE as templ
    -tp prefix Overrides TEMPLATE so that prefix is prefixed into the value
    -help This help
    -v Version information
    -after All variable assignments after this will be
    parsed after [files]
    -norecursive Don't do a recursive search
    -recursive Do a recursive search
    -set <prop> <value> Set persistent property
    -unset <prop> Unset persistent property
    -query <prop> Query persistent property. Show all if <prop> is empty.
    -cache file Use file as cache [makefile mode only]
    -spec spec Use spec as QMAKESPEC [makefile mode only]
    -nocache Don't use a cache file [makefile mode only]
    -nodepend Don't generate dependencies [makefile mode only]
    -nomoc Don't generate moc targets [makefile mode only]
    -nopwd Don't look for files in pwd [project mode only]
    rey@rey-VirtualBox:~/Desktop/florence-0.6.3/src$
    #

    Please if someone knows how I can build this plug in correctly instruct me as to how I should proceed. Thanks in advance. I'm thinking of trying it with Qt Creator 5.2, but I would rather fix the errors and use the latest software than to stick to having to use old deprecated libraries which could affect performance.

Similar Threads

  1. Virtual keyboard example
    By Coder5546 in forum Newbie
    Replies: 1
    Last Post: 29th November 2014, 13:45
  2. Qt with Florence Virtual Keyboard
    By JonnyJP in forum Qt Programming
    Replies: 5
    Last Post: 11th June 2012, 07:28
  3. Virtual Keyboard
    By NoRulez in forum Qt Programming
    Replies: 9
    Last Post: 5th August 2010, 07:02
  4. How to get the virtual keyboard?
    By ramesh.bs in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 2nd June 2010, 11:58
  5. virtual keyboard
    By sar_van81 in forum Qt Programming
    Replies: 5
    Last Post: 22nd December 2006, 13:40

Tags for this Thread

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.