Michael Pyne wrote:

>> const QToolBox* tb = (const QToolBox*) widget;
>> int index = tb->indexOf( tb->childAt( QPoint(left, top) ) );


>> 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 == -1 as if it was out of its parent.


> Is the QRect being passed to your style function in global coordinates or
> widget coordinates?


I guess it's in widget coordinates since (top left) is always (0,0).

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

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

I think I tried all available mappings... but that shouldn't be
necessary since it works better without them and I already get valid
indexes --with the stupid limitations I mentioned hereabove. I say
"stupid" because there's something really strange in the fact that it
won't work twice for the same (selected) tab.

Besides, there's something wrong with the mappings. All the tabs have
the same widget coordinates... and also the same mapped coordinates. I
tried to work with the coordinates, thinking it should be easy to find
this way if a tab is at the top of its toolbox parent, at the bottom or
none of the two. It didn't lead me much further than indexOf().

I'm kinda running out of imagination.

Remi Villatel

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