Qt-interest Archive, August 2006
mousePressEvent in QTabWidget
Message 1 in thread
Hi,
In Qt3 with
void MyQTabBar::mousePressEvent( QMouseEvent *e )
{
currentTab = selectTab(e->pos() );
...
}
I knew the clicked tab.
In Qt4, I did not find anything, how to detect which mitre is clicked?
Thanks
PS: I lost the address email of the German translator of QIde. PLEASE
write to me.
A Development Environment for Qt4: http://qide.free.fr
--
[ signature omitted ]
Message 2 in thread
currentTab = tabBar()->currentIndex(); // QTabBar *
tabBar();
....
jlbiord@xxxxxxxx wrote:
> Hi,
> In Qt3 with
> void MyQTabBar::mousePressEvent( QMouseEvent *e )
> {
> currentTab = selectTab(e->pos() );
> ...
> }
> I knew the clicked tab.
>
> In Qt4, I did not find anything, how to detect which mitre is clicked?
>
> Thanks
>
> PS: I lost the address email of the German translator of QIde. PLEASE
> write to me.
>
> A Development Environment for Qt4: http://qide.free.fr
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
--
[ signature omitted ]
Message 3 in thread
>
>
> currentTab = tabBar()->currentIndex(); // QTabBar *
> tabBar();
> ....
>
Thank you but if it's a right-click the tab clicked is not always the
current tab.
>
> jlbiord@xxxxxxxx wrote:
>> Hi,
>> In Qt3 with
>> void MyQTabBar::mousePressEvent( QMouseEvent *e )
>> {
>> currentTab = selectTab(e->pos() );
>> ...
>> }
>> I knew the clicked tab.
>>
>> In Qt4, I did not find anything, how to detect which mitre is clicked?
>>
>> Thanks
>>
>> PS: I lost the address email of the German translator of QIde. PLEASE
>> write to me.
>>
>> A Development Environment for Qt4: http://qide.free.fr
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>>
>>
>>
>
--
[ signature omitted ]
Message 4 in thread
>>
>>
>> currentTab = tabBar()->currentIndex(); // QTabBar *
>> tabBar();
>> ....
>>
> Thank you but if it's a right-click the tab clicked is not always the
> current tab.
I found a solution :
void TabWidget::mousePressEvent( QMouseEvent * event )
{
int clickedItem = -1;
for(int i=0; i<tabBar()->count(); i++)
{
if( tabBar()->tabRect(i).contains( event->pos() ) )
{
clickedItem = i;
break;
}
}
if( clickedItem == -1 )
return;
qDebug()<<clickedItem;
}
>>
>> jlbiord@xxxxxxxx wrote:
>>> Hi,
>>> In Qt3 with
>>> void MyQTabBar::mousePressEvent( QMouseEvent *e )
>>> {
>>> currentTab = selectTab(e->pos() );
>>> ...
>>> }
>>> I knew the clicked tab.
>>>
>>> In Qt4, I did not find anything, how to detect which mitre is clicked?
>>>
>>> Thanks
>>>
>>> PS: I lost the address email of the German translator of QIde. PLEASE
>>> write to me.
>>>
>>> A Development Environment for Qt4: http://qide.free.fr
>>>
>>> --
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>>> "unsubscribe" in the subject or the body.
>>> List archive and information: http://lists.trolltech.com/qt-interest/
>>>
>>>
>>>
>>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]