Qt in AI Panel on MAC: Keyboard events/focus issue

My plugin has panels that use Qt for UI, runs fine on windows. But on mac (qt embedded in panel using QMacNativeWidget) , QLineEdit and other components do not seem to receive focus, nor are processing keyboard events. I cannot type into the text boxes or navigate through tree widget.
From Qt forums, seems like it is a known issue. Has anybody faced this issue, found a solution for this?
Qt: 4.8.6
OS: Mac os maveric
Illustrator: CC

There is a crude workaround that seems to work for me.
I subclass QLineEdit and override QWidget::macEvent for detecting mouse events. On a button press I activate
the window and set the focus manually:
#include <Carbon/Carbon.h>
bool MyLineEdit::macEvent ( EventHandlerCallRef caller, EventRef event )
if(GetEventClass(event) == kEventClassMouse) {
   if(GetEventKind(event) == kEventMouseDown) {
      activateWindow();
      setFocus(Qt::OtherFocusReason);
  return false;
I admit that this is not a perfect solution, but at least it gives you /some/ sort of usable behaviour.

Similar Messages

  • SWT_AWT mouse/keyboard event trouble

    Hello everyone,
    I have created an ActiveX Component with Visual C++ that uses a WEmbeddedFrame to contain a Swing based GUI. I have copied the code from the SWT_AWT class in the SWT toolkit and it worked fine up to JDK 1.5.0_03.
    Starting with JDK 1.5.0_04 the Swing GUI does no longer receive Mouse/keyboard events.
    I have read through all available material concerning this problem and I have tried the two possible solutions that these documents suggest:
    - called addNotify() on the embedded frame
    - inserted a heavyweight container (java.awt.Panel) between Embedded Frame and the Swing GUI
    However, no luck. The GUI displays fine but does not respond to user actions.
    Does anybody have an idea what might have changed from 1.5.0_03 to 1.5.0_04, that could help me solve this puzzle?
    Thank you very much in advance,
    Helmut

    SWT works up to 1 tree and two text components only. If you have more than that, you windows will get tainted. Basically it's useless to wirte any useful programs for Windows. You never get comaptible latest look from it both mac and windows. Don't waste time for learning it. You better spend time for learning other things. If AWT/Swing is not good enough, learn native languages such as Visual C++/Basic! I have to say SWT wasn't meant to give us better programming platform!

  • Mac Keyboard Functions Don't Work

    I have just discovered that the Mac keyboard has a very useful feature: press and hold a key and all the options for that character show in a little pop-up window, i.e., accents, tilde's, etc. This works in all my other programs (Word, Excel, Pages, Mail, etc.), but not in Adobe's Illustrator or InDesign. I do a project every summer that has lots of foreign names and words, and I am constantly having to ferret out these unusual characters, so having them all available right on the keyboard would be a huge time saver for me, so I was devastated to learn that Adobe's programs don't support them (when I press and hold a keyboard key in InDesign, it just repeats the character over and over as long as I hold the key down, which is the way the keyboard worked several Apple systems ago). Is there a preference or something somewhere that I am missing?

    While InDesign and Illustrator don't have access to the Apple feature to show special characters, you have an even better feature in InDesign and Illustrator—the Glyphs panel. It lets you view every character (glyph) in every font on your computer. You can insert a character by double clicking it. In InDesign, choose Type > Glyphs to open it up. Use the font menu at the bottom to switch fonts. Choose from the Show menu in the middle some collections of special characters for different purposes.

  • Capture a keyboard event on af:panelGridLayout?

    Hi,
    <af:panelGridLayout> currently supports a client listener with mouse events.
    But I have a requirement where I need to capture keyboard events.
    I tried adding an invisible inputText component on the page and focus on it onclick of the panel.
    My assumption was that when the inputText is on focus, it should be able to capture keyboard events even though its invisible.
    This does not work. Please see code below. The "showAlert" javascript method never gets called.
    <af:inputText clientComponent="true" visible="false" value="dummy" id="keyLink">
         <af:clientListener method="showAlert" type="keyUp"/>
    </af:inputText>
    <af:panelGridLayout id="pgl3">
        <af:clientListener method="toggleRowSelection" type="click"/>
    </af:panelGridLayout>Javascript code:
    function showAlert(event) {
        alert("javascript event " + event.getKeyCode());
    function toggleRowSelection(event) {
        var source = event.getSource();
        var keyLink = source.findComponent("::keyLink");
        keyLink.focus();
        callServerMethod(event);
    };How do I achieve this?
    -Anitha

    "[email protected]" <[email protected]> wrote in message news:[email protected]..
    I have figured out how to add menu Item to an existing EXE program, but I have not yet been able to figure out how to capture there events.&nbsp; Any help would be greatly appreciated.
    It's not entirely clear what you are trying to acieve. I think you're trying to add menu items to an exsisting exe without recompiling it, from LabVIEW. If so the following applies.
    You have to hook the winproc. When a menu item is selected, windows send a message to the window's winproc. There are some API's that can be used to point the address of the winproc to another routine. This routine can do filtering, and then call the original routine.
    Note that LabVIEW doesn't (or didn't until LV7) use windows menu's, so when a LabVIEW (or exe created with LabVIEW) menu item is called, windows will not send anything. That is the price for platform independency.
    I think the OpenG site (or perhaps Winutils from NI) has some vi's to hook windows messages that are send to LabVIEW. Perhaps you can also use them hook another application.
    Regards,
    Wiebe.

  • Why no Keyboard event?

    Hi,
    Must be interpreting something wrong :-[.
    public class LogInPanel extends JPanel
                            implements ActionListener,
                                       KeyListener,
                                       Observer {
         public LogInPanel (MyModel theModel){
              model = theModel;
              model.addObserver(this);
              // Create okButton and add it to the layout
              JComponent okButton = createButtonPanel();
              add(okButton);
              addKeyListener(this);
            // This method receives OK-button pressed events
         public void actionPerformed(ActionEvent event) {
              command = event.getActionCommand();
              if (OK.equals(command))
                   checkFieldsAndLogIn();
         public void keyTyped(KeyEvent ke) {
              System.out.println ("LogInPanel.keyTyped, the " + ke.getKeyLocation() + " key was pressed");
              int keyCode = ke.getKeyCode();
              if ( keyCode == KeyEvent.VK_ENTER) {
                   // Do something, like log in.
              // Make sure  the key isn't processed for anything else
              ke.consume();
         private JComponent createButtonPanel() {
              JPanel panel = new JPanel(new GridLayout(0,1));
              JButton okButton = new JButton("OK");
              okButton.setActionCommand(OK);
              okButton.addActionListener(this);
              panel.add(okButton);
              return panel;
         }Nothing is outputted to the console. What am I doing wrong?
    TIA
    Abel
    Edited by: Abel on Jan 25, 2008 3:58 PM
    Added example of ActionListener

    That could possibly work. But, alas, no keyboard events happen in my code. I have println's in my code, and nothing is written to the console.
         public void keyTyped(KeyEvent ke) {
              System.out.println ("LogInPanel.keyTyped, the " + ke.getKeyLocation() + " key was pressed");
              if ( ke.getKeyChar() == KeyEvent.VK_ENTER) {
                   System.out.println ("LogInPanel.keyTyped, the ENTER key was pressed");
         public void keyReleased(KeyEvent ke) {
              System.out.println ("LogInPanel.keyReleased, key " + ke.getKeyCode() + " was released");
          * User has pressed the Enter key, call <code>checkFieldsAndLogIn</code>
         public void keyPressed(KeyEvent ke) {
              System.out.println ("LogInPanel.keyPressed, key " + ke.getKeyCode() + " was pressed");
         }I think this is caused by my LogInPanel not having the focus. If you have a suggestion in that area, I would be obliged. But thanks for your help until now.
    Abel

  • Keyboard Events on Symbols - Accessibility

    I'm VERY new to Adobe Edge Animate, although I do have a good deal of HTML, CSS and JavaScript experience.
    I'm currently working on a website within Adobe Edge and need to make the website accessible .. or at least as accessible as possible.  This can be broken up into 2 steps as I see it.
    Currently I have several main menu items at the top of the site.  Each has it's own set of sub menu items.  To make this accessible, I need to have it setup so that when a user presses tab and focuses on a symbol, the corresponding drop sub menu items are displayed as well.  This in turn will force the next tab key press to go to the first sub menu item and not the next main menu item.  I have this done by simply adding an action to the Symbol's focus event.  No problem here.
    Next, when a user tabs to a main or sub menu item and presses ENTER on the keyboard, I need to have it perform the same action as if the user had pressed a mouse click.  How do I go about doing that?  I would have assumed there would have been keyboard events as well and not just mouse/touch event?
    Any ideas on how I can get this to work?  Perhaps I'm missing something on how to make an Adobe Edge site truly accessible?
    Thanks!
    Ol

    Thanks for your reply!  I appreciate it. 
    As best I can gather so far is that I can add java script code throughout the project but I'm a little confused as to where to add certain code.  So for my example and your response ... where would I add said code?  It doesn't look like I can add it to the symbol's action panel ...

  • Keyboard events going to InDesign and not on textbox

    Hi,
    I have ported a project from InDesign CS2 to InDesgn CS3 on Mac. I have dialogs in rsrc file (not converted to nib file) which I am also using on XCode.
    Now the problem which I am facing is that when typing in a textbox then keyboard events are going to InDesign and only those events which are not handled by InDesign is received by my textbox.
    Has anyone experienced the same problem before?
    Any help will be appreciated.
    Regards,
    Rahul Rastogi

    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).<br />
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]<br />
    <br />
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.<br />
    You can use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.<br />
    You have to close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")

  • How to receive a keyboard event (arrowkeys)

    Hi,
    I'm a bit confused about how to setup event-handling for keyboard event. I have created a window with a File's Owner called "MyDocument". But if I implement the method
    <pre>
    -(void)sendEvent: (NSEvent *)theEvent {
    printf("Called\n");
    </pre>
    it wont be called. Does anyone know what else I have to do in order to receive keyboard events when a user presses an arrowkey inside my application ?
    Macbook Pro 15''   Mac OS X (10.4.8)   2GHz, 2GB

    You most likely need to implement -(void)keyDown:(NSEvent *)event to catch keyboard events and then query event for the key pressed. This method is defined in NSResponder together with mouseDown:, mouseDragged, keyUp:, etc.
    Here's a couple of examples from two sample apps:
    'Dicey' (online sample code):
    <pre>
    -(void)keyDown:(NSEvent *)event {
    // If the space bar was pressed, toggle hold on the first responder
    if ([[event characters] isEqualToString:@" "]) {
    [[dice objectAtIndex:firstResponderIndex] toggleHold];
    [self setNeedsDisplay:YES];
    } else {
    // We do care about our superclass dealing with tab shift-tab for first responder changes
    [super keyDown: event];
    </pre>
    'Worm' (From: /Developer/Examples/AppKit/Worm):
    <pre>
    - (void)keyDown:(NSEvent *)event {
    NSString *keys = [event charactersIgnoringModifiers];
    wormHeading = kGameHeadingStraight;
    if (keys && [keys length] > 0) {
    unichar c = [keys characterAtIndex:0];
    if (c == NSLeftArrowFunctionKey) {
    wormHeading = kGameHeadingLeft;
    } else if (c == NSRightArrowFunctionKey) {
    wormHeading = kGameHeadingRight;
    </pre>
    Note the use of NSLeftArrowFunctionKey for example in Worm. These and many other 'special' key constants are defined in NSEvent.

  • By default, on a mac keyboard F3 lets you see all the open apps and the such. However, I changed it so that I use those keys for keyboard shortcuts; But i'd like the normal F3 key to still work without me having to press FN.

    By default, on a mac keyboard F3 lets you see all the open apps and the such. However, I changed it so that I use those keys for keyboard shortcuts; But i'd like the normal F3 key to still work without me having to press FN.

    rajlego,
    in the Keyboard pane of System Preferences, select the Shortcuts tab, and then select Mission Control on the left-hand side. On the right-hand side, make sure that the Mission Control checkbox is checked, double-click on its current key combination (by default “^↑”) so that the key combination is highlighted, and then press the F3 button — that will set its shortcut to be F3. You can now press F3 to bring up Mission Control without needing to also press the Fn button.

  • Using a Mac Keyboard on a PC?

    Does anyone know if its possible to use a mac keyboard on a PC? If so, are there drivers that Windows will require in order for it to function properly, or will Windows treat it like any other keyboard?
    Before you even ask why I would do this...I really like the new Apple keyboard and would like to buy one for work to use as my main keyboard there as well.
    thanks

    Hey, I run an Apple keyboard on a Windows machine all the time.. I assumed you are talking about a newer keyboard as I don't have much experience beyond 3 years ago keyboards.. It works fine.. Of course some of the Apple specific keys such as Command don't have a special meaning in the Windows environment but the keyboard has Alt and Control which are commonly used..
    No drivers necessary.. Just works...

  • I have remote locked my mac using find my iPhone app via my iPad - I am unable to enter the unlock code as the mac keyboard won't pair with the mac - I guess that will teach me for playing...any ideas?

    I have remote locked my mac using find my iPhone app via my iPad - I am unable to enter the unlock code as the mac keyboard won't pair with the mac - I guess that will teach me for playing...any ideas?

    Thought so - ace - find my phone really needs an unlock function. - another £40...

  • MAC Keyboard - Works on a PC but not my MAC

    Yup... makes no sense huh?
    I bought a used MAC G4 Quicksilver, came with mouse and keyboard. I plug the keyboard in and all works fine, except the "END" key and the "NumLock" key... maybe a few other but haven't noticed yet, just these two so far. Numeric pad displays numbers when typed, letters are fine...
    I plus the MAC keyboard into my PC and works fine, can toggle the NumLock light on/off and the END key brings my cursor to the end of sentences I am typing.
    My PC keyboard is PS/2 so, can't see how it works on the MAC.
    I have since formatted the system and reinstalled MAC OS 10.4.4 and applied the 10.4.6 update and still the same issue.
    Main problem I have now is I bought a TrippLite USB KVM switch so that I can alternate between systems and of all the luck, the hotkey to switch systems back/forth is to hit the NumLock key twice fast. I can switch to the MAC then I can't switch back because the NumLock key doesn't work in MAC.
    Anyone have any ideas? I'm new to MAC but find it ironic that the MAC keyboard detects and works fine on a PC and not on a MAC.
    Thanks
    Power Mac G4 933Mhz (Quicksilver 2002)   Mac OS X (10.4.6)   AGP MX4 64meg Video, Superdrive, 256meg Ram

    Anyone at all? Any settings or anything to be set? Nothing?

  • My iMac keeps typing a minus sign. I switched my wireless keyboard for a plug in Windows keyboard, and it keeps typing this one character. I took the batteries out of the Mac keyboard, so that is not the problem. I am running Mac OS X 10.6.8.

    my iMac keeps typing a minus sign. I switched my wireless keyboard for a plug in Windows keyboard, and it keeps typing this one character. I took the batteries out of the Mac keyboard, so that is not the problem. I am running Mac OS X 10.6.8. In parallels, I don't have any problem, just on the Mac platform.

    tebasj wrote:
    Thanks for your observation. I realize they are different versions, but when I use the "Software Update" menu, this is as far as it would update. Is there some way to update the iMac beyond what "Software Update" does? I've tried it several times.
    Please Note.
    Upgrading OSX 10.6.8 (Snow Leopard) to 10.8.3 (Mountain Lion) is not an update. It is a paid upgrade. Just as with 10.7 (Lion) you must purchase it from the App Store with yor Apple ID and install it after backing up your current computer state for safety.
    Cheers
    Pete

  • Cannot pair my mac keyboard to apple tv 2

    I have no problem connecting any wireless devices in my home.  trying to connect or pair  my mac keyboard to apple tv, through bluetooth and it doesn't pick up any signal for the keyboard.

    I have a 21.5 " Mac with 2.7 Ghz. I don't see a model name on the keyboard itself. DG733951RXNDPQYAR is stamped on the back don't know if that helps or not.

  • Flex 4 does not dispatch keyboard events for ENTER key.

    Hello everyone. I think I have a strange problem with Flex 4 Beta (4.0.0.8909). My application has had event listener for keyUp event for a month now and suddenly (two days ago) I've noticed that keyUp event is not dispatched for ENTER (ALT also) key. Anyone know why? By the way, I've tried this with keyDown event, also 4.0.0.8847 version of SDK - still the same: no keyboard events for ENTER (and ALT) key.
    Here is the sample application that has got this issue:
    <s:Application
       xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/halo"
       minWidth="640" minHeight="480"
       keyUp="application1_keyUpHandler (event)">
       <fx:Script>
          <![CDATA[
             import mx.controls.Alert;
             protected function application1_keyUpHandler (event: KeyboardEvent):void
                Alert.show ("Key up: " + event.keyCode);
          ]]>
       </fx:Script>
       <s:layout>
          <s:BasicLayout/>
       </s:layout>
       <s:TextArea verticalCenter="0" horizontalCenter="0" width="200"/>
    </s:Application>
    If you run this application and try typing anything in a TextArea you will get alerts with key codes. However, if you press ENTER (or ALT), you will get no alert.
    I'm pretty sure the code above is right so that means there is a bug in latest nightly builds of SDK (i would swhitch to an older build if i knew which one does not have this bug).
    Any ideas?

    Flex harUI wrote:
    That's true, but in this case, I think the text editing code is eating ENTER key in order to prevent parents from seeing it and acting on it (like a submit button).  We'll see if we can find a way around that.
    You can get the ENTER key now by listening in capture phase.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui
    The enter key isn't being disposed of by textedit, the attached example code works without error if you a- remove the alert box and b-set the focus to your text area on initialisation. I agree that pressing the enter key then calling a dialog box will result in the enter key being "gobbled up" as  the enter key is overridden by the dialog box code.
    I think the first suggestion should be to anyone don't use dialogboxes for testing code. If for some reason debugging isn't desirable instead of a trace statement a simple label  can be used as a 'fake' trace.
    David
    Message was edited by: David_F57: I worded this wrong, imho there is no need for a work around, the textarea component works as it should. When intercepting 'system' keycodes there is a need to consider the effect of the intercept and code appropriately to that end.

Maybe you are looking for

  • How to sent multiple files

    Sir, i need to sent more one files to Server(deployed in TOMCAT) and recive respected files in server side, do separate the files and store it directory. 1)Here My doubt is How to separate files using any boundry value? 2)With out using SOAP is there

  • Open items not appearing in T code F-26

    Hi Gurus, We are on ECC6.0. We are able to see open items in FBL5N but few items are not showing on T code F-26. Please advice. Govind

  • XML-OPP issue with report

    We have following issue while running/generating XML report. "The output post-processor will be made to post-process this request. No further attempts will be made to post-process this request, and the request will me marked with warning status. Sett

  • Syntax error in standard program after upgrade

    Hi, After upgrade from 7.0 to 7.3, we are facing a syntax error in standard program that is used in one of our process The error says: The field "G_REQUIDPARENT" is unknown, but there is a field with the s" imilar name "G_REQUID_LAST". "G_REQUID_LAST

  • How to know when iTunes Match is expiring

    How can I tell when iTunes Match is expiring