What key is Keys.Context1 tied to in Qt/QML? - qt

I'm currently building a proof of concept application, on windows, testing out what I can do with QML but the end result is going to run on an embedded Linux system (which I'll need to learn too). I've been working with key handling (Enter, Up, down, Left and Right etc.) and noticed that there are 4 keys marked as Context1 to 4.
In the QtQuick docs there is reference to Keys.Context1..4 with associated onPressed events but not about how they are used.
context1Pressed(KeyEvent event)
This signal is emitted when the Context1 key has been pressed. The event parameter provides information about the event.
The corresponding handler is onContext1Pressed.
How do I find out what physical keys these are bound to, or how can I specify which keys they bind to?

Qt/QML is intended for use on the desktop (Windows, Linux, Mac) and mobile platforms. I strongly suspect the contextX key events and handlers are for mobile platform use. I did some googling and you can see the intent on this Qtopia site. So you won't use these keys on Windows.

The key codes for the Keys enumeration is in CoreLib/Global/QNamespace.h; the Key_Context1..4 keys are bound to the key codes 0x01100000..3. As Tod has mentioned the keys are designed for the mobile platform, similar mobile keys are defined close to the context keys, for example: Key_Call, Key_Camera etc.
The Qt Embedded framework apparently reads the keys directly from the tty device (on Linux) and so doesn't use the OS key mappings, there is a patch that allows you to specify bindings like { Qt::Key_A, Qt::Key_Context1, Qt::Key_Unknown, Qt::Key_Unknown } from this page: http://llg.cubic.org/patches/qtegerman.html I'm not sure yet if that helps.
I hoped that I'd be able to use the OS inbuilt key mapping features, but if it is reading directly from the input device I'm not sure this is possible.
I'll update this if I learn any more.
Update
The platform we're running on has an API that deals with the keyboard device so Qt doesn't access it directly; I add a listener for each button and then send the key press event to Qt using:
QKeyEvent* key = QKeyEvent(QEvent::KeyPress, Qt::Key_Context1, Qt::NoModifier);
qApp->SendEvent(view, key).
where view is the QML DeclarativeView (or equivalent).

Related

Is there possibility to add ExtraVoice Commands to Voice Guidance which is running from heremaps?

Is there possibility to add Extra Voice Commands to Voice Guidance which is running from here maps?
-like Turn Right (From Here maps) something like- I want (Stop After turn Right)
NMAAudioManager is the central class that is used by SDK for iOS to modify the application AVAudioSession and play audio. It is the interface that the NMANavigationManager uses to play audio feedback such as voice instructions. You can also use NMAAudioManager to change whether hardware keys directly control HERE SDK volume, and also use it to set volume as a factor relative to the user's device volume.
The NMAAudioManager contains a queue of audio output objects. You can add to this queue by calling playOutput: with NMAAudioFileOutput, NMATTSAudioOutput, or your own NMAAudioOutput implementation. You can also use NMAAudioManager methods such as clearQueue, skipCurrentOutput, and stopOutputAndClearQueue to manage audio output in this queue.
Please refer below link for detailed implementation :
developer.here.com/documentation/ios-premium/dev_guide/topics/audio-management.html

Python Library for Stimulating Mouse Position and Keyboard presses

Please Suggest Python Library to controll Mouse Position While Playing Games Like CS GO . I have Used PynPut ,win32api..,Both not working while playing game
The way that this works in the Win32 API is that the input commands are handled with a chain of hooks. Simply speaking the input device sends input to the OS and the OS sends input to the running applications, an application can attach itself to this hook system and choose to suppress the handled input command or pass it along the chain. In the case of some modern games, they take full control of the input chain by not passing the input commands they handle along the chain.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms644960%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

QML Shortcut Hold event

I'm working on a Qt app, and developing most of the UI in QML. It will be mostly keyboard driven, and has quite a few pages/popups. So to avoid having a potential focus scope catastrophe, I've written most of the keybindings as Shortcuts.
Some of the shortcuts are to be activated when a key is held. These keys are physical buttons on a piece of external hardware. For instance, if Physical Key 1 is pressed, do action A. If Physical Key 1 is held for 2 seconds, do action B. How would I go about doing this?

Logging queued connections

I am using a complex state engine system build with Qt 5.4 (using custom state engine classes).
Part of that code is logging of events, transitions, etc. It is very important for me to log all events the engine/state objects are receiving so I can completely track what is happening in the state engines.
For most event types logging is easy. However I failed to log queued connections (i.e. meta call events). QMetaCallEvent is private so there is not much I can do. However it is hard to believe that such an integral part of Qt can not be inspected properly.
Is there some way I missed that allows to log queued connections (including signal name, slot name, sender name, receiver name and arguments if possible)?
Install an event filter and intercept events with ev->type() == QEvent::MetaCall. All members visible in the debugger.
Need access to private headers? Use QT += core-private in your .pro file.
(tone mode="original poster")It's hard to believe that nobody reads documentation(/tone)
There is no official API that allows to do what I intend.
Inspecting QMetaCall events (using private framework headers) is a bad idea. First they are private (and may break your code any time) second the QMetaCall event sender() pointer may be invalid if sender was deleted immediately and I could not find a clean way to inspect events in such cases.
The way I am using now is totally different. Instead of inspecting the arriving event objects I am using a modified variant of QSignalSpy that allows to do more than the original class and helps logging the signal emissions using secondary connections.
In my situation this seems feasible even if it is pretty complicated and not a universal solution. At least no private headers are involved.

hastables on java card

I'm new on Java Card applications. At this moment I would like to store a hash table (dictionary) that contains the configuration of a terminal that reads this type of cards. If the hash table has values, those must be retrieved to the terminal (I think using APDU's right?) but also if there are no values, the terminal must create a "default" initial configuration.
Is it possible to do this? If it is, how? Maybe there is an applet ready for that (like Musclecard for key generation and signing) but I haven't found any.
Any advice? Thanks!
Java Card is pretty limited regarding support for data structures. It has a few basic types such as byte and short and optionally int, which is not used anywhere in the classic API. For those types you can generate two types of transient (RAM) arrays using JCSystem.makeTransientByteArray() and friends. Furthermore, the default byte[], short[] and Object[] created using new are stored in EEPROM.
The Object class in Java Card has been stripped down as well. This means that there is no such thing as hashCode(). If it was present then you would run into problems as the Java SE version of hashCode() returns an integer, which is probably not present. All defined data containers are either smart card or security related (e.g. the APDU and Key classes).
So basically, if you want to create a HashMap - the common type of dictionary on Java SE - then you will have to create it yourself. It is in that case a good idea to define a Hashable interface that classes can implement to act as a key. The structures should be generated in the right type of memory. For the kind of application you specify you probably need persistent memory, which is kind of the default for object instances created using the new key word.
Personally, I would make very sure you need a hashCode() method for your solution. It is probably easier to create an Object array and simply iterate over the elements.
Since there is no hash table in the smart card, you can store the terminal configurations in byte arrays. The smart card only stores the configuration (and optionally protect the data), and the instruction to get stored configuration or to update it shall be sent by terminal via APDU command.
Suggestion 1
Put your configuration in a Linear Fixed EF, if the card supports file system. No applet needs to be created/installed. It's the terminal job to read all records of the file to determine whether a configuration exist or not, and to write configuration into the file using standard APDU (UPDATE RECORD, READ RECORD).
NOTE:
set record length as number of terminal configuration bytes
number of records denotes the number of configurations that can be stored
you can put initial condition to indicate that the record is unused, e.g. 00...00
Suggestion 2
Create your own javacard applet. The applet must handle at least three proprietary APDUs:
Get list of terminal configurations
Update a record of terminal configuration
Delete a record of terminal configuration
NOTE:
You need to handle how to store and return the bytes between APDU format and your storage

Resources