From 643299a0edda9a523c490a276947c505da53fe14 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 4 May 2010 16:33:19 +0000 Subject: [PATCH] 2010-05-04 06:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbxbp/xbptabpage.prg ! Fixed to not generate error on right-click on a tab. --- harbour/ChangeLog | 4 ++++ harbour/contrib/hbxbp/xbptabpage.prg | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5a8571e9cf..e563d99438 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-05-04 06:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbxbp/xbptabpage.prg + ! Fixed to not generate error on right-click on a tab. + 2010-05-04 06:58 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt_errorsys.prg - Removed: Error trace copied to clipboard, it was unforeseen implementation. diff --git a/harbour/contrib/hbxbp/xbptabpage.prg b/harbour/contrib/hbxbp/xbptabpage.prg index d750f526a0..886767d8c8 100644 --- a/harbour/contrib/hbxbp/xbptabpage.prg +++ b/harbour/contrib/hbxbp/xbptabpage.prg @@ -137,6 +137,7 @@ METHOD XbpTabPage:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget := QWidget():new() ::oWidget:setContextMenuPolicy( Qt_CustomContextMenu ) + ::oWidget:setObjectName( "Tab_Page" ) oPar:oWidget:addTab( ::pWidget, ::caption ) @@ -282,6 +283,7 @@ METHOD XbpTabWidget:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::oWidget := QTabWidget():new( ::pParent ) ::oWidget:setContextMenuPolicy( Qt_CustomContextMenu ) + ::oWidget:setObjectName( "Tab_Widget" ) ::Connect( ::oWidget, "currentChanged(int)" , {|i| ::execSlot( "currentChanged(int)" , i ) } ) ::Connect( ::oWidget, "tabCloseRequested(int)" , {|i| ::execSlot( "tabCloseRequested(int)", i ) } ) @@ -314,11 +316,15 @@ METHOD XbpTabWidget:destroy() /*----------------------------------------------------------------------*/ METHOD XbpTabWidget:execSlot( cSlot, p ) - LOCAL qTab, nIndex, oTab, qPoint + LOCAL qTab, nIndex, oTab, pWidget, qPoint, qApp LOCAL iIndex IF hb_isPointer( p ) - qPoint := QPoint():from( ::oWidget:mapToGlobal( p ) ) + qPoint := QPoint():from( ::oWidget:mapToGlobal( p ) ) + qApp := QApplication():new() + pWidget := QWidget():from( qApp:widgetAt( qPoint ) ) + iIndex := ascan( ::aChildren, {|o| hbqt_IsEqualGcQtPointer( o:oWidget:pPtr, pWidget:pPtr ) } ) - 1 +HB_TRACE( HB_TR_ALWAYS, "iIndex", iIndex, pWidget:objectName() ) ELSE iIndex := p ENDIF @@ -331,7 +337,6 @@ METHOD XbpTabWidget:execSlot( cSlot, p ) DO CASE CASE cSlot == "customContextMenuRequested(QPoint)" - qPoint := QPoint():from( ::oWidget:mapToGlobal( p ) ) oTab:hbContextMenu( { qPoint:x(), qPoint:y() } ) CASE cSlot == "currentChanged(int)"