diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 488f4fded1..806f2e7c43 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,48 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-25 15:48 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/hbqt_misc.prg + + Implemented: object local "Slots" and "Events" management. + Now no need to setup slots and events variable. These are + automatically created on demand. + + EVENTS: + oWnd := QMainWindow():new() + + Earlier: + pEvents := Qt_Events_New() + oWnd:installEventFilter( ::pEvents ) + Qt_Events_Connect( ::pEvents, oWnd, QEventClose, {|| MsgBox( "Closing" ) } ) + Now: + oWnd:connect( QEvent_Close, {|| MsgBox( "Closing" ) } ) + + SLOTS: + oBtn := QPushButton():new() + + Earlier: + pSlots := Qt_Slots_New() + Qt_Slots_Connect( pSlots, oBtn, "clicked()", {|| ... } ) + Now: + oBtn:connect( "clicked()", {|| ... } ) + + This implementation fixes very old demand to isolate this glitch. + + * contrib/hbqt/tests/demoqt.prg + % Demonstrates the new Slots and Events management protocol. + Still a part of old proto is also retained for comparison. + + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/idereportsmanager.prg + + Renamed: IdeReportsManager() class to HbpReportsManager(). + Also made this class totally independant to hbIDE engine. + This opens up the way to shift it to hbQT itself. + The only limitation is images. We need a way to include + a minimal set of images in hbQT ( if it makes sense ) so that + this component be invoked from any application just by supplying + a parent to host it, just like a COM component. + 2010-08-26 00:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbi18n2.prg + __I18N_POTARRAYLOAD(): UTF8 BOM support diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index f8076ca41f..2da7b2f09d 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -489,7 +489,8 @@ METHOD HbIde:create( aParams ) ::oBM := IdeBrowseManager():new():create( Self ) /* Reports Manager */ - ::oRM := IdeReportsManager():new():create( Self ) + ::oRM := HbpReportsManager():new():create( ::oReportsManagerDock:oWidget ) + ::oReportsManagerDock:oWidget:setWidget( ::oRM:oWidget ) /* Fill various elements of the IDE */ ::oPM:populate() diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 6c97b096e5..16001eae18 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -452,7 +452,7 @@ METHOD IdeDocks:execEvent( cEvent, p, p1 ) SWITCH cEvent CASE "dockReportsManager_visibilityChanged" - IF p; ::oRM:show() ; ENDIF + IF p; p1:raise() ; ENDIF IF ! p .AND. ! p1:isVisible() p1:raise() ENDIF diff --git a/harbour/contrib/hbide/idereportsmanager.prg b/harbour/contrib/hbide/idereportsmanager.prg index 57f1dc00b2..377f00c1db 100644 --- a/harbour/contrib/hbide/idereportsmanager.prg +++ b/harbour/contrib/hbide/idereportsmanager.prg @@ -73,7 +73,9 @@ /*----------------------------------------------------------------------*/ -CLASS IdeReportsManager INHERIT IdeObject +CLASS HbpReportsManager + + DATA qParent DATA oWidget DATA qLayout @@ -136,10 +138,11 @@ CLASS IdeReportsManager INHERIT IdeObject DATA hObjTree INIT {=>} DATA qCurGraphicsItem - METHOD new( oIde ) - METHOD create( oIde ) + DATA nVersion INIT 0.1 + + METHOD new( qParent ) + METHOD create( qParent ) METHOD destroy() - METHOD show() METHOD execEvent( cEvent, p, p1, p2 ) METHOD buildToolbar() METHOD buildToolbarAlign() @@ -164,25 +167,18 @@ CLASS IdeReportsManager INHERIT IdeObject /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:new( oIde ) - - ::oIde := oIde - +METHOD HbpReportsManager:new( qParent ) + ::qParent := qParent RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:create( oIde ) - LOCAL qDock +METHOD HbpReportsManager:create( qParent ) - DEFAULT oIde TO ::oIde - ::oIde := oIde + DEFAULT qParent TO ::qParent + ::qParent := qParent - qDock := ::oIde:oReportsManagerDock:oWidget - - ::oWidget := QWidget():new() - - qDock:setWidget( ::oWidget ) + ::oWidget := QWidget():new( ::qParent ) /* Layout applied to RM widget */ ::qLayout := QGridLayout():new() @@ -223,20 +219,12 @@ METHOD IdeReportsManager:create( oIde ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:destroy() +METHOD HbpReportsManager:destroy() RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:show() - - ::oReportsManagerDock:raise() - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeReportsManager:buildDesignReport() +METHOD HbpReportsManager:buildDesignReport() ::qLayoutD := QHBoxLayout():new() ::qLayoutD:setContentsMargins( 0,0,0,0 ) @@ -301,7 +289,7 @@ METHOD IdeReportsManager:buildDesignReport() ::qTreeObjects:setObjectName( "ObjectsTree" ) ::qTreeObjects:setIconSize( QSize():new( 12,12 ) ) ::qTreeObjects:setIndentation( 12 ) - ::connect( ::qTreeObjects, "itemClicked(QTWItem)", {|p,p1| ::execEvent( "treeObjects_clicked", p, p1 ) } ) + ::qTreeObjects:connect( "itemClicked(QTWItem)", {|p,p1| ::execEvent( "treeObjects_clicked", p, p1 ) } ) ::qTabL1 := QTabWidget():new() ::qSplL:addWidget( ::qTabL1 ) @@ -344,6 +332,13 @@ METHOD IdeReportsManager:buildDesignReport() ::qTreeData:setHeaderHidden( .t. ) ::qTreeData:setObjectName( "DataTree" ) ::qTreeData:setDragEnabled( .t. ) + ::qTreeData:setAcceptDrops( .t. ) + //qDrop:installEventFilter( ::pEvents ) + //::connect( qDrop, QEvent_DragEnter, {|p| ::execEvent( "projectTree_dragEnterEvent", p ) } ) + ::qTreeData:connect( QEvent_DragEnter, {|p| ::execEvent( "dataTree_dragEnterEvent", p ) } ) + //::connect( qDrop, QEvent_Drop , {|p| ::execEvent( "projectTree_dropEvent" , p ) } ) + ::qTreeData:connect( QEvent_Drop , {|p| ::execEvent( "dataTree_dropEvent" , p ) } ) + ::loadReport() @@ -364,7 +359,7 @@ METHOD IdeReportsManager:buildDesignReport() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:loadReport( cName ) +METHOD HbpReportsManager:loadReport( cName ) LOCAL aSource, qItem, qItmC, aFld, a_, i, b_ DEFAULT cName TO "Report" @@ -397,19 +392,30 @@ METHOD IdeReportsManager:loadReport( cName ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:saveReport() +METHOD HbpReportsManager:saveReport() + LOCAL hDoc := {=>} + LOCAL hPage_1 := {=>} + + hDoc[ "Symposis" ] := "hbIDE Report Designer" + hDoc[ "Version" ] := ::rptVersion + hDoc[ "Author" ] := ::rptAuthor + hDoc[ "DateCreated" ] := ::rptDateCreated + hDoc[ "DateModified" ] := ::rptDateModified + + // Pages + hDoc[ "Page_1" ] := hPage_1 RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:prepareReport() +METHOD HbpReportsManager:prepareReport() RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) +METHOD HbpReportsManager:execEvent( cEvent, p, p1, p2 ) LOCAL qEvent, qMime, qItem SWITCH cEvent @@ -438,23 +444,8 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) ENDIF ELSEIF qMime:hasFormat( "application/x-toolbaricon" ) - SWITCH qMime:html() - CASE "Image" - ::addObject( QPoint():from( qEvent:scenePos() ), "Image" ) - EXIT - CASE "Chart" - ::addObject( QPoint():from( qEvent:scenePos() ), "Chart" ) - EXIT - CASE "Gradient" - ::addObject( QPoint():from( qEvent:scenePos() ), "Gradient" ) - EXIT - CASE "Barcode" - ::addObject( QPoint():from( qEvent:scenePos() ), "Barcode" ) - EXIT - CASE "Text" - ::addObject( QPoint():from( qEvent:scenePos() ), "Text" ) - EXIT - ENDSWITCH + ::addObject( QPoint():from( qEvent:scenePos() ), qMime:html() ) + ELSE ENDIF ENDCASE @@ -490,6 +481,14 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) ENDIF EXIT + CASE "dataTree_dropEvent" + + EXIT + + CASE "dataTree_dragEnterEvent" + QDragEnterEvent():from( p ):acceptProposedAction() + EXIT + CASE "buttonLandscape_clicked" ::qScene:setOrientation( QPrinter_Landscape ) EXIT @@ -541,7 +540,7 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:contextMenuScene( p1 ) +METHOD HbpReportsManager:contextMenuScene( p1 ) LOCAL qMenu, qEvent, pAct qEvent := QGraphicsSceneContextMenuEvent():from( p1 ) @@ -564,7 +563,7 @@ METHOD IdeReportsManager:contextMenuScene( p1 ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:contextMenuItem( p1, p2 ) +METHOD HbpReportsManager:contextMenuItem( p1, p2 ) LOCAL qMenu, qEvent, pAct HB_SYMBOL_UNUSED( p2 ) @@ -589,7 +588,7 @@ METHOD IdeReportsManager:contextMenuItem( p1, p2 ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:addObject( qPos, cType ) +METHOD HbpReportsManager:addObject( qPos, cType ) LOCAL oWidget, cName, nW, nH, qGrad, cCode, qStrList, i cName := cType + "_" + hb_ntos( ::getNextID( cType ) ) @@ -657,7 +656,7 @@ METHOD IdeReportsManager:addObject( qPos, cType ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:addField( qPos, cAlias, cField ) +METHOD HbpReportsManager:addField( qPos, cAlias, cField ) LOCAL oWidget, nW := 300, nH := 50 LOCAL cName := cAlias + "..." + cField @@ -684,7 +683,7 @@ METHOD IdeReportsManager:addField( qPos, cAlias, cField ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:updateObjectsTree( cType, cParent, cName, cSubType ) +METHOD HbpReportsManager:updateObjectsTree( cType, cParent, cName, cSubType ) LOCAL qParent, qItem DO CASE @@ -725,23 +724,22 @@ METHOD IdeReportsManager:updateObjectsTree( cType, cParent, cName, cSubType ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildTabBar() +METHOD HbpReportsManager:buildTabBar() ::qTabBar := QTabBar():new() - //::qTabBar:setDocumentMode( .t. ) ::qTabBar:setShape( QTabBar_TriangularNorth ) ::qTabBar:addTab( "Code" ) ::qTabBar:addTab( "Dialogs" ) ::qTabBar:addTab( "Page_1" ) - ::connect( ::qTabBar, "currentChanged(int)", {|p| ::execEvent( "tabBar_currentChanged", p ) } ) + ::qTabBar:connect( "currentChanged(int)", {|p| ::execEvent( "tabBar_currentChanged", p ) } ) RETURN Self /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildStacks() +METHOD HbpReportsManager:buildStacks() ::qStack := QStackedWidget():new() @@ -758,7 +756,7 @@ METHOD IdeReportsManager:buildStacks() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildStatusBar() +METHOD HbpReportsManager:buildStatusBar() LOCAL qLabel ::qStatus := QStatusBar():new() @@ -785,7 +783,7 @@ METHOD IdeReportsManager:buildStatusBar() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:getImageOfType( cType ) +METHOD HbpReportsManager:getImageOfType( cType ) LOCAL cImage DO CASE @@ -807,7 +805,7 @@ METHOD IdeReportsManager:getImageOfType( cType ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:getNextID( cType ) +METHOD HbpReportsManager:getNextID( cType ) STATIC hIDs := {=>} @@ -824,7 +822,7 @@ METHOD IdeReportsManager:getNextID( cType ) /* given to him. I had downloaded this code many years back */ /* and adopted to Vouch32 library and Vouch32 Active-X Server. */ -METHOD IdeReportsManager:fetchBarString( cCode, lCheck ) +METHOD HbpReportsManager:fetchBarString( cCode, lCheck ) STATIC cCars := '1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%' STATIC aBarras := { '1110100010101110',; // 1 '1011100010101110',; // 2 @@ -899,7 +897,7 @@ METHOD IdeReportsManager:fetchBarString( cCode, lCheck ) /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildToolbar() +METHOD HbpReportsManager:buildToolbar() ::qToolbar := IdeToolbar():new() ::qToolbar:orientation := Qt_Horizontal @@ -925,7 +923,7 @@ METHOD IdeReportsManager:buildToolbar() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildToolbarAlign() +METHOD HbpReportsManager:buildToolbarAlign() ::qToolbarAlign := IdeToolbar():new() ::qToolbarAlign:orientation := Qt_Horizontal @@ -970,7 +968,7 @@ METHOD IdeReportsManager:buildToolbarAlign() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildToolbarLeft() +METHOD HbpReportsManager:buildToolbarLeft() ::qToolbarL := IdeToolbar():new() ::qToolbarL:orientation := Qt_Vertical diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 13195bb1f2..9c14a24abd 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -60,10 +60,15 @@ CLASS HbQtObjectHandler VAR pPtr + VAR pSlots + VAR pEvents METHOD configure( xObject ) METHOD from( xObject ) INLINE ::configure( xObject ) + METHOD connect( cnEvent, bBlock ) + METHOD disconnect( cnEvent ) + ERROR HANDLER onError() ENDCLASS @@ -107,6 +112,44 @@ METHOD HbQtObjectHandler:onError() /*----------------------------------------------------------------------*/ +METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) + LOCAL cType := valtype( cnEvent ) + + IF cType == "C" + IF empty( ::pSlots ) + ::pSlots := Qt_Slots_New() + ENDIF + RETURN Qt_Slots_Connect( ::pSlots, ::pPtr, cnEvent, bBlock ) + + ELSEIF cType == "N" + IF empty( ::pEvents ) + ::pEvents := Qt_Events_New() + ::installEventFilter( ::pEvents ) + ENDIF + RETURN Qt_Events_Connect( ::pEvents, ::pPtr, cnEvent, bBlock ) + + ENDIF + RETURN .f. + +/*----------------------------------------------------------------------*/ + +METHOD HbQtObjectHandler:disconnect( cnEvent ) + LOCAL cType := valtype( cnEvent ) + IF cType == "C" + IF ! empty( ::pSlots ) + RETURN Qt_Slots_DisConnect( ::pSlots, ::pPtr, cnEvent ) + ENDIF + + ELSEIF cType == "N" + IF ! empty( ::pEvents ) + RETURN Qt_Events_DisConnect( ::pEvents, ::pPtr, cnEvent ) + ENDIF + + ENDIF + RETURN .f. + +/*----------------------------------------------------------------------*/ + FUNCTION hbqt_ptr( xParam ) LOCAL cClsName diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 27f94faa4b..f4827abbc8 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -109,30 +109,19 @@ EXIT PROCEDURE Qt_End() /*----------------------------------------------------------------------*/ FUNCTION My_Events() - HB_TRACE( HB_TR_ALWAYS, "Key Pressed" ) - RETURN nil /*----------------------------------------------------------------------*/ PROCEDURE Main() - Local oLabel, oBtn, oDA, oWnd, oProg, oSBar, i + Local oLabel, oBtn, oDA, oWnd, oProg, oSBar LOCAL aMenu, aTool, aGrid, aTabs, aList - //LOCAL oStyle, oSize, n, aObj := array( nLoops ) - //LOCAL nLoops := 500 s_events := QT_EVENTS_NEW() s_slots := QT_SLOTS_NEW() -HB_TRACE( HB_TR_ALWAYS, ( " " ) ) -HB_TRACE( HB_TR_ALWAYS, ( "-----------------b-----------------" ) ) - - FOR i := 1 TO 1 - oWnd := QMainWindow():new() - // hb_idleSleep( 1 ) - NEXT - + oWnd := QMainWindow():new() oWnd:show() oWnd:setMouseTracking( .t. ) @@ -160,20 +149,14 @@ HB_TRACE( HB_TR_ALWAYS, ( "-----------------b-----------------" ) ) oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) - oWnd:installEventFilter( s_events ) - QT_EVENTS_CONNECT( s_events, oWnd, 6, {|e| My_Events( e ) } ) - QT_EVENTS_CONNECT( s_events, oWnd, 19, {|| s_qApp:quit() } ) - + oWnd:connect( 6, {|e| My_Events( e ) } ) + oWnd:connect( 19, {|| s_qApp:quit() } ) oWnd:Show() s_qApp:exec() -HB_TRACE( HB_TR_ALWAYS, ( "----------------- qApp:exec -----------------" ) ) - xReleaseMemory( { oBtn, oLabel, oProg, oSBar, aGrid, aList, aMenu, aTool, aTabs, oDA, oWnd } ) -HB_TRACE( HB_TR_ALWAYS, ( "-------------------- exit -------------------" ) ) - RETURN /*----------------------------------------------------------------------*/ @@ -181,7 +164,6 @@ HB_TRACE( HB_TR_ALWAYS, ( "-------------------- exit -------------------" ) ) FUNCTION xReleaseMemory( aObj ) #if 1 LOCAL i -HB_TRACE( HB_TR_ALWAYS, ( "----------------- Releasing Memory -----------------" ) ) FOR i := 1 TO len( aObj ) IF hb_isObject( aObj[ i ] ) aObj[ i ]:pPtr := 1 @@ -189,7 +171,6 @@ HB_TRACE( HB_TR_ALWAYS, ( "----------------- Releasing Memory ---------------- xReleaseMemory( aObj[ i ] ) ENDIF NEXT -HB_TRACE( HB_TR_ALWAYS, ( "------------------ Memory Released ------------------" ) ) #else HB_SYMBOL_UNUSED( aObj ) #endif @@ -201,7 +182,7 @@ PROCEDURE ExecOneMore() Local oLabel, oBtn, oDA, oWnd, oProg, oSBar LOCAL aMenu, aTool, aGrid, aTabs, aList, oEventLoop LOCAL lExit := .f. - + oWnd := QMainWindow():new() oWnd:setMouseTracking( .t. ) @@ -217,8 +198,7 @@ PROCEDURE ExecOneMore() aMenu := Build_MenuBar( oWnd ) aTool := Build_ToolBar( oWnd ) oLabel := Build_Label( oDA, { 30,190 }, { 300, 30 } ) - oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 }, ; - "CLOSE", "This dialog will be closed now!", @lExit ) + oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 }, "CLOSE", "This dialog will be closed now!", @lExit ) aGrid := Build_Grid( oDA, { 30, 30 }, { 450,150 } ) aTabs := Build_Tabs( oDA, { 510, 5 }, { 360, 400 } ) oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) @@ -294,8 +274,8 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActNew:setText( "&New" ) oActNew:setIcon( "new.png" ) oActNew:setToolTip( "A New File" ) - /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActNew, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + oActNew:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + /* Attach Action with Toolbar */ oTB:addAction( oActNew ) @@ -304,8 +284,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActOpen:setText( "&Open" ) oActOpen:setIcon( "open.png" ) oActOpen:setToolTip( "Select a file to be opened!" ) - /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActOpen, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) + oActOpen:connect( QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActOpen ) @@ -316,68 +295,13 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActSave:setText( "&Save" ) oActSave:setIcon( "save.png" ) oActSave:setToolTip( "Save this file!" ) - /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) + oActSave:connect( oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActSave ) /* Add this toolbar with main window */ oWnd:addToolBar_1( oTB ) - /////////////////////////////////////////////////////////// -#if 0 - /* Build another toolbar - we will have two toolbats now */ - oTB := QToolBar():new( oWnd ) - - oAct := QAction():new( oWnd ) - oAct:setText( "&Colors" ) - oAct:setToolTip( "Colors Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) - oTB:addAction( oAct ) - - oAct := QAction():new( oWnd ) - oAct:setText( "&Fonts" ) - oAct:setToolTip( "Fonts Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) - oTB:addAction( oAct ) - - oTB:addSeparator() - - oAct := QAction():new( oWnd ) - oAct:setText( "&PgSetup" ) - oAct:setToolTip( "Page Setup Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) - oTB:addAction( oAct ) - - oAct := QAction():new( oWnd ) - oAct:setText( "&Preview" ) - oAct:setToolTip( "Page Preview Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) - oTB:addAction( oAct ) - - oTB:addSeparator() - - oAct := QAction():new( oWnd ) - oAct:setText( "&Webpage" ) - oAct:setToolTip( "Web Browser Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) - oTB:addAction( oAct ) - - oAct := QAction():new( oWnd ) - oAct:setText( "&Wizard" ) - oAct:setToolTip( "Generic Wizard Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) - oTB:addAction( oAct ) - - oAct := QAction():new( oWnd ) - oAct:setText( "&SystemTray" ) - oAct:setToolTip( "Show in System Tray!" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| ShowInSystemTray( oWnd, w, l ) } ) - oTB:addAction( oAct ) - - /* Add this toolbar with main window */ - oWnd:addToolBar_1( oTB ) -#endif RETURN { oActNew, oActOpen, oActSave, oTB } /*----------------------------------------------------------------------*/ @@ -394,9 +318,9 @@ STATIC FUNCTION Build_PushButton( oWnd, aPos, aSize, cLabel, cMsg, lExit ) oBtn:resize( aSize[ 1 ],aSize[ 2 ] ) oBtn:show() IF hb_isLogical( lExit ) - QT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| lExit := .t. } ) + oBtn:connect( QT_EVE_CLICKED, {|| lExit := .t. } ) ELSE - QT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) + oBtn:connect( QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) ENDIF RETURN oBtn @@ -466,7 +390,7 @@ STATIC FUNCTION Build_TreeView( oWnd ) oTV := QTreeView():new( oWnd ) oTV:setMouseTracking( .t. ) -* QT_SLOTS_CONNECT( s_slots, oTV, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oTV:hovered" ) } ) +* oTV:connect( QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oTV:hovered" ) } ) oDirModel := QDirModel():new() oTV:setModel( oDirModel ) oTV:move( 5, 7 ) @@ -482,7 +406,7 @@ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize ) oListBox := QListView():New( oWnd ) oListBox:setMouseTracking( .t. ) -* QT_SLOTS_CONNECT( s_slots, oListBox, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oListBox:hovered" ) } ) +* oListBox:connect( QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oListBox:hovered" ) } ) oStrList := QStringList():new() @@ -525,7 +449,7 @@ STATIC FUNCTION Build_Controls( oWnd ) LOCAL oEdit, oCheckBox, oComboBox, oSpinBox, oRadioButton oEdit := QLineEdit():new( oWnd ) - QT_SLOTS_CONNECT( s_slots, oEdit, QT_EVE_RETURNPRESSED, {|i| i := i, MsgInfo( oEdit:text() ) } ) + oEdit:connect( QT_EVE_RETURNPRESSED, {|i| i := i, MsgInfo( oEdit:text() ) } ) oEdit:move( 5, 10 ) oEdit:resize( 345, 30 ) oEdit:setMaxLength( 40 ) @@ -537,13 +461,13 @@ STATIC FUNCTION Build_Controls( oWnd ) oComboBox:addItem( "First" ) oComboBox:addItem( "Second" ) oComboBox:addItem( "Third" ) - QT_SLOTS_CONNECT( s_slots, oComboBox, QT_EVE_CURRENTINDEXCHANGED_I, {|i| i := i, MsgInfo( oComboBox:itemText( i ) ) } ) + oComboBox:connect( QT_EVE_CURRENTINDEXCHANGED_I, {|i| i := i, MsgInfo( oComboBox:itemText( i ) ) } ) oComboBox:move( 5, 60 ) oComboBox:resize( 345, 30 ) oComboBox:show() oCheckBox := QCheckBox():New( oWnd ) - QT_SLOTS_CONNECT( s_slots, oCheckBox, QT_EVE_STATECHANGED_I, {|i| i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) + oCheckBox:connect( QT_EVE_STATECHANGED_I, {|i| i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) oCheckBox:setText( "Testing CheckBox HbQt" ) oCheckBox:move( 5, 110 ) oCheckBox:resize( 345, 30 ) @@ -555,7 +479,7 @@ STATIC FUNCTION Build_Controls( oWnd ) oSpinBox:Show() oRadioButton := QRadioButton():New( oWnd ) - QT_SLOTS_CONNECT( s_slots, oRadioButton, QT_EVE_CLICKED, {|i| i := i, MsgInfo( "Checked" ) } ) + oRadioButton:connect( QT_EVE_CLICKED, {|i| i := i, MsgInfo( "Checked" ) } ) oRadioButton:Move( 5, 210 ) oRadioButton:ReSize( 345, 30 ) oRadioButton:Show() @@ -669,245 +593,6 @@ PROCEDURE hb_GtSys() RETURN #endif -/*----------------------------------------------------------------------*/ -/* - * Just to Link Every New Widget - */ -STATIC FUNCTION Dummies() - #if 0 - LOCAL oSome - - HB_SYMBOL_UNUSED( oSome ) - - oSome := QAbstractButton():new() - oSome := QAbstractItemModel():new() - oSome := QAbstractItemView():new() - oSome := QAbstractListModel():new() - oSome := QAbstractPrintDialog():new() - oSome := QAbstractScrollArea():new() - oSome := QAbstractSlider():new() - oSome := QAbstractSpinBox():new() - oSome := QAbstractTableModel():new() - oSome := QAction():new() - oSome := QApplication():new() - oSome := QBitmap():new() - oSome := QBoxLayout():new() - oSome := QBrush():new() - oSome := QButtonGroup():new() - oSome := QCalendarWidget():new() - oSome := QCheckBox():new() - oSome := QClipboard():new() - oSome := QColor():new() - oSome := QColorDialog():new() - oSome := QComboBox():new() - oSome := QCommandLinkButton():new() - oSome := QCommonStyle():new() - oSome := QConicalGradient():new() - oSome := QCoreApplication():new() - oSome := QCursor():new() - oSome := QDateEdit():new() - oSome := QDateTime():new() - oSome := QDateTimeEdit():new() - oSome := QDesktopWidget():new() - oSome := QDial():new() - oSome := QDialog():new() - oSome := QDir():new() - oSome := QDirModel():new() - oSome := QDockWidget():new() - oSome := QDoubleSpinBox():new() - oSome := QDropEvent():new() - oSome := QDragMoveEvent():new() - oSome := QDragEnterEvent():new() - oSome := QDragLeaveEvent():new() - oSome := QErrorMessage():new() - oSome := QEvent():new() - oSome := QEventLoop():new() - oSome := QFileDialog():new() - oSome := QFileSystemModel():new() - oSome := QFocusEvent():new() - oSome := QFocusFrame():new() - oSome := QFont():new() - oSome := QFontComboBox():new() - oSome := QFontDatabase():new() - oSome := QFontDialog():new() - oSome := QFontInfo():new() - oSome := QFontMetrics():new() - oSome := QFontMetricsF():new() - oSome := QFormLayout():new() - oSome := QFrame():new() - oSome := QFtp():new() - oSome := QGradient():new() - oSome := QGridLayout():new() - oSome := QGroupBox():new() - oSome := QHBoxLayout():new() - oSome := QHeaderView():new() - oSome := QHttp():new() - oSome := QIcon():new() - oSome := QImage():new() - oSome := QImageReader():new() - oSome := QImageWriter():new() - oSome := QInputDialog():new() - oSome := QInputEvent():new() - oSome := QIODevice():new() - oSome := QKeyEvent():new() - oSome := QKeySequence():new() - oSome := QLabel():new() - oSome := QLatin1Char():new() - oSome := QLatin1String():new() - oSome := QLayout():new() - oSome := QLayoutItem():new() - oSome := QLCDNumber():new() - oSome := QLine():new() - oSome := QLinearGradient():new() - oSome := QLineEdit():new() - oSome := QList():new() - oSome := QListView():new() - oSome := QListWidget():new() - oSome := QListWidgetItem():new() - oSome := QMainWindow():new() - oSome := QMenu():new() - oSome := QMenuBar():new() - oSome := QMessageBox():new() - oSome := QModelIndex():new() - oSome := QMouseEvent():new() - oSome := QMoveEvent():new() - oSome := QObject():new() - oSome := QPaintDevice():new() - oSome := QPageSetupDialog():new() - oSome := QPainter():new() - oSome := QPaintEvent():new() - oSome := QPalette():new() - oSome := QPen():new() - oSome := QPicture():new() - oSome := QPixmap():new() - oSome := QPoint():new() - oSome := QPointF():new() - oSome := QPrintDialog():new() - oSome := QPrintEngine():new() - oSome := QPrinter():new() - oSome := QPrintPreviewDialog():new() - oSome := QProcess():new() - oSome := QProgressBar():new() - oSome := QProgressDialog():new() - oSome := QPushButton():new() - oSome := QRadialGradient():new() - oSome := QRadioButton():new() - oSome := QRect():new() - oSome := QRectF():new() - oSome := QRegion():new() - oSome := QResizeEvent():new() - oSome := QResource():new() - oSome := QScrollArea():new() - oSome := QScrollBar():new() - oSome := QSignalMapper():new() - oSome := QSize():new() - oSome := QSizeF():new() - oSome := QSizeGrip():new() - oSome := QSizePolicy():new() - oSome := QSlider():new() - oSome := QSound():new() - oSome := QSpinBox():new() - oSome := QSplashScreen():new() - oSome := QSplitter():new() - oSome := QStandardItem():new() - oSome := QStandardItemModel():new() - oSome := QStatusBar():new() - oSome := QStringList():new() - oSome := QStringListModel():new() - oSome := QStyle():new() - oSome := QStyledItemDelegate():new() - oSome := QStyleFactory():new() - oSome := QStyleHintReturn():new() - oSome := QStyleHintReturnMask():new() - oSome := QStyleHintReturnVariant():new() - oSome := QStyleOption():new() - oSome := QStyleOptionButton():new() - oSome := QStyleOptionComboBox():new() - oSome := QStyleOptionComplex():new() - oSome := QStyleOptionDockWidget():new() - oSome := QStyleOptionFocusRect():new() - oSome := QStyleOptionFrame():new() - oSome := QStyleOptionGroupBox():new() - oSome := QStyleOptionHeader():new() - oSome := QStyleOptionMenuItem():new() - oSome := QStyleOptionProgressBar():new() - oSome := QStyleOptionSizeGrip():new() - oSome := QStyleOptionSlider():new() - oSome := QStyleOptionSpinBox():new() - oSome := QStyleOptionTab():new() - oSome := QStyleOptionTabBarBase():new() - oSome := QStyleOptionTabWidgetFrame():new() - oSome := QStyleOptionTitleBar():new() - oSome := QStyleOptionToolBar():new() - oSome := QStyleOptionToolBox():new() - oSome := QStyleOptionToolButton():new() - oSome := QStyleOptionViewItem():new() - oSome := QStylePainter():new() - oSome := QSystemTrayIcon():new() - oSome := QTabBar():new() - oSome := QTableView():new() - oSome := QTableWidget():new() - oSome := QTableWidgetItem():new() - oSome := QTabWidget():new() - oSome := QTextBlock():new() - oSome := QTextBlockFormat():new() - oSome := QTextBlockGroup():new() - oSome := QTextBrowser():new() - oSome := QTextBoundaryFinder():new() - oSome := QTextCharFormat():new() - oSome := QTextCodec():new() - oSome := QTextCursor():new() - oSome := QTextDecoder():new() - oSome := QTextDocument():new() - oSome := QTextDocumentFragment():new() - oSome := QTextDocumentWriter():new() - oSome := QTextEdit():new() - oSome := QTextEncoder():new() - oSome := QTextFormat():new() - oSome := QTextFragment():new() - oSome := QTextFrame():new() - oSome := QTextFrameFormat():new() - oSome := QTextImageFormat():new() - oSome := QTextInlineObject():new() - oSome := QTextItem():new() - oSome := QTextLayout():new() - oSome := QTextLength():new() - oSome := QTextLine():new() - oSome := QTextObject():new() - oSome := QTextStream():new() - oSome := QTimeEdit():new() - oSome := QTimer():new() - oSome := QToolBar():new() - oSome := QToolBox():new() - oSome := QToolButton():new() - oSome := QTreeView():new() - oSome := QTreeWidget():new() - oSome := QTreeWidgetItem():new() - oSome := QUrl():new() - oSome := QVariant():new() - oSome := QVBoxLayout():new() - oSome := QWebFrame():new() - oSome := QWebHistory():new() - oSome := QWebHistoryInterface():new() - oSome := QWebHistoryItem():new() - oSome := QWebHitTestResult():new() - oSome := QWebPage():new() - oSome := QWebPluginFactory():new() - oSome := QWebSecurityOrigin():new() - oSome := QWebSettings():new() - oSome := QWebView():new() - oSome := QWheelEvent():new() - oSome := QWidget():new() - oSome := QWidgetAction():new() - oSome := QWidgetItem():new() - oSome := QWindowsStyle():new() - oSome := QWindowsXPStyle():new() - oSome := QWizard():new() - - oSome := 1 - #endif - RETURN nil - /*----------------------------------------------------------------------*/ FUNCTION ShowInSystemTray( oWnd )