PDA

View Full Version : How to establish a connection between a key and the console??



Harini
12th December 2013, 11:38
Hello every one :)

I want to design a console application in which it must have connection with keys on the keyboard.That means, i have 4 keys on my device(f1,f2,f3,f4) and when i press a key,i must access the icons on the display.....can any one please help me in writing the code for this app??

anda_skoa
12th December 2013, 14:18
console application as in terminal or as in runing without GUI?

Cheers,
_

Harini
16th December 2013, 10:42
@ anda_skoa

sorry i dint get u...

anda_skoa
16th December 2013, 11:00
The term console application can mean two different things:

- a program that runs a shell or console interface, also referred to as a terminal program
- a program running in a shell

Since you wrote "icons" I assume the former but since in that context this would easily be solvable through QAction I wanted to get a clarifcation first.

Cheers,
_

Harini
16th December 2013, 11:23
a program running in a shell... :)

wysota
16th December 2013, 14:42
a program running in a shell... :)

And where are the "icons" then?

Harini
17th December 2013, 06:03
Been searching the forums and online tutorials to find any info on this, but no luck yet.
Here in our application in which we want to design,when we press the button on the keyboard the application must be opened....there is no use of icon...how to do this??I'm not getting any idea about the code....
And where are the "icons" then?

wysota
17th December 2013, 07:17
If you want us to help you, you have to explain what is the problem.

anda_skoa
17th December 2013, 09:12
Here in our application in which we want to design,when we press the button on the keyboard the application must be opened

You seem to keep changing the requirements arbitrarily.
Now you want to start your application when a certain button is pressed?



....there is no use of icon

Another change in requirements, you originally claimed:


i must access the icons on the display.




...how to do this??
How to do what?

As wysota said: if you don't tell us what you need to do there is no way to help you.

Cheers,
_

aamer4yu
17th December 2013, 09:44
Seems like Harini is trying to use some sort of keyboard hook.

I guess this wont be possible with Qt as you don't want to show UI. You will need some system level hooking of keys

Harini
17th December 2013, 10:05
You seem to keep changing the requirements arbitrarily.
Now you want to start your application when a certain button is pressed?


Another change in requirements, you originally claimed:



How to do what?

As wysota said: if you don't tell us what you need to do there is no way to help you.

Cheers,
_

actually,i dint change
i asked for ur help as what my superior asked me to do....
here goes my need, when i press the button on the keyboard the camera app has to get opened....(just as the work of navigation key in nokia phones :P )

okay! then tell me the way how it could be possible... :P
Seems like Harini is trying to use some sort of keyboard hook.

I guess this wont be possible with Qt as you don't want to show UI. You will need some system level hooking of keys

Added after 12 minutes:

sir my problem is to make an app which resembles like a navigation key or a menu key in our mobiles(i.e when ever we press the key on the keyboard, the application has to opened and we have to access the application using the keys i.e without using touchscreen... )for this have been searching for the sample code at least for getting an idea how to do.
If you want us to help you, you have to explain what is the problem.

wysota
17th December 2013, 12:01
So you have two applications? One which is active and should react to a certain key to start the other application ("camera app")?

Harini
17th December 2013, 12:38
yes :) how can I make this???
So you have two applications? One which is active and should react to a certain key to start the other application ("camera app")?

wysota
17th December 2013, 13:13
yes :) how can I make this???

If this application is running in the background you have to hook into system's hotkey infrastructure. If the application has a UI and is the currently active application, you can use QAction.