Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, December 2006
QAction keyboard shortcuts not working


Message 1 in thread

I am writing application in QT 4.2.2 (GPL edition, windows) and I stumbled
across strange problem.

In helper class, called from main window constructor I construct menu based on
config file in manner like this:

  QAction *menu_item=new QAction(menu_item_caption,main_window);
  itemId->setData(script_code);
  //parent_menu is a menu inserted directly into main window's menubar
  parent_menu->addAction(menu_item);
  itemId->setShortcut(QKeySequence(accel));

in main window constructor I call:

  connect(menubar(), SIGNAL(triggered(QAction *)),
                     SLOT(menuActivated(QAction*)));

// menuActivated will execute "script_code"

When I select the item from menu, it works (also, shortcut is written near the
item and menuActivated is called via that slot), but pressing the shortcut
does not work as expected (nothing happens, menuActivated is not called)

Martin Petricek

--
 [ signature omitted ]