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

Qt-interest Archive, May 2007
[qt 4.2.2] QAction / QShortcut - slot called twice - if no breakpoint set in slot


Message 1 in thread


Hi there,

I've experienced an amazingly strange behaviour concerning a shortcut. I
create it within a widget like this:

  QShortcut* stepForwardShortCut = new QShortcut(QKeySequence(Qt::CTRL +
Qt::Key_I), this);
  connect(stepForwardShortCut, SIGNAL(activated()), this,
SLOT(stepForwardOneFrame2()));

The slot 'stepForwardOneFrame2' is definitely not connected twice in
this code. Here's the problem: When I execute the program and press the
shortcut's keys, the slots get called twice (!) - no idea why. However,
when I put a breakpoint in the slot, it only gets executed once.

Has anybody seen anything like that before? I've also tried to use a
QAction instead

  stepForwardAction->setShortcut(QKeySequence(Qt::CTRL +
Qt::RightArrow));

to no avail. Same as defining the shortcut "QKeySequence("Ctrl+I")".
Same strange behaviour. Is there another way to do it? 


Any idea might help (how to solve or find out more), I hope it's just a
silly fault on my part,
thanks in advance,
r.


--------------------------------------------------------------------
  Rene Kaiser
  Institute of Information Systems & Information Management
  JOANNEUM RESEARCH Forschungsgesellschaft mbH
  Steyrergasse 17, A-8010 Graz, AUSTRIA

  phone:  +43-316-876-1173                   fax: +43-316-876-1191
  web:    http://www.joanneum.at/iis
  e-mail: mailto:rene.kaiser@xxxxxxxxxxx
-------------------------------------------------------------------- 

--
 [ signature omitted ]