From 238893024f712ec0955bebe06f582fee19813254 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 7 Aug 2012 00:12:34 +0000 Subject: [PATCH] 2012-08-06 17:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/sources.prg % Remoded: redundant code parts and organized with more options. * contrib/hbqt/qtgui/hbqtgui.hbx * contrib/hbqt/qtgui/qth/filelist.hbm + contrib/hbqt/qtgui/qth/QToolTip.qth + Added: class QToolTip(). Note that this class is usable from within QEvent_ToolTip signal which will post QHelpEvent() object like: oWidget:connect( QEvent_ToolTip, {|oEvent| ::execEvent( QEvent_Help, oEvent ) } ) Then METHOD myClass:execEvent( nEvent, oEvent ) LOCAL oToolTip IF oEvent:type() == QEvent_ToolTip oToolTip := QToolTip() oToolTip:setText( "some other text" ) RETURN .T. /* To stop the event chain */ ENDIF RETURN .F. --- harbour/ChangeLog | 20 ++++ harbour/contrib/hbide/sources.prg | 23 +++-- harbour/contrib/hbqt/qtgui/hbqtgui.hbx | 2 + harbour/contrib/hbqt/qtgui/qth/QToolTip.qth | 100 ++++++++++++++++++++ harbour/contrib/hbqt/qtgui/qth/filelist.hbm | 1 + 5 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 harbour/contrib/hbqt/qtgui/qth/QToolTip.qth diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 848a1b6857..b832ce8d60 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,26 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-06 17:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/sources.prg + % Remoded: redundant code parts and organized with more options. + + * contrib/hbqt/qtgui/hbqtgui.hbx + * contrib/hbqt/qtgui/qth/filelist.hbm + + contrib/hbqt/qtgui/qth/QToolTip.qth + + Added: class QToolTip(). Note that this class is usable from within + QEvent_ToolTip signal which will post QHelpEvent() object like: + oWidget:connect( QEvent_ToolTip, {|oEvent| ::execEvent( QEvent_Help, oEvent ) } ) + Then + METHOD myClass:execEvent( nEvent, oEvent ) + LOCAL oToolTip + IF oEvent:type() == QEvent_ToolTip + oToolTip := QToolTip() + oToolTip:setText( "some other text" ) + RETURN .T. /* To stop the event chain */ + ENDIF + RETURN .F. + 2012-08-04 21:56 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/tools.prg + Implemented: removal of a editng panel with confirmation. diff --git a/harbour/contrib/hbide/sources.prg b/harbour/contrib/hbide/sources.prg index 9a3c54bf51..08b72b5d71 100644 --- a/harbour/contrib/hbide/sources.prg +++ b/harbour/contrib/hbide/sources.prg @@ -483,17 +483,27 @@ METHOD IdeSourcesManager:openSource() /*----------------------------------------------------------------------*/ METHOD IdeSourcesManager:selectSource( cMode, cFile, cTitle, cDftPath ) - LOCAL oDlg, cPath + LOCAL oDlg, cPath, aFltr := {} DEFAULT cDftPath TO ::cLastFileOpenPath + AAdd( aFltr, { "All Files" , "*.*" } ) + AAdd( aFltr, { "PRG Sources", "*.prg" } ) + AAdd( aFltr, { "C Sources" , "*.c" } ) + AAdd( aFltr, { "CPP Sources", "*.cpp" } ) + AAdd( aFltr, { "H Headers" , "*.h" } ) + AAdd( aFltr, { "CH Headers" , "*.ch" } ) + AAdd( aFltr, { "UI Files" , "*.ui" } ) + AAdd( aFltr, { "QRC Files" , "*.qrc" } ) + AAdd( aFltr, { "HBC Files" , "*.hbc" } ) + oDlg := XbpFileDialog():new():create( ::oDlg, , { 10,10 } ) IF cMode == "open" oDlg:title := "Select a Source File" oDlg:center := .t. - oDlg:fileFilters := { { "All Files" , "*.*" }, { "PRG Sources", "*.prg" }, { "C Sources" , "*.c" },; - { "CPP Sources", "*.cpp" }, { "H Headers" , "*.h" }, { "CH Headers", "*.ch" } } + oDlg:fileFilters := aFltr + cFile := oDlg:open( cDftPath, , .f. ) IF !empty( cFile ) ::oIde:cLastFileOpenPath := cFile @@ -503,8 +513,8 @@ METHOD IdeSourcesManager:selectSource( cMode, cFile, cTitle, cDftPath ) oDlg:title := "Select Sources" oDlg:center := .t. oDlg:defExtension:= 'prg' - oDlg:fileFilters := { { "All Files" , "*.*" }, { "PRG Sources", "*.prg" }, { "C Sources" , "*.c" },; - { "CPP Sources", "*.cpp" }, { "H Headers" , "*.h" }, { "CH Headers", "*.ch" } } + oDlg:fileFilters := aFltr + cFile := oDlg:open( cDftPath, , .t. ) IF !empty( cFile ) .AND. !empty( cFile[ 1 ] ) ::oIde:cLastFileOpenPath := cFile[ 1 ] @@ -523,8 +533,7 @@ METHOD IdeSourcesManager:selectSource( cMode, cFile, cTitle, cDftPath ) Endif Endif - oDlg:fileFilters := { { "PRG Sources", "*.prg" }, { "C Sources", "*.c" }, { "CPP Sources", "*.cpp" }, ; - { "H Headers", "*.h" }, { "CH Headers", "*.ch" } } + oDlg:fileFilters := aFltr cFile := oDlg:saveAs( cPath ) ELSE diff --git a/harbour/contrib/hbqt/qtgui/hbqtgui.hbx b/harbour/contrib/hbqt/qtgui/hbqtgui.hbx index 18ae37cfc8..a8074e3295 100644 --- a/harbour/contrib/hbqt/qtgui/hbqtgui.hbx +++ b/harbour/contrib/hbqt/qtgui/hbqtgui.hbx @@ -290,6 +290,7 @@ DYNAMIC HB_QTIMEEDIT DYNAMIC HB_QTOOLBAR DYNAMIC HB_QTOOLBOX DYNAMIC HB_QTOOLBUTTON +DYNAMIC HB_QTOOLTIP DYNAMIC HB_QTRANSFORM DYNAMIC HB_QTREEVIEW DYNAMIC HB_QTREEWIDGET @@ -551,6 +552,7 @@ DYNAMIC QTIMEEDIT DYNAMIC QTOOLBAR DYNAMIC QTOOLBOX DYNAMIC QTOOLBUTTON +DYNAMIC QTOOLTIP DYNAMIC QTRANSFORM DYNAMIC QTREEVIEW DYNAMIC QTREEWIDGET diff --git a/harbour/contrib/hbqt/qtgui/qth/QToolTip.qth b/harbour/contrib/hbqt/qtgui/qth/QToolTip.qth new file mode 100644 index 0000000000..d0fab8c003 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/qth/QToolTip.qth @@ -0,0 +1,100 @@ +/* + * $Id$ + */ + +/* + * Harbour Qt wrapper generator control file + * + * Copyright 2009-2012 Pritpal Bedi + * www - http://www.harbour-project.org + * + * See COPYING for licensing terms. + */ + + +Inherit = +New = +QObject = no + + + +#include + + +/* + * QToolTip() + * ~QToolBox () + */ +HB_FUNC( QT_QTOOLTIP ) +{ + HB_FUNC_EXEC( HB_QTOOLTIP ); +} + + + +QFont font (){ + hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, new QFont( QToolTip::font() ), "HB_QFONT", hbqt_del_QFont, HBQT_BIT_OWNER ) ); +} +void hideText (){ + QToolTip::hideText(); +} +bool isVisible (){ + hb_retl( QToolTip::isVisible() ); +} +QPalette palette (){ + hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, new QPalette( QToolTip::palette() ), "HB_QPALETTE", hbqt_del_QFont, HBQT_BIT_OWNER ) ); +} +void setFont ( const QFont & font ){ + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "HB_QFONT" ) ) + { + QToolTip::setFont( *hbqt_par_QFont( 1 ) ); + } + else + { + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } +} +void setPalette ( const QPalette & palette ){ + if( hb_pcount() == 1 && hbqt_par_isDerivedFrom( 1, "HB_QPALETTE" ) ) + { + QToolTip::setPalette( *hbqt_par_QPalette( 1 ) ); + } + else + { + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } +} +void showText ( const QPoint & pos, const QString & text, QWidget * w, const QRect & rect ){ + if( hb_pcount() == 4 && hbqt_par_isDerivedFrom( 1, "QPOINT" ) && HB_ISCHAR( 2 ) && hbqt_par_isDerivedFrom( 3, "QWIDGET" ) && hbqt_par_isDerivedFrom( 4, "QRECT" ) ) + { + void * pText01 = NULL; + QToolTip::showText( *hbqt_par_QPoint( 1 ), ( QString ) hb_parstr_utf8( 2, &pText01, NULL ), hbqt_par_QWidget( 3 ), *hbqt_par_QRect( 4 ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() == 3 && hbqt_par_isDerivedFrom( 1, "QPOINT" ) && HB_ISCHAR( 2 ) && hbqt_par_isDerivedFrom( 3, "QWIDGET" ) ) + { + void * pText01 = NULL; + QToolTip::showText( *hbqt_par_QPoint( 1 ), ( QString ) hb_parstr_utf8( 2, &pText01, NULL ), hbqt_par_QWidget( 3 ) ); + hb_strfree( pText01 ); + } + else if( hb_pcount() == 2 && hbqt_par_isDerivedFrom( 1, "QPOINT" ) && HB_ISCHAR( 2 ) ) + { + void * pText01 = NULL; + QToolTip::showText( *hbqt_par_QPoint( 1 ), ( QString ) hb_parstr_utf8( 2, &pText01, NULL ) ); + hb_strfree( pText01 ); + } + else + { + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } +} +QString text (){ + hb_retstr_utf8( QToolTip::text().toUtf8().data() ); +} + + + + + + + diff --git a/harbour/contrib/hbqt/qtgui/qth/filelist.hbm b/harbour/contrib/hbqt/qtgui/qth/filelist.hbm index 679e2510a3..4bc8ab178d 100644 --- a/harbour/contrib/hbqt/qtgui/qth/filelist.hbm +++ b/harbour/contrib/hbqt/qtgui/qth/filelist.hbm @@ -277,3 +277,4 @@ QWindowsStyle.qth QWindowStateChangeEvent.qth QWizard.qth QWizardPage.qth +QToolTip.qth