Content-Type: multipart/signed;
Content-Transfer-Encoding: 7bit

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Friday 24 February 2006 22:47, Remi Villatel wrote:
> Hi there,
> I'm having a big problem with my style and QToolbox. I'm looking for a
> way to get the index of the toolbox tab I'm drawing.
> Here is something that should work:
> const QToolBox* tb =3D (const QToolBox*) widget;
> int index =3D tb->indexOf( tb->childAt( QPoint(left, top) ) );
> widget is of course the parent widget of the pseudo-tab according to Qt
> sources and (left, top) comes from the drawing rectangle passed to
> mystyle::drawControl().
> The problem is that it works only once --when the toolbox tab is
> selected-- then never again. When a pseudo-tab is selected for the
> second time, index =3D=3D -1 as if it was out of its parent.
> I know the widgets are reordered in a toolbox when opened/close but that
> doesn't explain anything. If I can get the index once, why not every
> time and for the not selected pseudo-tabs too?

Is the QRect being passed to your style function in global coordinates or=20
widget coordinates? Global coordinates are given with respect to the scree=
(0, 0) being upper left. Widget coordinates are with respect to the widget=
in question, (0, 0) being the upper left of the widget, which could be (113=
79) in global coordinates.

Some functions that use QRect expect global coordinates, so if the QRect=20
passed to you is in widget coordinates that could explain things.

It may help for debugging to construct a helper application that uses a=20
QToolbar and overrides the mouse move event to try and report what tab the=
mouse is under to see if you need global or widget coordinates.

To switch between the different kinds, QWidget has a mapToGlobal() and a=20
mapFromGlobal() call.

- Michael Pyne

Content-Type: application/pgp-signature

Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBEAhFzqjQYp5Omm0oRAtpuAJ0bTKSczVhTKDj8QU05Ln gkdY0SbACfUEMr


Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<