PDA

View Full Version : ActiveQT / refresh and QAction issue



nicolas.bernard
7th September 2011, 14:26
ello,

I have a application (based on a QMainWindow) using QAction with shortcut.
I convert this QWidget so that I can use it as a COM object. Everything works great EXCEPT two things : – refresh : as it is a video player, I need to update the timecode (displayed in a QLineEdit) every times a new frame is displayed. QWidget is setted to the correct value, but there is no visual update. UIUpdate append around every 500ms or everytimes my mouse move over the widget. I try to force update (with update() method, or by doing a sendMessage( …, WM_PAINT, NULL, NULL ) on the QWidget windows handle, and on the QAxContainer windows handle but refresh is not done.

- keyboard event (and then QAction). Qaction are not triggered, KeyPressEvent() is never called. If I give focus to the QLineEdit, then keyboard is working, but if I give focus to the QMainWindow (or other control), no keyboard event is received.

This can be reproduced with the QSimpleAx sample. In the sample sample, simply add an action :


QAction *pAction = new QAction(tr("&test action..."), this);
pAction->setShortcut(Qt::Key_S);
connect(pAction, SIGNAL(triggered()), this, SLOT(about()));
setContextMenuPolicy( Qt::ActionsContextMenu );
Action will never be triggered by S key. Testing with stupid keypressevent implementation is never called :


virtual void keyPressEvent ( QKeyEvent * event )
{
about();
}
Do you have an idea to solve those two issue ? issues are the same in internet explorer 8 or testcontainer

Thanks by advance !
Nicolas,

Need to add.

App is well refreshing when set in out-process.
I resolved a part of the keyboard by setting a windows hook, parse vk key and doing QApplication::sendEvent(...) to the widget. But QAction shortcut are not triggered.

Question, is there a way to use the QKeyMapper_private to convert windows virtual key to Qt::KeyEvent ?

Thanks again...