--===============0878130314==
Content-Type: multipart/signed;
boundary="nextPart8413074.KcrftALE3q";
protocol="application/pgp-signature";
micalg=pgp-sha1
Content-Transfer-Encoding: 7bit

--nextPart8413074.KcrftALE3q
Content-Type: text/plain;
charset="iso-8859-1"
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=
n=20
(0, 0) being upper left. Widget coordinates are with respect to the widget=
=20
in question, (0, 0) being the upper left of the widget, which could be (113=
,=20
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=
=20
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.

Regards,
- Michael Pyne

--nextPart8413074.KcrftALE3q
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQBEAhFzqjQYp5Omm0oRAtpuAJ0bTKSczVhTKDj8QU05Ln gkdY0SbACfUEMr
xaeajX8XZeqnE/j93I3++tE=
=drm0
-----END PGP SIGNATURE-----

--nextPart8413074.KcrftALE3q--

--===============0878130314==
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 <<


--===============0878130314==--