[Qt-interest] Howto prevent usage of native winId [SOLVED]

Frank Hemer frank at hemer.org
Sun Mar 7 01:56:15 CET 2010


On Sunday 07 March 2010 00:21:09 Frank Hemer wrote:
> On Saturday 06 March 2010 15:41:48 David Ching wrote:
> > "Frank Hemer" <frank at hemer.org> wrote in message
> > news:201003061520.45766.frank at hemer.org...
> >
> > > I'm developing for tabletPC using WinXP Microsoft TabletPC Edition.
> > >
> > > On the target platform, all created widgets have a native winId (not
> > > intentionaly forces by any QApplication attribute or such).
> > > That does not happen on a plain WinXP, Linux or others.
> > >
> > > This causes several problems - as f.e. it prevents QGraphicsEffect &
> > > friends
> > > from working properly.
> > >
> > > What can be the cause of this, and how can I workaround/prevent it?
> >
> > This happens to me when I am running a screen accessibility reader like
> > JAWS.  I haven't traced the Qt Accessibility code yet, but I think on
> > startup, Qt sees if a screen reader is running and if so it generates all
> > widgets with a native HWND.  But not if no screen reader is running.
> >
> > You may want to see if the Tablet PC's accessibility reader or other
> > things are running, and trace into Qt Accessibility code.  Then let us
> > know, it would be interesting!  If this is the root cause, you can not
> > distribute the QtAccessible4.dll (I think it's name is that), or build Qt
> > with the #define QT_NOACESSIBILITY (I think it's name is that) flag, and
> > it should then work for you.
>
> Good hint - however I needed to debug on a tabletPC in order to find out
> what exactly is going wrong ... timeconsuming task that is.
>
> For now I know that indeed a call to QAccessible::updateAccessibility (...)
> is the root cause - and it is not possible to prevent this behaviour with
> simply not installing the related dll.
>
> I'm currently rebuilding qt without accessibility support and will keep you
> informed about the results. However I wonder whether this also will disable
> access to the virtual keyboard and additional pen features that come with
> the tablet edition. ... lets see ...

Since compiling qt takes a while;-), I started diging the QAccessible code ... 
and found an undocumented method thats part of the public API and that allows 
to prevent unwanted calls to QAccessible::updateAccessibility (...) without a 
recompile:

Adding:

static void MyAccessibleHandler (QObject *, int, QAccessible::Event) {
   //do nothing
}

somewhere in main.cpp, and activating it:

QAccessible::installUpdateHandler (&MyAccessibleHandler);

somewhere before initializing QMainWindow prevents the unwanted calls to winId 
and thus allows using alien widgets on win XP TabletPC edition.


Still I would be happy if anybody from Nokia could comment on this as:

* Using native instead of alien widgets seems to be of more and more 
importance as many things don't work properly with native widgets 
(QGraphicsEffect, QGraphicsProxyWidget, ...)

* This behaviour is not documented anywhere (at least I didn't find where)

* I doubt that a winid is generaly required for accessibility ... from the 
code it looks like its mainly required to forward events to win os ... but 
I'm not familiar with accessibility and accessibility will most likely never 
be of importance for my application 

Frank



More information about the Qt-interest-old mailing list