Results 1 to 5 of 5

Thread: Shortcut Context Problem

  1. #1
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Shortcut Context Problem

    When I hit "save as" in my program on OS X, and I try to type a file name with numbers in it, instead of typing the numbers in the textbox, it executes the associated shortcut in my program behing the "save as" dialog box.

    Does that make sense? I have a series of qactions inside qmenu's that have "1" "2" "3" etc... as shortcuts, and the save as and open file dialogs won't let me type those numbers.

    I am using the qshortcutmanager class from the edyuk source code, but I don't really think it is causing this problem. I tried setting each qaction's shortcut context to Qt::WidgetContext, but that didn't seem to solve the problem. I have no idea what else to try.

    Thanks for the help,

    dave

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Shortcut Context Problem

    Is the file dialog modeless? Perhaps you could make it modal?
    J-P Nurmi

  3. #3
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Shortcut Context Problem

    oh I didn't think about that. The file dialog on OS X is opening as a drawer by default. I just tried on Windows and the problem doesn't occur. I guess I can just add a Mac specific flag to make the dialog open differently.

    I also notice though, that inside a floating or docked QDockWidget that contains a QTextEdit and a QLineEdit, typing in it causes the shortcuts to highlight in the menu bar but not actually execute. I'm not sure if there is a way to make that not happen, because it is kind of distracting. The text edit box is a script editor for the program and the flashing menu bar is really distracting while the user is typing script commands.

    thanks for your help,
    dave

  4. #4
    Join Date
    Aug 2006
    Location
    Bangalore,India
    Posts
    419
    Thanks
    37
    Thanked 53 Times in 40 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Shortcut Context Problem

    I am afraid this problem will haunt me too since i had same problem with exception being the text was being typed in QGraphicsTextItem. The corresponding thread is here.

    The solution for that was to simply implement an event filter which worked for me.
    But now it looks like an event filter has to be installed to QApplication each and every time an edit control gets focus.
    Is there anything that can be done globally to change this behaviour ?
    The biggest difference between time and space is that you can't reuse time.
    -- Merrick Furst

  5. #5
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Shortcut Context Problem

    I have no idea if there is a global solution to this problem, but it strikes me as extremely odd that no one else has problems like this. This is a pretty common thing to do in an application, so it seems like there should be an easier way around this. The shortcutcontext thing was the obvious solution to me, but that didn't work at all. That's really strange.

    Thanks for your help, though, I guess I'll try out the event filter thing.

Similar Threads

  1. Context Menu on QTableWidget
    By ankurjain in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2009, 09:52
  2. Replies: 4
    Last Post: 25th June 2007, 20:40
  3. Strange shortcut problem
    By blukske in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2007, 10:26
  4. Context sensitive help
    By jpn in forum Qt Programming
    Replies: 4
    Last Post: 9th February 2007, 23:27
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.