I use QAxWidget to wrap an ActiveX control, since the container QWidget needs to customize the KeyPressEvent, so I have inherited from QAxWidget and overridden translateKeyEvent(int message, int keycode), but this function never called. here is the codes:
class CXXXAxWidget : public QAxWidget
{
public:
CXXXAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0)
: QAxWidget(parent, f)
{
}
protected:
virtual bool translateKeyEvent(int message, int keycode) const;
};
bool CXXXAxWidget::translateKeyEvent(int message, int keycode) const
{
//log
if (message == WM_KEYDOWN)
return true;
else
return QAxWidget::translateKeyEvent(message, keycode);
}
Bookmarks