I'd like to have a little window that displays keybindings for my various abilities. I'd like for the window to update, based on which modifier key I have pressed (CTRL, ALT, SHIFT, etc). This is similar to the action bar in WoW or EQ2 that updates based on which modifier key is currently pressed.
Currently, I can see no way to have a keybinding based on just a modifier key. If it's not possible because of, say, having a CTRL keybinding interfere with a CTRL-A keybinding, then maybe events can be created that would enable us to track when a modifier key is depressed or released.
Firing on Modifier Key Keypresses
Re: Firing on Modifier Key Keypresses
Yeah. This would actually be a great thing to have, but as you suspect, is currently not possible.
It's hardly my field, though it may be possible that QT can raise an event dependent on the state of a modifier key.
Something for the request thread, perhaps?
It's hardly my field, though it may be possible that QT can raise an event dependent on the state of a modifier key.
Something for the request thread, perhaps?
Re: Firing on Modifier Key Keypresses
Key state is not accessible to my knowledge, but I don't know enough about QT.
Having a similar project in mind, the best compromise I have so far is to use toggle keys rather than modifier keys, which work alike to the action bar pages in said games. Usually these are the 1-9 keys, for Mudlet it'd be more convenient to use F1-12 however.
To implement this practicall, you have your F-keys set a variable to certain value. For example if you press F1, then a variable called modifier gets set to f1, to keep it simple. Now, on your numpad keys, you add an if statement, where if modifier is f1, you execute a certain skill. If f2, then another. You can also visualize this by having the UI update whenever an F-key is pressed. Say F1 corresponds to a page of walking keys, and F2 to a page of combat keys. If you press F1, the UI draws the walking keys, and when you press F2, it draws the combat keys. A framework like Vyzor can make this really simple to do, as you won't even have to redraw a whole element, only adjust that which changes.
Hope that makes sense! And do please go and suggest this in the request thread, would be neat to have, because in the end modifier keys > pages. And having both options = many, many more keybinds. I like keybinds, can you tell?
phasma: A quick Google shows me that QT can detect key states, but I don't know the slightest about it
Having a similar project in mind, the best compromise I have so far is to use toggle keys rather than modifier keys, which work alike to the action bar pages in said games. Usually these are the 1-9 keys, for Mudlet it'd be more convenient to use F1-12 however.
To implement this practicall, you have your F-keys set a variable to certain value. For example if you press F1, then a variable called modifier gets set to f1, to keep it simple. Now, on your numpad keys, you add an if statement, where if modifier is f1, you execute a certain skill. If f2, then another. You can also visualize this by having the UI update whenever an F-key is pressed. Say F1 corresponds to a page of walking keys, and F2 to a page of combat keys. If you press F1, the UI draws the walking keys, and when you press F2, it draws the combat keys. A framework like Vyzor can make this really simple to do, as you won't even have to redraw a whole element, only adjust that which changes.
Hope that makes sense! And do please go and suggest this in the request thread, would be neat to have, because in the end modifier keys > pages. And having both options = many, many more keybinds. I like keybinds, can you tell?
phasma: A quick Google shows me that QT can detect key states, but I don't know the slightest about it
Re: Firing on Modifier Key Keypresses
Hrm. Another problem I was having:
SHIFT-KEYPAD-2 does not seem to work. It simply binds to "undefined key".
I'm familiar with programming in Qt, but have no idea how to do it inside of Mudlet, apart from grabbing the source code and modifying the core Mudlet code myself. Which does not sound fun.
SHIFT-KEYPAD-2 does not seem to work. It simply binds to "undefined key".
I'm familiar with programming in Qt, but have no idea how to do it inside of Mudlet, apart from grabbing the source code and modifying the core Mudlet code myself. Which does not sound fun.
Re: Firing on Modifier Key Keypresses
Hm, I couldn't work out shift+keypad-2 either. Ctrl+keypad-2 works (just have numlock on), but shift+keypad-2 interprets the "2" as the down button, so it just changes the cursor to the code field. It would seem Qt is getting in the way here with it's keybinds first.
The code for this in Mudlet starts here when it sets the flag, and then on any event in the window it captures the keys.
The code for this in Mudlet starts here when it sets the flag, and then on any event in the window it captures the keys.
Re: Firing on Modifier Key Keypresses
@Vadi: Ya. I don't speak C++. My experience with Qt has been strictly limited to Python and PyQt.
I use KDE on all of my computers (but one), and I'm really hoping that we don't get screwed over with Nokia purportedly selling Qt...
I use KDE on all of my computers (but one), and I'm really hoping that we don't get screwed over with Nokia purportedly selling Qt...
Re: Firing on Modifier Key Keypresses
Here's a list of keycodes:
http://doc.qt.nokia.com/4.7-snapshot/qt.html#Key-enum
The shift key is looked for. I'll see if it works right on windows, and check if a work-around is possible.
http://doc.qt.nokia.com/4.7-snapshot/qt.html#Key-enum
The shift key is looked for. I'll see if it works right on windows, and check if a work-around is possible.