Page 1 of 2 12 LastLast
Results 1 to 20 of 24

Thread: Accessing google tools from Qt

  1. #1
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Accessing google tools from Qt

    Hi All,

    Is there any way to turn google tools on or off through Qt on QLineEdit focus.
    Actually i am using multilingual application & I want different language on different line edits.
    Thanks in advance.

    Regards,
    Rohit.

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

    Default Re: Accessing google tools from Qt

    Eeeemmm.... whaaat?
    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. #3
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    I want to access a different application(Google Tools) from Qt.
    I want to turn google tools on or off*(pressing Ctr+G) based on which qlineedit it has focussed.

    Or can i press Ctr+G (Not through keyboard externally) on line edit focussing.

    Or firing Keyboard event.

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

    Default Re: Accessing google tools from Qt

    What google tools? What does Qt have to do with this? Do you mean google input tools (http://www.google.com/inputtools/)? Could you be more specific about what you have now, what you want and how is what you have different from what you want?
    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.


  5. #5
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Yes it is google input tools.
    I want google input tools to be turned off & on based on the line edit on which I am focusing.
    So, on focus event for a line edit I want Ctrl+G(viz. a shortcut to turn google tools on & off) to be pressed.
    Can I do this ? Is it possible to press /Call keyboard event or can I directly access Google tools application from qt.

    Help will be appreciated.

    My Application is a multi language application in which user inputs a different language for a certain line edit & a different language on different line edit.
    Hence, pressing Ctrl+G I have to toggle the language each time , but now i want it to be done through programmatically.

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

    Default Re: Accessing google tools from Qt

    If the tool does not provide any API to control it then most likely you can't do it. If the tool provides some API you can use then most probably you can do it. Which is the case I doubt anyone on this forum has any knowledge of and it would be better to ask at some google site or read their manual.
    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.


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

    rohitkk (3rd April 2014)

  8. #7
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Its not about whether google tools provide it , Its about whether Qt allows to do it. If Yes then how?

  9. #8
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by rohitkk View Post
    I want to turn google tools on or off*(pressing Ctr+G) based on which qlineedit it has focussed.
    Create a QShortCut for CTRL+G and in the slot check which of your QLineEdit has focus (if any).

    Quote Originally Posted by rohitkk View Post
    Or can i press Ctr+G (Not through keyboard externally) on line edit focussing.
    You can trigger the slot directly, e.g. through subclassing QLineEdit and reimplementing focusInEvent() or by using an event filter.

    Quote Originally Posted by rohitkk View Post
    Or firing Keyboard event.
    You can do that as well. Create a QKeyEvent and use QApplication:ostEvent() or QApplication::sentEvent() to whatever widget you'd like to be the receiver.

    All of that is obviously totally independent of what you do when the short cut is triggered.

    Cheers,
    _

  10. #9
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by anda_skoa View Post
    Create a QShortCut for CTRL+G and in the slot check which of your QLineEdit has focus (if any).

    You can do that as well. Create a QKeyEvent and use QApplication:ostEvent() or QApplication::sentEvent() to whatever widget you'd like to be the receiver.

    _
    Can you please elaborate on how to do this.

  11. #10
    Join Date
    Sep 2011
    Location
    Bangalore
    Posts
    248
    Thanks
    91
    Thanked 16 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Is this what you are looking for ?
    Qt Code:
    1. QShortcut * shortcut = new QShortcut(Qt::CTRL + Qt::Key_G);
    2. connect(shortcut, SIGNAL(activated()), objectOfCorrespondingClass, SLOT(getFocussedLineEdit()));
    3.  
    4. // -- slot
    5. void YourClass::getFocussedLineEdit()
    6. {
    7. if(lineEdit_1->hasFocus())
    8. {
    9. // Do necessary
    10. }
    11. else if(lineEdit_2->hasFocus())
    12. {
    13. // Do necessary
    14. }
    15. else if(lineEdit_3->hasFocus())
    16. {
    17. // Do necessary
    18. }
    19. else
    20. {
    21. // ...
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 

  12. #11
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by rawfool View Post
    Is this what you are looking for ?
    Qt Code:
    1. QShortcut * shortcut = new QShortcut(Qt::CTRL + Qt::Key_G);
    2. connect(shortcut, SIGNAL(activated()), objectOfCorrespondingClass, SLOT(getFocussedLineEdit()));
    3.  
    4. // -- slot
    5. void YourClass::getFocussedLineEdit()
    6. {
    7. if(lineEdit_1->hasFocus())
    8. {
    9. // Do necessary
    10. }
    11. else if(lineEdit_2->hasFocus())
    12. {
    13. // Do necessary
    14. }
    15. else if(lineEdit_3->hasFocus())
    16. {
    17. // Do necessary
    18. }
    19. else
    20. {
    21. // ...
    22. }
    23. }
    To copy to clipboard, switch view to plain text mode 
    I am able to check that whether line edit is in focus but i am not able to fire the 'Ctrl+G' event after focusing.
    Below is my code snippet,
    Qt Code:
    1. bool DemoDialog::eventFilter(QObject *target, QEvent *event)
    2. {
    3. if (target == ui->leAge) //On focussing Age line edit i want to fire 'Ctrl+G' event
    4. {
    5. if (event->type() == QEvent::FocusIn)
    6. {
    7. qDebug()<<"Inside Event";
    8. QKeyEvent *evnent=new QKeyEvent(QEvent::KeyPress,Qt::CTRL+Qt::Key_G,Qt::NoModifier,QString(""));
    9. QApplication::postEvent(qApp,evnent); //This is not working at all
    10. }
    11. }
    12. return QObject::eventFilter(target, event);
    13. }
    To copy to clipboard, switch view to plain text mode 

  13. #12
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,460
    Thanked 271 Times in 266 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Accessing google tools from Qt

    Is the line 8 should not be a :
    Qt Code:
    1. QKeyEvent *evnent=new QKeyEvent(QEvent::KeyPress,Qt::Key_G,Qt::ControlModifier,QString(""));
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Accessing google tools from Qt

    What exactly you expect to happen when you send Ctrl+G to your application object? If you expect another application to respond to it then it is not going to happen.
    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.


  15. #14
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by wysota View Post
    What exactly you expect to happen when you send Ctrl+G to your application object? If you expect another application to respond to it then it is not going to happen.
    Yes, I want google input tools to get turned off.
    But Why? Qt doesn't support to interact with other application?

    Quote Originally Posted by Lesiok View Post
    Is the line 8 should not be a :
    Qt Code:
    1. QKeyEvent *evnent=new QKeyEvent(QEvent::KeyPress,Qt::Key_G,Qt::ControlModifier,QString(""));
    To copy to clipboard, switch view to plain text mode 
    No , It is not working.


    Added after 12 minutes:


    Quote Originally Posted by Lesiok View Post
    Is the line 8 should not be a :
    Qt Code:
    1. QKeyEvent *evnent=new QKeyEvent(QEvent::KeyPress,Qt::Key_G,Qt::ControlModifier,QString(""));
    To copy to clipboard, switch view to plain text mode 
    This is not working
    Last edited by rohitkk; 2nd April 2014 at 13:29.

  16. #15
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,460
    Thanked 271 Times in 266 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Accessing google tools from Qt

    QCoreApplication::postEvent send event to any object in this application.

  17. #16
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    This isn't working either
    Quote Originally Posted by Lesiok View Post
    QCoreApplication::postEvent send event to any object in this application.

  18. #17
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,460
    Thanked 271 Times in 266 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by rohitkk View Post
    This isn't working either
    What it means ? You are sending event to the object pointed by qApp variable. Did this object know what to do ?

    P.S.
    Are you sure you know what you're doing ?

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

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by rohitkk View Post
    Qt doesn't support to interact with other application?
    Definitely not this way. You are sending an internal event to an internal object so don't expect some other entity to receive and understand that. It's like you were driving a car, turning your driver wheel right and expecting some concrete car in a different country to start ringing its horn.
    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.


  20. #19
    Join Date
    Sep 2013
    Posts
    40
    Thanks
    6
    Thanked 3 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Accessing google tools from Qt

    Then what is right way to do it?
    Quote Originally Posted by wysota View Post
    Definitely not this way. You are sending an internal event to an internal object so don't expect some other entity to receive and understand that. It's like you were driving a car, turning your driver wheel right and expecting some concrete car in a different country to start ringing its horn.
    I am really getting confused bcoz of this shit.


    Added after 22 minutes:


    As of now u must have understand my requirement. If there are any suggestion on how to do it will be highly appreciated.
    Please co-ordinate as i am new to qt framework.

    Regards,
    Rohit
    Last edited by rohitkk; 2nd April 2014 at 14:39.

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

    Default Re: Accessing google tools from Qt

    Quote Originally Posted by rohitkk View Post
    Then what is right way to do it?
    The right way is to use the API offered by the framework you want to interact with. Qt has nothing to do with it, you have to find a way to send appropriate commands to the other framework and only then you can look for ways of doing it with Qt.
    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.


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

    rohitkk (2nd April 2014)

Similar Threads

  1. QHelper Tools
    By auba in forum Qt-based Software
    Replies: 0
    Last Post: 15th May 2009, 11:07
  2. dll error in all tools
    By zeldaknight in forum Installation and Deployment
    Replies: 2
    Last Post: 28th April 2009, 01:58
  3. uml tools
    By tpthyd in forum Qt Programming
    Replies: 2
    Last Post: 20th March 2009, 12:00
  4. Zip tools for QT4
    By Xagen in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2006, 11:12

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.