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.
Printable View
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.
Eeeemmm.... whaaat?
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.
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?
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.
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.
Its not about whether google tools provide it , Its about whether Qt allows to do it. If Yes then how?
Create a QShortCut for CTRL+G and in the slot check which of your QLineEdit has focus (if any).
You can trigger the slot directly, e.g. through subclassing QLineEdit and reimplementing focusInEvent() or by using an event filter.
You can do that as well. Create a QKeyEvent and use QApplication::postEvent() 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,
_
Is this what you are looking for ?
Code:
connect(shortcut, SIGNAL(activated()), objectOfCorrespondingClass, SLOT(getFocussedLineEdit())); // -- slot void YourClass::getFocussedLineEdit() { if(lineEdit_1->hasFocus()) { // Do necessary } else if(lineEdit_2->hasFocus()) { // Do necessary } else if(lineEdit_3->hasFocus()) { // Do necessary } else { // ... } }
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,
Code:
{ if (target == ui->leAge) //On focussing Age line edit i want to fire 'Ctrl+G' event { { qDebug()<<"Inside Event"; } } }
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.
QCoreApplication::postEvent send event to any object in this 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.
Then what is right way to do it?
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
@Rohit:
In order to access google tools, they have to offer a public API.
If you don't have the libs and the API to access them, then its not possible to access them be it from Qt or any other place.
The problem you have in this thread is a communication problem.
It seems you do not fully understand what it is you are asking.
Qt can not allow access to anything.
Its the software being accesses, that has to allow access to it.
If your google tools offer such API you can access them from any application be it written with Qt or not.
So if you want to move forward - do what wysota suggested above:
Ask around in forums that deal with these input devices.
If they allow access through their API - most likely these forums will offer a "hello world" example, free of Qt or any other dependency.
THEN, you might want to use this in a Qt application, but then the access is not going to be your problem any more where we can help you further should you need any Qt related help.
Accessing external API is not something related to Qt and thus off topic for this forum.
I hope this helps you further.
If I might interject here for clarity's sake.
So Ctrl+G toggles these google tools on and off. There is no way to programmatically send Ctrl+G to the system so that any applications can catch it? I know I've seen applications that can remap keys. Are those not intercepting key press events and emitting a different one? Or is it just that QT doesn't have a class capable of doing that?
Ctrl+G is registered as a global hotkey for the application. When the user presses Ctrl+G the system most likely intercepts events coming from the keyboard driver and interprets them itself. I strongly doubt sending Ctrl+G "to the system" would trigger the hotkey. Maybe WinAPI offers a way to artificially trigger a hotkey but this is still out of scope of Qt.
http://lmgtfy.com?q=winapi+trigger+global+hotkey