From 4bb4d6cc4a42da31c368fd80dcce007af4f14db8 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 7 Jun 2009 02:18:16 +0000 Subject: [PATCH] 2009-06-06 19:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/Makefile_gen * harbour/contrib/hbqt/hbqt_qabstractitemview.cpp + harbour/contrib/hbqt/hbqt_qdirmodel.cpp * harbour/contrib/hbqt/hbqt.h * harbour/contrib/hbqt/generator/hbqtgen.prg * harbour/contrib/hbqt/tests/demoqt.prg * harbour/contrib/hbqt/TQAbstractItemView.prg + harbour/contrib/hbqt/TQDirModel.prg * harbour/contrib/hbqt/qth/QAbstractItemView.qth + harbour/contrib/hbqt/qth/QDirModel.qth * harbour/contrib/hbqt/generator/qt45.qtp + Added one more class and fixed another. /* Now demoqt demonstrates a lot of controls. Central widget is added to the main window to host all other controls. Main window hosts QMenuBar() QToolBar() QStatusBar() QWidget() - central == drawingArea of XbpDialog() in Xbase++. :drawingArea hosts: QTableWidget() | QTableWidgetItem() QPushButton() QLabel() QProgressBar() QTabWidget() :tabs host: QTreeView() QLineEdit() QComboBox() QCheckBox() QRadioButton() QSpinBox() QTextBox() Feel free to play with the ToolBars. You can drag and dock them to any corners. Push button executes a message box. Tool buttons reacts to events and show up tooltips. As a whole, I am truely convinced, that within new couple of weeks Xbase++ compatible XbpParts will be a reality. */ --- harbour/ChangeLog | 56 +++ harbour/contrib/hbqt/Makefile_gen | 2 + harbour/contrib/hbqt/TQAbstractItemView.prg | 54 +++ harbour/contrib/hbqt/TQDirModel.prg | 118 +++++ harbour/contrib/hbqt/generator/hbqtgen.prg | 321 ++++++++++--- harbour/contrib/hbqt/generator/qt45.qtp | 1 + harbour/contrib/hbqt/hbqt.h | 1 + .../contrib/hbqt/hbqt_qabstractitemview.cpp | 434 +++++++++++++++++- harbour/contrib/hbqt/hbqt_qdirmodel.cpp | 384 ++++++++++++++++ .../contrib/hbqt/qth/QAbstractItemView.qth | 4 +- harbour/contrib/hbqt/qth/QDirModel.qth | 133 ++++++ harbour/contrib/hbqt/tests/demoqt.prg | 318 ++++++++++--- 12 files changed, 1718 insertions(+), 108 deletions(-) create mode 100644 harbour/contrib/hbqt/TQDirModel.prg create mode 100644 harbour/contrib/hbqt/hbqt_qdirmodel.cpp create mode 100644 harbour/contrib/hbqt/qth/QDirModel.qth diff --git a/harbour/ChangeLog b/harbour/ChangeLog index cb8b71a00f..ff99563aeb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,62 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-06 19:01 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbqt/Makefile_gen + + * harbour/contrib/hbqt/hbqt_qabstractitemview.cpp + + harbour/contrib/hbqt/hbqt_qdirmodel.cpp + + * harbour/contrib/hbqt/hbqt.h + + * harbour/contrib/hbqt/generator/hbqtgen.prg + + * harbour/contrib/hbqt/tests/demoqt.prg + + * harbour/contrib/hbqt/TQAbstractItemView.prg + + harbour/contrib/hbqt/TQDirModel.prg + + * harbour/contrib/hbqt/qth/QAbstractItemView.qth + + harbour/contrib/hbqt/qth/QDirModel.qth + + * harbour/contrib/hbqt/generator/qt45.qtp + + + Added one more class and fixed another. + + /* + Now demoqt demonstrates a lot of controls. + Central widget is added to the main window to host all other controls. + + Main window hosts + QMenuBar() + QToolBar() + QStatusBar() + QWidget() - central == drawingArea of XbpDialog() in Xbase++. + + :drawingArea hosts: + QTableWidget() | QTableWidgetItem() + QPushButton() + QLabel() + QProgressBar() + QTabWidget() + + :tabs host: + QTreeView() + QLineEdit() + QComboBox() + QCheckBox() + QRadioButton() + QSpinBox() + QTextBox() + + Feel free to play with the ToolBars. You can drag and dock them to + any corners. Push button executes a message box. Tool buttons reacts + to events and show up tooltips. + + As a whole, I am truely convinced, that within new couple of weeks + Xbase++ compatible XbpParts will be a reality. + */ + 2009-06-07 02:24 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * bin/postinst.bat + bin/hb-mkimp.bat diff --git a/harbour/contrib/hbqt/Makefile_gen b/harbour/contrib/hbqt/Makefile_gen index 82723b882a..f38e968573 100644 --- a/harbour/contrib/hbqt/Makefile_gen +++ b/harbour/contrib/hbqt/Makefile_gen @@ -32,6 +32,7 @@ CPP_SOURCES=\ hbqt_qdial.cpp \ hbqt_qdialog.cpp \ hbqt_qdir.cpp \ + hbqt_qdirmodel.cpp \ hbqt_qdockwidget.cpp \ hbqt_qdoublespinbox.cpp \ hbqt_qerrormessage.cpp \ @@ -226,6 +227,7 @@ PRG_SOURCES=\ TQDial.prg \ TQDialog.prg \ TQDir.prg \ + TQDirModel.prg \ TQDockWidget.prg \ TQDoubleSpinBox.prg \ TQErrorMessage.prg \ diff --git a/harbour/contrib/hbqt/TQAbstractItemView.prg b/harbour/contrib/hbqt/TQAbstractItemView.prg index bfe0352b39..b4d8fb5868 100644 --- a/harbour/contrib/hbqt/TQAbstractItemView.prg +++ b/harbour/contrib/hbqt/TQAbstractItemView.prg @@ -63,6 +63,60 @@ CREATE CLASS QAbstractItemView INHERIT QAbstractScrollArea METHOD New() + METHOD alternatingRowColors() INLINE Qt_QAbstractItemView_alternatingRowColors( ::pPtr ) + METHOD autoScrollMargin() INLINE Qt_QAbstractItemView_autoScrollMargin( ::pPtr ) + METHOD closePersistentEditor( pIndex ) INLINE Qt_QAbstractItemView_closePersistentEditor( ::pPtr, pIndex ) + METHOD currentIndex() INLINE Qt_QAbstractItemView_currentIndex( ::pPtr ) + METHOD dragDropMode() INLINE Qt_QAbstractItemView_dragDropMode( ::pPtr ) + METHOD dragDropOverwriteMode() INLINE Qt_QAbstractItemView_dragDropOverwriteMode( ::pPtr ) + METHOD dragEnabled() INLINE Qt_QAbstractItemView_dragEnabled( ::pPtr ) + METHOD editTriggers() INLINE Qt_QAbstractItemView_editTriggers( ::pPtr ) + METHOD hasAutoScroll() INLINE Qt_QAbstractItemView_hasAutoScroll( ::pPtr ) + METHOD horizontalScrollMode() INLINE Qt_QAbstractItemView_horizontalScrollMode( ::pPtr ) + METHOD iconSize() INLINE Qt_QAbstractItemView_iconSize( ::pPtr ) + METHOD indexAt( pPoint ) INLINE Qt_QAbstractItemView_indexAt( ::pPtr, pPoint ) + METHOD indexWidget( pIndex ) INLINE Qt_QAbstractItemView_indexWidget( ::pPtr, pIndex ) + METHOD itemDelegate() INLINE Qt_QAbstractItemView_itemDelegate( ::pPtr ) + METHOD itemDelegate_1( pIndex ) INLINE Qt_QAbstractItemView_itemDelegate_1( ::pPtr, pIndex ) + METHOD itemDelegateForColumn( nColumn ) INLINE Qt_QAbstractItemView_itemDelegateForColumn( ::pPtr, nColumn ) + METHOD itemDelegateForRow( nRow ) INLINE Qt_QAbstractItemView_itemDelegateForRow( ::pPtr, nRow ) + METHOD keyboardSearch( cSearch ) INLINE Qt_QAbstractItemView_keyboardSearch( ::pPtr, cSearch ) + METHOD model() INLINE Qt_QAbstractItemView_model( ::pPtr ) + METHOD openPersistentEditor( pIndex ) INLINE Qt_QAbstractItemView_openPersistentEditor( ::pPtr, pIndex ) + METHOD rootIndex() INLINE Qt_QAbstractItemView_rootIndex( ::pPtr ) + METHOD scrollTo( pIndex, nHint ) INLINE Qt_QAbstractItemView_scrollTo( ::pPtr, pIndex, nHint ) + METHOD selectionBehavior() INLINE Qt_QAbstractItemView_selectionBehavior( ::pPtr ) + METHOD selectionMode() INLINE Qt_QAbstractItemView_selectionMode( ::pPtr ) + METHOD selectionModel() INLINE Qt_QAbstractItemView_selectionModel( ::pPtr ) + METHOD setAlternatingRowColors( lEnable ) INLINE Qt_QAbstractItemView_setAlternatingRowColors( ::pPtr, lEnable ) + METHOD setAutoScroll( lEnable ) INLINE Qt_QAbstractItemView_setAutoScroll( ::pPtr, lEnable ) + METHOD setAutoScrollMargin( nMargin ) INLINE Qt_QAbstractItemView_setAutoScrollMargin( ::pPtr, nMargin ) + METHOD setDragDropMode( nBehavior ) INLINE Qt_QAbstractItemView_setDragDropMode( ::pPtr, nBehavior ) + METHOD setDragDropOverwriteMode( lOverwrite ) INLINE Qt_QAbstractItemView_setDragDropOverwriteMode( ::pPtr, lOverwrite ) + METHOD setDragEnabled( lEnable ) INLINE Qt_QAbstractItemView_setDragEnabled( ::pPtr, lEnable ) + METHOD setDropIndicatorShown( lEnable ) INLINE Qt_QAbstractItemView_setDropIndicatorShown( ::pPtr, lEnable ) + METHOD setEditTriggers( nTriggers ) INLINE Qt_QAbstractItemView_setEditTriggers( ::pPtr, nTriggers ) + METHOD setHorizontalScrollMode( nMode ) INLINE Qt_QAbstractItemView_setHorizontalScrollMode( ::pPtr, nMode ) + METHOD setIconSize( pSize ) INLINE Qt_QAbstractItemView_setIconSize( ::pPtr, pSize ) + METHOD setIndexWidget( pIndex, pWidget ) INLINE Qt_QAbstractItemView_setIndexWidget( ::pPtr, pIndex, pWidget ) + METHOD setItemDelegate( pDelegate ) INLINE Qt_QAbstractItemView_setItemDelegate( ::pPtr, pDelegate ) + METHOD setItemDelegateForColumn( nColumn, pDelegate ) INLINE Qt_QAbstractItemView_setItemDelegateForColumn( ::pPtr, nColumn, pDelegate ) + METHOD setItemDelegateForRow( nRow, pDelegate ) INLINE Qt_QAbstractItemView_setItemDelegateForRow( ::pPtr, nRow, pDelegate ) + METHOD setModel( pModel ) INLINE Qt_QAbstractItemView_setModel( ::pPtr, pModel ) + METHOD setSelectionBehavior( nBehavior ) INLINE Qt_QAbstractItemView_setSelectionBehavior( ::pPtr, nBehavior ) + METHOD setSelectionMode( nMode ) INLINE Qt_QAbstractItemView_setSelectionMode( ::pPtr, nMode ) + METHOD setSelectionModel( pSelectionModel ) INLINE Qt_QAbstractItemView_setSelectionModel( ::pPtr, pSelectionModel ) + METHOD setTabKeyNavigation( lEnable ) INLINE Qt_QAbstractItemView_setTabKeyNavigation( ::pPtr, lEnable ) + METHOD setTextElideMode( nMode ) INLINE Qt_QAbstractItemView_setTextElideMode( ::pPtr, nMode ) + METHOD setVerticalScrollMode( nMode ) INLINE Qt_QAbstractItemView_setVerticalScrollMode( ::pPtr, nMode ) + METHOD showDropIndicator() INLINE Qt_QAbstractItemView_showDropIndicator( ::pPtr ) + METHOD sizeHintForColumn( nColumn ) INLINE Qt_QAbstractItemView_sizeHintForColumn( ::pPtr, nColumn ) + METHOD sizeHintForIndex( pIndex ) INLINE Qt_QAbstractItemView_sizeHintForIndex( ::pPtr, pIndex ) + METHOD sizeHintForRow( nRow ) INLINE Qt_QAbstractItemView_sizeHintForRow( ::pPtr, nRow ) + METHOD tabKeyNavigation() INLINE Qt_QAbstractItemView_tabKeyNavigation( ::pPtr ) + METHOD textElideMode() INLINE Qt_QAbstractItemView_textElideMode( ::pPtr ) + METHOD verticalScrollMode() INLINE Qt_QAbstractItemView_verticalScrollMode( ::pPtr ) + METHOD visualRect( pIndex ) INLINE Qt_QAbstractItemView_visualRect( ::pPtr, pIndex ) METHOD clearSelection() INLINE Qt_QAbstractItemView_clearSelection( ::pPtr ) METHOD edit( pIndex ) INLINE Qt_QAbstractItemView_edit( ::pPtr, pIndex ) METHOD reset() INLINE Qt_QAbstractItemView_reset( ::pPtr ) diff --git a/harbour/contrib/hbqt/TQDirModel.prg b/harbour/contrib/hbqt/TQDirModel.prg new file mode 100644 index 0000000000..2a5f8e71f4 --- /dev/null +++ b/harbour/contrib/hbqt/TQDirModel.prg @@ -0,0 +1,118 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QDirModel INHERIT QAbstractItemModel + + VAR pParent + VAR pPtr + + METHOD New() + + METHOD columnCount( pParent ) INLINE Qt_QDirModel_columnCount( ::pPtr, pParent ) + METHOD data( pIndex, nRole ) INLINE Qt_QDirModel_data( ::pPtr, pIndex, nRole ) + METHOD dropMimeData( pData, nAction, nRow, nColumn, pParent ) INLINE Qt_QDirModel_dropMimeData( ::pPtr, pData, nAction, nRow, nColumn, pParent ) + METHOD fileIcon( pIndex ) INLINE Qt_QDirModel_fileIcon( ::pPtr, pIndex ) + METHOD fileInfo( pIndex ) INLINE Qt_QDirModel_fileInfo( ::pPtr, pIndex ) + METHOD fileName( pIndex ) INLINE Qt_QDirModel_fileName( ::pPtr, pIndex ) + METHOD filePath( pIndex ) INLINE Qt_QDirModel_filePath( ::pPtr, pIndex ) + METHOD filter() INLINE Qt_QDirModel_filter( ::pPtr ) + METHOD flags( pIndex ) INLINE Qt_QDirModel_flags( ::pPtr, pIndex ) + METHOD hasChildren( pParent ) INLINE Qt_QDirModel_hasChildren( ::pPtr, pParent ) + METHOD headerData( nSection, nOrientation, nRole ) INLINE Qt_QDirModel_headerData( ::pPtr, nSection, nOrientation, nRole ) + METHOD iconProvider() INLINE Qt_QDirModel_iconProvider( ::pPtr ) + METHOD index( nRow, nColumn, pParent ) INLINE Qt_QDirModel_index( ::pPtr, nRow, nColumn, pParent ) + METHOD index_1( cPath, nColumn ) INLINE Qt_QDirModel_index_1( ::pPtr, cPath, nColumn ) + METHOD isDir( pIndex ) INLINE Qt_QDirModel_isDir( ::pPtr, pIndex ) + METHOD isReadOnly() INLINE Qt_QDirModel_isReadOnly( ::pPtr ) + METHOD lazyChildCount() INLINE Qt_QDirModel_lazyChildCount( ::pPtr ) + METHOD mimeData( pIndexes ) INLINE Qt_QDirModel_mimeData( ::pPtr, pIndexes ) + METHOD mimeTypes() INLINE Qt_QDirModel_mimeTypes( ::pPtr ) + METHOD mkdir( pParent, cName ) INLINE Qt_QDirModel_mkdir( ::pPtr, pParent, cName ) + METHOD nameFilters() INLINE Qt_QDirModel_nameFilters( ::pPtr ) + METHOD parent( pChild ) INLINE Qt_QDirModel_parent( ::pPtr, pChild ) + METHOD remove( pIndex ) INLINE Qt_QDirModel_remove( ::pPtr, pIndex ) + METHOD resolveSymlinks() INLINE Qt_QDirModel_resolveSymlinks( ::pPtr ) + METHOD rmdir( pIndex ) INLINE Qt_QDirModel_rmdir( ::pPtr, pIndex ) + METHOD rowCount( pParent ) INLINE Qt_QDirModel_rowCount( ::pPtr, pParent ) + METHOD setData( pIndex, pValue, nRole ) INLINE Qt_QDirModel_setData( ::pPtr, pIndex, pValue, nRole ) + METHOD setFilter( nFilters ) INLINE Qt_QDirModel_setFilter( ::pPtr, nFilters ) + METHOD setIconProvider( pProvider ) INLINE Qt_QDirModel_setIconProvider( ::pPtr, pProvider ) + METHOD setLazyChildCount( lEnable ) INLINE Qt_QDirModel_setLazyChildCount( ::pPtr, lEnable ) + METHOD setNameFilters( pFilters ) INLINE Qt_QDirModel_setNameFilters( ::pPtr, pFilters ) + METHOD setReadOnly( lEnable ) INLINE Qt_QDirModel_setReadOnly( ::pPtr, lEnable ) + METHOD setResolveSymlinks( lEnable ) INLINE Qt_QDirModel_setResolveSymlinks( ::pPtr, lEnable ) + METHOD setSorting( nSort ) INLINE Qt_QDirModel_setSorting( ::pPtr, nSort ) + METHOD sort( nColumn, nOrder ) INLINE Qt_QDirModel_sort( ::pPtr, nColumn, nOrder ) + METHOD sorting() INLINE Qt_QDirModel_sorting( ::pPtr ) + METHOD supportedDropActions() INLINE Qt_QDirModel_supportedDropActions( ::pPtr ) + METHOD refresh( pParent ) INLINE Qt_QDirModel_refresh( ::pPtr, pParent ) + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD New( pParent ) CLASS QDirModel + + ::pParent := pParent + + ::pPtr := Qt_QDirModel( pParent ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index 13057adbbf..ff17068628 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -1673,6 +1673,7 @@ STATIC FUNCTION Build_HBQT_H( cPathOut ) aadd( txt_, "#define hbqt_par_QStylePainter( n ) ( ( QStylePainter* ) hb_parptr( n ) ) " ) aadd( txt_, "#define hbqt_par_QTextObject( n ) ( ( QTextObject* ) hb_parptr( n ) ) " ) aadd( txt_, "#define hbqt_par_QModelIndexList( n ) ( ( QModelIndexList* ) hb_parptr( n ) ) " ) + aadd( txt_, "#define hbqt_par_QDirModel( n ) ( ( QDirModel* ) hb_parptr( n ) ) " ) aadd( txt_, " " ) aadd( txt_, "#define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) ) " ) aadd( txt_, "#define hbqt_par_QRgb( n ) ( hb_parnint( n ) ) " ) @@ -2475,7 +2476,7 @@ STATIC FUNCTION Build_Demo() aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) aadd( txt_, ' ' ) aadd( txt_, 'PROCEDURE Main() ' ) - aadd( txt_, ' Local oLabel, oBtn ' ) + aadd( txt_, ' Local oLabel, oBtn, oDA, oTabBar ' ) aadd( txt_, ' Local oWnd, oSize ' ) aadd( txt_, ' Local oMenuBar, pIcon ' ) aadd( txt_, ' Local oMenuA, pAction ' ) @@ -2487,16 +2488,13 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' pIcon := oWnd:windowIcon() ' ) aadd( txt_, ' ' ) aadd( txt_, ' /* The method 2 */ ' ) - aadd( txt_, ' oWnd:resize( 640, 400 ) ' ) - aadd( txt_, ' #if 0 ' ) - aadd( txt_, ' /* The method 2 */ ' ) - aadd( txt_, ' oSize := QSize():new() ' ) - aadd( txt_, ' oSize:setWidth( 640 ) ' ) - aadd( txt_, ' oSize:setHeight( 400 ) ' ) - aadd( txt_, ' oWnd:resize_1( QT_PTROF( oSize ) ) ' ) - aadd( txt_, ' #endif ' ) + aadd( txt_, ' oWnd:resize( 900, 500 ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oDA := QWidget():new( oWnd ) ' ) + aadd( txt_, ' oWnd:setCentralWidget( QT_PTROF( oDA ) ) ' ) aadd( txt_, ' ' ) aadd( txt_, ' Build_MenuBar( oWnd ) ' ) + aadd( txt_, ' Build_ToolBar( oWnd ) ' ) aadd( txt_, ' ' ) aadd( txt_, ' oSBar := QStatusBar():new( QT_PTROF( oWnd ) ) ' ) aadd( txt_, ' oWnd:setStatusBar( QT_PTROF( oSBar ) ) ' ) @@ -2506,18 +2504,11 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' oStyle:standardIcon( 2 ) ' ) aadd( txt_, ' oWnd:setStyle( QT_PTROF( oStyle ) ) ' ) aadd( txt_, ' ' ) - aadd( txt_, ' oLabel := QLabel():New( QT_PTROF( oWnd ) ) ' ) - aadd( txt_, ' oLabel:setText( "Testing Harbour + Qt" ) ' ) - aadd( txt_, ' oLabel:move( 30,260 ) ' ) - aadd( txt_, ' oLabel:show() ' ) - aadd( txt_, ' ' ) - aadd( txt_, ' oBtn := QPushButton():new( QT_PTROF( oWnd ) ) ' ) - aadd( txt_, ' oBtn:setText( "Push Button" ) ' ) - aadd( txt_, ' oBtn:resize( 100,50 ) ' ) - aadd( txt_, ' oBtn:move( 30,300 ) ' ) - aadd( txt_, ' oBtn:show() ' ) - aadd( txt_, ' ' ) - aadd( txt_, ' Build_Grid( oWnd ) ' ) + aadd( txt_, ' Build_Label( oDA, { 30,190 }, { 300, 30 } ) ' ) + aadd( txt_, ' Build_PushButton( oDA, { 30,240 }, { 100,50 } ) ' ) + aadd( txt_, ' Build_Grid( oDA ) ' ) + aadd( txt_, ' Build_Tabs( oDA ) ' ) + aadd( txt_, ' Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) ' ) aadd( txt_, ' ' ) aadd( txt_, ' oWnd:Show() ' ) aadd( txt_, ' ' ) @@ -2559,7 +2550,261 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' ' ) aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) aadd( txt_, ' ' ) - aadd( txt_, 'FUNCTION MsgInfo( cMsg ) ' ) + aadd( txt_, 'STATIC FUNCTION Build_ToolBar( oWnd ) ' ) + aadd( txt_, ' LOCAL oTB, oAct ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Create a Toolbar Object */ ' ) + aadd( txt_, ' oTB := QToolBar():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Create an action */ ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&New" ) ' ) + aadd( txt_, ' oAct:setIcon( "new.png" ) ' ) + aadd( txt_, ' oAct:setToolTip( "A New File" ) ' ) + aadd( txt_, ' /* Attach codeblock to be triggered */ ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) ' ) + aadd( txt_, ' /* Attach Action with Toolbar */ ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Create another action */ ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Open" ) ' ) + aadd( txt_, ' oAct:setIcon( "open.png" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Select a file to be opened!" ) ' ) + aadd( txt_, ' /* Attach codeblock to be triggered */ ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) ' ) + aadd( txt_, ' /* Attach Action with Toolbar */ ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTB:addSeparator() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Create another action */ ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Save" ) ' ) + aadd( txt_, ' oAct:setIcon( "save.png" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Save this file!" ) ' ) + aadd( txt_, ' /* Attach codeblock to be triggered */ ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) ' ) + aadd( txt_, ' /* Attach Action with Toolbar */ ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Add this toolbar with main window */ ' ) + aadd( txt_, ' oWnd:addToolBar_1( QT_PTROF( oTB ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /////////////////////////////////////////////////////////// ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Build another toolbar - we will have two toolbats now */ ' ) + aadd( txt_, ' oTB := QToolBar():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Colors" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Colors Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Fonts" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Fonts Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTB:addSeparator() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&PgSetup" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Page Setup Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Preview" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Page Preview Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTB:addSeparator() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Webpage" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Web Browser Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oAct := QAction():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oAct:setText( "&Wizard" ) ' ) + aadd( txt_, ' oAct:setToolTip( "Generic Wizard Dialog" ) ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) ' ) + aadd( txt_, ' oTB:addAction( QT_PTROF( oAct ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' /* Add this toolbar with main window */ ' ) + aadd( txt_, ' oWnd:addToolBar_1( QT_PTROF( oTB ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_PushButton( oWnd, aPos, aSize ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oBtn := QPushButton():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oBtn:setText( "Push Button" ) ' ) + aadd( txt_, ' oBtn:move( aPos[ 1 ],aPos[ 2 ] ) ' ) + aadd( txt_, ' oBtn:resize( aSize[ 1 ],aSize[ 2 ] ) ' ) + aadd( txt_, ' oBtn:show() ' ) + aadd( txt_, ' Qt_Connect_Signal( QT_PTROF( oBtn ), QT_EVE_CLICKED, {|| MsgInfo( "Push Button Pressed" ) } ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_Grid( oWnd ) ' ) + aadd( txt_, ' LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0 ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oGrid := QTableWidget():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oGrid:setRowCount( 2 ) ' ) + aadd( txt_, ' oGrid:setColumnCount( 4 ) ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oBrushBackItem0x0 := QBrush():new() ' ) + aadd( txt_, ' oBrushBackItem0x0:setStyle( 1 ) // Solid Color ' ) + aadd( txt_, ' oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oBrushForeItem0x0 := QBrush():new() ' ) + aadd( txt_, ' oBrushForeItem0x0:setColor_1( 7 ) ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oGridItem0x0 := QTableWidgetItem():new() ' ) + aadd( txt_, ' oGridItem0x0:setBackground( QT_PTROF( oBrushBackItem0x0 ) ) ' ) + aadd( txt_, ' oGridItem0x0:setForeground( QT_PTROF( oBrushForeItem0x0 ) ) ' ) + aadd( txt_, ' oGridItem0x0:setText( "Item 0x0" ) ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oGrid:setItem( 0, 0, QT_PTROF( oGridItem0x0 ) ) ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oGrid:Move( 30, 30 ) ' ) + aadd( txt_, ' oGrid:ReSize( 450, 150 ) ' ) + aadd( txt_, ' // ' ) + aadd( txt_, ' oGrid:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_Tabs( oWnd ) ' ) + aadd( txt_, ' LOCAL oTabWidget, oTab1, oTab2, oTab3 ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTabWidget := QTabWidget():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTab1 := QWidget():new( QT_PTROF( oTabWidget ) ) ' ) + aadd( txt_, ' oTab2 := QWidget():new( QT_PTROF( oTabWidget ) ) ' ) + aadd( txt_, ' oTab3 := QWidget():new( QT_PTROF( oTabWidget ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTabWidget:addTab( QT_PTROF( oTab1 ), "Folders" ) ' ) + aadd( txt_, ' oTabWidget:addTab( QT_PTROF( oTab2 ), "Controls" ) ' ) + aadd( txt_, ' oTabWidget:addTab( QT_PTROF( oTab3 ), "TextBox" ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTabWidget:move( 510, 5 ) ' ) + aadd( txt_, ' oTabWidget:resize( 360, 400 ) ' ) + aadd( txt_, ' oTabWidget:show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' Build_Treeview( oTab1 ) ' ) + aadd( txt_, ' Build_Controls( oTab2 ) ' ) + aadd( txt_, ' Build_TextBox( oTab3 ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN { oTab1, oTab2, oTab3 } ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_TreeView( oWnd ) ' ) + aadd( txt_, ' LOCAL oTV, oDModel ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTV := QTreeView():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oDirModel := QDirModel():new( QT_PTROF( oTV ) ) ' ) + aadd( txt_, ' oTV:setModel( QT_PTROF( oDirModel ) ) ' ) + aadd( txt_, ' oTV:move( 5, 7 ) ' ) + aadd( txt_, ' oTV:resize( 345, 365 ) ' ) + aadd( txt_, ' OTV:show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_TextBox( oWnd ) ' ) + aadd( txt_, ' LOCAL oTextBox ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oTextBox := QTextEdit():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oTextBox:Move( 5, 7 ) ' ) + aadd( txt_, ' oTextBox:Resize( 345,365 ) ' ) + aadd( txt_, ' oTextBox:setAcceptRichText( .t. ) ' ) + aadd( txt_, ' oTextBox:setPlainText( "This is Harbour QT implementation" ) ' ) + aadd( txt_, ' oTextBox:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_Controls( oWnd ) ' ) + aadd( txt_, ' LOCAL oEdit, oCheckBox, oComboBox, oSpinBox, oRadioButton ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oEdit := QLineEdit():new( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oEdit:move( 5, 10 ) ' ) + aadd( txt_, ' oEdit:resize( 345, 30 ) ' ) + aadd( txt_, ' oEdit:setMaxLength( 40 ) ' ) + aadd( txt_, ' oEdit:setText( "TextBox Testing Max Length = 40" ) ' ) + aadd( txt_, ' oEdit:setAlignment( 1 ) // 1: Left 2: Right 4: center 8: use all textbox length ' ) + aadd( txt_, ' oEdit:show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oComboBox := QComboBox():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oComboBox:move( 5, 60 ) ' ) + aadd( txt_, ' oComboBox:resize( 345, 30 ) ' ) + aadd( txt_, ' oComboBox:show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oCheckBox := QCheckBox():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oCheckBox:setText( "Testing CheckBox HbQt" ) ' ) + aadd( txt_, ' oCheckBox:move( 5, 110 ) ' ) + aadd( txt_, ' oCheckBox:resize( 345, 30 ) ' ) + aadd( txt_, ' oCheckBox:show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oSpinBox := QSpinBox():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oSpinBox:Move( 5, 160 ) ' ) + aadd( txt_, ' oSpinBox:ReSize( 345, 30 ) ' ) + aadd( txt_, ' oSpinBox:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oRadioButton := QRadioButton():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oRadioButton:Move( 5, 210 ) ' ) + aadd( txt_, ' oRadioButton:ReSize( 345, 30 ) ' ) + aadd( txt_, ' oRadioButton:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_ProgressBar( oWnd, aPos, aSize ) ' ) + aadd( txt_, ' LOCAL oProgressBar ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oProgressBar := QProgressBar():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oProgressBar:SetRange( 1, 1500 ) ' ) + aadd( txt_, ' oProgressBar:Setvalue( 500 ) ' ) + aadd( txt_, ' oProgressBar:Move( aPos[ 1 ], aPos[ 2 ] ) ' ) + aadd( txt_, ' oProgressBar:ReSize( aSize[ 1 ], aSize[ 2 ] ) ' ) + aadd( txt_, ' oProgressBar:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION Build_Label( oWnd, aPos, aSize ) ' ) + aadd( txt_, ' LOCAL oLabel ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' oLabel := QLabel():New( QT_PTROF( oWnd ) ) ' ) + aadd( txt_, ' oLabel:SetTextFormat( 1 ) // 0 text plain 1 RichText ' ) + aadd( txt_, ' oLabel:SetText( [This is a Label in Harbour QT] ) ' ) + aadd( txt_, ' oLabel:Move( aPos[ 1 ], aPos[ 2 ] ) ' ) + aadd( txt_, ' oLabel:ReSize( aSize[ 1 ], aSize[ 2 ] ) ' ) + aadd( txt_, ' oLabel:Show() ' ) + aadd( txt_, ' ' ) + aadd( txt_, ' RETURN nil ' ) + aadd( txt_, ' ' ) + aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) + aadd( txt_, ' ' ) + aadd( txt_, 'STATIC FUNCTION MsgInfo( cMsg ) ' ) aadd( txt_, ' LOCAL oMB ' ) aadd( txt_, ' ' ) aadd( txt_, ' oMB := QMessageBox():new() ' ) @@ -2762,7 +3007,7 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' oSome := QStyleOptionToolBox():new() ' ) aadd( txt_, ' oSome := QStyleOptionToolButton():new() ' ) aadd( txt_, ' oSome := QStyleOptionViewItem():new() ' ) - aadd( txt_, ' oSome := QStylePainter():new() ' ) + aadd( txt_, ' oSome := QStylePainter():new() ' ) aadd( txt_, ' oSome := QTabBar():new() ' ) aadd( txt_, ' oSome := QTableView():new() ' ) aadd( txt_, ' oSome := QTableWidget():new() ' ) @@ -2816,36 +3061,6 @@ STATIC FUNCTION Build_Demo() aadd( txt_, ' ' ) aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) aadd( txt_, ' ' ) - aadd( txt_, 'STATIC FUNCTION Build_Grid( oWnd ) ' ) - aadd( txt_, ' LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0 ' ) - aadd( txt_, ' ' ) - aadd( txt_, ' oGrid := QTableWidget():new( QT_PTROF( oWnd ) ) ' ) - aadd( txt_, ' oGrid:setRowCount( 2 ) ' ) - aadd( txt_, ' oGrid:setColumnCount( 4 ) ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oBrushBackItem0x0 := QBrush():new() ' ) - aadd( txt_, ' oBrushBackItem0x0:setStyle( 1 ) // Solid Color ' ) - aadd( txt_, ' oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oBrushForeItem0x0 := QBrush():new() ' ) - aadd( txt_, ' oBrushForeItem0x0:setColor_1( 7 ) ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oGridItem0x0 := QTableWidgetItem():new() ' ) - aadd( txt_, ' oGridItem0x0:setBackground( oBrushBackItem0x0:pPtr ) ' ) - aadd( txt_, ' oGridItem0x0:setForeground( oBrushForeItem0x0:pPtr ) ' ) - aadd( txt_, ' oGridItem0x0:setText( "Item 0x0" ) ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oGrid:setItem( 0, 0, oGridItem0x0:pPtr ) ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oGrid:Move( 30 , 50 ) ' ) - aadd( txt_, ' oGrid:ReSize( 550 , 200 ) ' ) - aadd( txt_, ' // ' ) - aadd( txt_, ' oGrid:Show() ' ) - aadd( txt_, ' ' ) - aadd( txt_, ' RETURN nil ' ) - aadd( txt_, ' ' ) - aadd( txt_, '/*----------------------------------------------------------------------*/ ' ) - aadd( txt_, ' ' ) RETURN CreateTarget( cFile, txt_ ) diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 0008305fa8..ce96d1e874 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -39,6 +39,7 @@ QDesktopWidget.qth QDial.qth QDialog.qth QDir.qth +QDirModel.qth QDockWidget.qth QDoubleSpinBox.qth QErrorMessage.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 48ebf70108..1b9afe0080 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -306,6 +306,7 @@ #define hbqt_par_QStylePainter( n ) ( ( QStylePainter* ) hb_parptr( n ) ) #define hbqt_par_QTextObject( n ) ( ( QTextObject* ) hb_parptr( n ) ) #define hbqt_par_QModelIndexList( n ) ( ( QModelIndexList* ) hb_parptr( n ) ) +#define hbqt_par_QDirModel( n ) ( ( QDirModel* ) hb_parptr( n ) ) #define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) ) #define hbqt_par_QRgb( n ) ( hb_parnint( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_qabstractitemview.cpp b/harbour/contrib/hbqt/hbqt_qabstractitemview.cpp index e1dfe62d2c..c48b1a01c2 100644 --- a/harbour/contrib/hbqt/hbqt_qabstractitemview.cpp +++ b/harbour/contrib/hbqt/hbqt_qabstractitemview.cpp @@ -60,7 +60,7 @@ /*----------------------------------------------------------------------*/ /* - * Constructed[ 8/9 [ 88.89% ] ] + * Constructed[ 62/63 [ 98.41% ] ] * * *** Unconvered Prototypes *** * ----------------------------- @@ -81,6 +81,438 @@ HB_FUNC( QT_QABSTRACTITEMVIEW ) } +/* + * bool alternatingRowColors () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ALTERNATINGROWCOLORS ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->alternatingRowColors() ); +} + +/* + * int autoScrollMargin () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_AUTOSCROLLMARGIN ) +{ + hb_retni( hbqt_par_QAbstractItemView( 1 )->autoScrollMargin() ); +} + +/* + * void closePersistentEditor ( const QModelIndex & index ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_CLOSEPERSISTENTEDITOR ) +{ + hbqt_par_QAbstractItemView( 1 )->closePersistentEditor( *hbqt_par_QModelIndex( 2 ) ); +} + +/* + * QModelIndex currentIndex () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_CURRENTINDEX ) +{ + hb_retptr( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->currentIndex() ) ); +} + +/* + * DragDropMode dragDropMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_DRAGDROPMODE ) +{ + hb_retni( ( QAbstractItemView::DragDropMode ) hbqt_par_QAbstractItemView( 1 )->dragDropMode() ); +} + +/* + * bool dragDropOverwriteMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_DRAGDROPOVERWRITEMODE ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->dragDropOverwriteMode() ); +} + +/* + * bool dragEnabled () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_DRAGENABLED ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->dragEnabled() ); +} + +/* + * EditTriggers editTriggers () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_EDITTRIGGERS ) +{ + hb_retni( ( QAbstractItemView::EditTriggers ) hbqt_par_QAbstractItemView( 1 )->editTriggers() ); +} + +/* + * bool hasAutoScroll () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_HASAUTOSCROLL ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->hasAutoScroll() ); +} + +/* + * ScrollMode horizontalScrollMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_HORIZONTALSCROLLMODE ) +{ + hb_retni( ( QAbstractItemView::ScrollMode ) hbqt_par_QAbstractItemView( 1 )->horizontalScrollMode() ); +} + +/* + * QSize iconSize () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ICONSIZE ) +{ + hb_retptr( new QSize( hbqt_par_QAbstractItemView( 1 )->iconSize() ) ); +} + +/* + * virtual QModelIndex indexAt ( const QPoint & point ) const = 0 + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXAT ) +{ + hb_retptr( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ) ); +} + +/* + * QWidget * indexWidget ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXWIDGET ) +{ + hb_retptr( ( QWidget* ) hbqt_par_QAbstractItemView( 1 )->indexWidget( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * QAbstractItemDelegate * itemDelegate () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE ) +{ + hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegate() ); +} + +/* + * QAbstractItemDelegate * itemDelegate ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE_1 ) +{ + hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegate( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * QAbstractItemDelegate * itemDelegateForColumn ( int column ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATEFORCOLUMN ) +{ + hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegateForColumn( hb_parni( 2 ) ) ); +} + +/* + * QAbstractItemDelegate * itemDelegateForRow ( int row ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATEFORROW ) +{ + hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegateForRow( hb_parni( 2 ) ) ); +} + +/* + * virtual void keyboardSearch ( const QString & search ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_KEYBOARDSEARCH ) +{ + hbqt_par_QAbstractItemView( 1 )->keyboardSearch( hbqt_par_QString( 2 ) ); +} + +/* + * QAbstractItemModel * model () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_MODEL ) +{ + hb_retptr( ( QAbstractItemModel* ) hbqt_par_QAbstractItemView( 1 )->model() ); +} + +/* + * void openPersistentEditor ( const QModelIndex & index ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_OPENPERSISTENTEDITOR ) +{ + hbqt_par_QAbstractItemView( 1 )->openPersistentEditor( *hbqt_par_QModelIndex( 2 ) ); +} + +/* + * QModelIndex rootIndex () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_ROOTINDEX ) +{ + hb_retptr( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->rootIndex() ) ); +} + +/* + * virtual void scrollTo ( const QModelIndex & index, ScrollHint hint = EnsureVisible ) = 0 + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SCROLLTO ) +{ + hbqt_par_QAbstractItemView( 1 )->scrollTo( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? ( QAbstractItemView::ScrollHint ) hb_parni( 3 ) : ( QAbstractItemView::ScrollHint ) QAbstractItemView::EnsureVisible ) ); +} + +/* + * QAbstractItemView::SelectionBehavior selectionBehavior () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SELECTIONBEHAVIOR ) +{ + hb_retni( ( QAbstractItemView::SelectionBehavior ) hbqt_par_QAbstractItemView( 1 )->selectionBehavior() ); +} + +/* + * QAbstractItemView::SelectionMode selectionMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SELECTIONMODE ) +{ + hb_retni( ( QAbstractItemView::SelectionMode ) hbqt_par_QAbstractItemView( 1 )->selectionMode() ); +} + +/* + * QItemSelectionModel * selectionModel () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SELECTIONMODEL ) +{ + hb_retptr( ( QItemSelectionModel* ) hbqt_par_QAbstractItemView( 1 )->selectionModel() ); +} + +/* + * void setAlternatingRowColors ( bool enable ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETALTERNATINGROWCOLORS ) +{ + hbqt_par_QAbstractItemView( 1 )->setAlternatingRowColors( hb_parl( 2 ) ); +} + +/* + * void setAutoScroll ( bool enable ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETAUTOSCROLL ) +{ + hbqt_par_QAbstractItemView( 1 )->setAutoScroll( hb_parl( 2 ) ); +} + +/* + * void setAutoScrollMargin ( int margin ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETAUTOSCROLLMARGIN ) +{ + hbqt_par_QAbstractItemView( 1 )->setAutoScrollMargin( hb_parni( 2 ) ); +} + +/* + * void setDragDropMode ( DragDropMode behavior ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETDRAGDROPMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setDragDropMode( ( QAbstractItemView::DragDropMode ) hb_parni( 2 ) ); +} + +/* + * void setDragDropOverwriteMode ( bool overwrite ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETDRAGDROPOVERWRITEMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setDragDropOverwriteMode( hb_parl( 2 ) ); +} + +/* + * void setDragEnabled ( bool enable ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETDRAGENABLED ) +{ + hbqt_par_QAbstractItemView( 1 )->setDragEnabled( hb_parl( 2 ) ); +} + +/* + * void setDropIndicatorShown ( bool enable ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETDROPINDICATORSHOWN ) +{ + hbqt_par_QAbstractItemView( 1 )->setDropIndicatorShown( hb_parl( 2 ) ); +} + +/* + * void setEditTriggers ( EditTriggers triggers ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETEDITTRIGGERS ) +{ + hbqt_par_QAbstractItemView( 1 )->setEditTriggers( ( QAbstractItemView::EditTriggers ) hb_parni( 2 ) ); +} + +/* + * void setHorizontalScrollMode ( ScrollMode mode ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETHORIZONTALSCROLLMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setHorizontalScrollMode( ( QAbstractItemView::ScrollMode ) hb_parni( 2 ) ); +} + +/* + * void setIconSize ( const QSize & size ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETICONSIZE ) +{ + hbqt_par_QAbstractItemView( 1 )->setIconSize( *hbqt_par_QSize( 2 ) ); +} + +/* + * void setIndexWidget ( const QModelIndex & index, QWidget * widget ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETINDEXWIDGET ) +{ + hbqt_par_QAbstractItemView( 1 )->setIndexWidget( *hbqt_par_QModelIndex( 2 ), hbqt_par_QWidget( 3 ) ); +} + +/* + * void setItemDelegate ( QAbstractItemDelegate * delegate ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETITEMDELEGATE ) +{ + hbqt_par_QAbstractItemView( 1 )->setItemDelegate( hbqt_par_QAbstractItemDelegate( 2 ) ); +} + +/* + * void setItemDelegateForColumn ( int column, QAbstractItemDelegate * delegate ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETITEMDELEGATEFORCOLUMN ) +{ + hbqt_par_QAbstractItemView( 1 )->setItemDelegateForColumn( hb_parni( 2 ), hbqt_par_QAbstractItemDelegate( 3 ) ); +} + +/* + * void setItemDelegateForRow ( int row, QAbstractItemDelegate * delegate ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETITEMDELEGATEFORROW ) +{ + hbqt_par_QAbstractItemView( 1 )->setItemDelegateForRow( hb_parni( 2 ), hbqt_par_QAbstractItemDelegate( 3 ) ); +} + +/* + * virtual void setModel ( QAbstractItemModel * model ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETMODEL ) +{ + hbqt_par_QAbstractItemView( 1 )->setModel( hbqt_par_QAbstractItemModel( 2 ) ); +} + +/* + * void setSelectionBehavior ( QAbstractItemView::SelectionBehavior behavior ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETSELECTIONBEHAVIOR ) +{ + hbqt_par_QAbstractItemView( 1 )->setSelectionBehavior( ( QAbstractItemView::SelectionBehavior ) hb_parni( 2 ) ); +} + +/* + * void setSelectionMode ( QAbstractItemView::SelectionMode mode ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETSELECTIONMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setSelectionMode( ( QAbstractItemView::SelectionMode ) hb_parni( 2 ) ); +} + +/* + * virtual void setSelectionModel ( QItemSelectionModel * selectionModel ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETSELECTIONMODEL ) +{ + hbqt_par_QAbstractItemView( 1 )->setSelectionModel( hbqt_par_QItemSelectionModel( 2 ) ); +} + +/* + * void setTabKeyNavigation ( bool enable ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETTABKEYNAVIGATION ) +{ + hbqt_par_QAbstractItemView( 1 )->setTabKeyNavigation( hb_parl( 2 ) ); +} + +/* + * void setTextElideMode ( Qt::TextElideMode mode ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETTEXTELIDEMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setTextElideMode( ( Qt::TextElideMode ) hb_parni( 2 ) ); +} + +/* + * void setVerticalScrollMode ( ScrollMode mode ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SETVERTICALSCROLLMODE ) +{ + hbqt_par_QAbstractItemView( 1 )->setVerticalScrollMode( ( QAbstractItemView::ScrollMode ) hb_parni( 2 ) ); +} + +/* + * bool showDropIndicator () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SHOWDROPINDICATOR ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->showDropIndicator() ); +} + +/* + * virtual int sizeHintForColumn ( int column ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORCOLUMN ) +{ + hb_retni( hbqt_par_QAbstractItemView( 1 )->sizeHintForColumn( hb_parni( 2 ) ) ); +} + +/* + * QSize sizeHintForIndex ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORINDEX ) +{ + hb_retptr( new QSize( hbqt_par_QAbstractItemView( 1 )->sizeHintForIndex( *hbqt_par_QModelIndex( 2 ) ) ) ); +} + +/* + * virtual int sizeHintForRow ( int row ) const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORROW ) +{ + hb_retni( hbqt_par_QAbstractItemView( 1 )->sizeHintForRow( hb_parni( 2 ) ) ); +} + +/* + * bool tabKeyNavigation () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_TABKEYNAVIGATION ) +{ + hb_retl( hbqt_par_QAbstractItemView( 1 )->tabKeyNavigation() ); +} + +/* + * Qt::TextElideMode textElideMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_TEXTELIDEMODE ) +{ + hb_retni( ( Qt::TextElideMode ) hbqt_par_QAbstractItemView( 1 )->textElideMode() ); +} + +/* + * ScrollMode verticalScrollMode () const + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_VERTICALSCROLLMODE ) +{ + hb_retni( ( QAbstractItemView::ScrollMode ) hbqt_par_QAbstractItemView( 1 )->verticalScrollMode() ); +} + +/* + * virtual QRect visualRect ( const QModelIndex & index ) const = 0 + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_VISUALRECT ) +{ + hb_retptr( new QRect( hbqt_par_QAbstractItemView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ) ); +} + /* * void clearSelection () */ diff --git a/harbour/contrib/hbqt/hbqt_qdirmodel.cpp b/harbour/contrib/hbqt/hbqt_qdirmodel.cpp new file mode 100644 index 0000000000..f05dedbb1a --- /dev/null +++ b/harbour/contrib/hbqt/hbqt_qdirmodel.cpp @@ -0,0 +1,384 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + + +#include + + +/* + * QDirModel ( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent = 0 ) + * QDirModel ( QObject * parent = 0 ) + * ~QDirModel () + */ +HB_FUNC( QT_QDIRMODEL ) +{ + hb_retptr( ( QDirModel* ) new QDirModel( hbqt_par_QObject( 1 ) ) ); +} + +/* + * virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const + */ +HB_FUNC( QT_QDIRMODEL_COLUMNCOUNT ) +{ + hb_retni( hbqt_par_QDirModel( 1 )->columnCount( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const + */ +HB_FUNC( QT_QDIRMODEL_DATA ) +{ + hb_retptr( new QVariant( hbqt_par_QDirModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ) ); +} + +/* + * virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) + */ +HB_FUNC( QT_QDIRMODEL_DROPMIMEDATA ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->dropMimeData( hbqt_par_QMimeData( 2 ), ( Qt::DropAction ) hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), *hbqt_par_QModelIndex( 6 ) ) ); +} + +/* + * QIcon fileIcon ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_FILEICON ) +{ + hb_retptr( new QIcon( hbqt_par_QDirModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ) ); +} + +/* + * QFileInfo fileInfo ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_FILEINFO ) +{ + hb_retptr( new QFileInfo( hbqt_par_QDirModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ) ); +} + +/* + * QString fileName ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_FILENAME ) +{ + hb_retc( hbqt_par_QDirModel( 1 )->fileName( *hbqt_par_QModelIndex( 2 ) ).toLatin1().data() ); +} + +/* + * QString filePath ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_FILEPATH ) +{ + hb_retc( hbqt_par_QDirModel( 1 )->filePath( *hbqt_par_QModelIndex( 2 ) ).toLatin1().data() ); +} + +/* + * QDir::Filters filter () const + */ +HB_FUNC( QT_QDIRMODEL_FILTER ) +{ + hb_retni( ( QDir::Filters ) hbqt_par_QDirModel( 1 )->filter() ); +} + +/* + * virtual Qt::ItemFlags flags ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_FLAGS ) +{ + hb_retni( ( Qt::ItemFlags ) hbqt_par_QDirModel( 1 )->flags( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const + */ +HB_FUNC( QT_QDIRMODEL_HASCHILDREN ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->hasChildren( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const + */ +HB_FUNC( QT_QDIRMODEL_HEADERDATA ) +{ + hb_retptr( new QVariant( hbqt_par_QDirModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ) ); +} + +/* + * QFileIconProvider * iconProvider () const + */ +HB_FUNC( QT_QDIRMODEL_ICONPROVIDER ) +{ + hb_retptr( ( QFileIconProvider* ) hbqt_par_QDirModel( 1 )->iconProvider() ); +} + +/* + * virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const + */ +HB_FUNC( QT_QDIRMODEL_INDEX ) +{ + hb_retptr( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QModelIndex( 4 ) ) ) ); +} + +/* + * QModelIndex index ( const QString & path, int column = 0 ) const + */ +HB_FUNC( QT_QDIRMODEL_INDEX_1 ) +{ + hb_retptr( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hbqt_par_QString( 2 ), hb_parni( 3 ) ) ) ); +} + +/* + * bool isDir ( const QModelIndex & index ) const + */ +HB_FUNC( QT_QDIRMODEL_ISDIR ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->isDir( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * bool isReadOnly () const + */ +HB_FUNC( QT_QDIRMODEL_ISREADONLY ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->isReadOnly() ); +} + +/* + * bool lazyChildCount () const + */ +HB_FUNC( QT_QDIRMODEL_LAZYCHILDCOUNT ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->lazyChildCount() ); +} + +/* + * virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const + */ +HB_FUNC( QT_QDIRMODEL_MIMEDATA ) +{ + hb_retptr( ( QMimeData* ) hbqt_par_QDirModel( 1 )->mimeData( *hbqt_par_QModelIndexList( 2 ) ) ); +} + +/* + * virtual QStringList mimeTypes () const + */ +HB_FUNC( QT_QDIRMODEL_MIMETYPES ) +{ + hb_retptr( new QStringList( hbqt_par_QDirModel( 1 )->mimeTypes() ) ); +} + +/* + * QModelIndex mkdir ( const QModelIndex & parent, const QString & name ) + */ +HB_FUNC( QT_QDIRMODEL_MKDIR ) +{ + hb_retptr( new QModelIndex( hbqt_par_QDirModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), hbqt_par_QString( 3 ) ) ) ); +} + +/* + * QStringList nameFilters () const + */ +HB_FUNC( QT_QDIRMODEL_NAMEFILTERS ) +{ + hb_retptr( new QStringList( hbqt_par_QDirModel( 1 )->nameFilters() ) ); +} + +/* + * virtual QModelIndex parent ( const QModelIndex & child ) const + */ +HB_FUNC( QT_QDIRMODEL_PARENT ) +{ + hb_retptr( new QModelIndex( hbqt_par_QDirModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ) ); +} + +/* + * bool remove ( const QModelIndex & index ) + */ +HB_FUNC( QT_QDIRMODEL_REMOVE ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->remove( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * bool resolveSymlinks () const + */ +HB_FUNC( QT_QDIRMODEL_RESOLVESYMLINKS ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->resolveSymlinks() ); +} + +/* + * bool rmdir ( const QModelIndex & index ) + */ +HB_FUNC( QT_QDIRMODEL_RMDIR ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->rmdir( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const + */ +HB_FUNC( QT_QDIRMODEL_ROWCOUNT ) +{ + hb_retni( hbqt_par_QDirModel( 1 )->rowCount( *hbqt_par_QModelIndex( 2 ) ) ); +} + +/* + * virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ) + */ +HB_FUNC( QT_QDIRMODEL_SETDATA ) +{ + hb_retl( hbqt_par_QDirModel( 1 )->setData( *hbqt_par_QModelIndex( 2 ), *hbqt_par_QVariant( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::EditRole ) ) ); +} + +/* + * void setFilter ( QDir::Filters filters ) + */ +HB_FUNC( QT_QDIRMODEL_SETFILTER ) +{ + hbqt_par_QDirModel( 1 )->setFilter( ( QDir::Filters ) hb_parni( 2 ) ); +} + +/* + * void setIconProvider ( QFileIconProvider * provider ) + */ +HB_FUNC( QT_QDIRMODEL_SETICONPROVIDER ) +{ + hbqt_par_QDirModel( 1 )->setIconProvider( hbqt_par_QFileIconProvider( 2 ) ); +} + +/* + * void setLazyChildCount ( bool enable ) + */ +HB_FUNC( QT_QDIRMODEL_SETLAZYCHILDCOUNT ) +{ + hbqt_par_QDirModel( 1 )->setLazyChildCount( hb_parl( 2 ) ); +} + +/* + * void setNameFilters ( const QStringList & filters ) + */ +HB_FUNC( QT_QDIRMODEL_SETNAMEFILTERS ) +{ + hbqt_par_QDirModel( 1 )->setNameFilters( *hbqt_par_QStringList( 2 ) ); +} + +/* + * void setReadOnly ( bool enable ) + */ +HB_FUNC( QT_QDIRMODEL_SETREADONLY ) +{ + hbqt_par_QDirModel( 1 )->setReadOnly( hb_parl( 2 ) ); +} + +/* + * void setResolveSymlinks ( bool enable ) + */ +HB_FUNC( QT_QDIRMODEL_SETRESOLVESYMLINKS ) +{ + hbqt_par_QDirModel( 1 )->setResolveSymlinks( hb_parl( 2 ) ); +} + +/* + * void setSorting ( QDir::SortFlags sort ) + */ +HB_FUNC( QT_QDIRMODEL_SETSORTING ) +{ + hbqt_par_QDirModel( 1 )->setSorting( ( QDir::SortFlags ) hb_parni( 2 ) ); +} + +/* + * virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ) + */ +HB_FUNC( QT_QDIRMODEL_SORT ) +{ + hbqt_par_QDirModel( 1 )->sort( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::SortOrder ) hb_parni( 3 ) : ( Qt::SortOrder ) Qt::AscendingOrder ) ); +} + +/* + * QDir::SortFlags sorting () const + */ +HB_FUNC( QT_QDIRMODEL_SORTING ) +{ + hb_retni( ( QDir::SortFlags ) hbqt_par_QDirModel( 1 )->sorting() ); +} + +/* + * virtual Qt::DropActions supportedDropActions () const + */ +HB_FUNC( QT_QDIRMODEL_SUPPORTEDDROPACTIONS ) +{ + hb_retni( ( Qt::DropActions ) hbqt_par_QDirModel( 1 )->supportedDropActions() ); +} + +/* + * void refresh ( const QModelIndex & parent = QModelIndex() ) + */ +HB_FUNC( QT_QDIRMODEL_REFRESH ) +{ + hbqt_par_QDirModel( 1 )->refresh( *hbqt_par_QModelIndex( 2 ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/qth/QAbstractItemView.qth b/harbour/contrib/hbqt/qth/QAbstractItemView.qth index b9d9d6f749..e8d6ca9399 100644 --- a/harbour/contrib/hbqt/qth/QAbstractItemView.qth +++ b/harbour/contrib/hbqt/qth/QAbstractItemView.qth @@ -75,16 +75,16 @@ HB_FUNC( QT_QABSTRACTITEMVIEW ) +flags EditTriggers enum DragDropMode { NoDragDrop, DragOnly, DropOnly, DragDrop, InternalMove } enum EditTrigger { NoEditTriggers, CurrentChanged, DoubleClicked, SelectedClicked, ..., AllEditTriggers } -flags EditTriggers enum ScrollHint { EnsureVisible, PositionAtTop, PositionAtBottom, PositionAtCenter } enum ScrollMode { ScrollPerItem, ScrollPerPixel } enum SelectionBehavior { SelectItems, SelectRows, SelectColumns } enum SelectionMode { SingleSelection, ContiguousSelection, ExtendedSelection, MultiSelection, NoSelection } - + bool alternatingRowColors () const int autoScrollMargin () const void closePersistentEditor ( const QModelIndex & index ) diff --git a/harbour/contrib/hbqt/qth/QDirModel.qth b/harbour/contrib/hbqt/qth/QDirModel.qth new file mode 100644 index 0000000000..485f7b19c8 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QDirModel.qth @@ -0,0 +1,133 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +Inherits = QAbstractItemModel +Type = Core +New = + + + +#include + + +/* + * QDirModel ( const QStringList & nameFilters, QDir::Filters filters, QDir::SortFlags sort, QObject * parent = 0 ) + * QDirModel ( QObject * parent = 0 ) + * ~QDirModel () + */ +HB_FUNC( QT_QDIRMODEL ) +{ + hb_retptr( ( QDirModel* ) new QDirModel( hbqt_par_QObject( 1 ) ) ); +} + + + +enum Roles { FileIconRole, FilePathRole, FileNameRole } + + + +virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const +virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const +virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) +QIcon fileIcon ( const QModelIndex & index ) const +QFileInfo fileInfo ( const QModelIndex & index ) const +QString fileName ( const QModelIndex & index ) const +QString filePath ( const QModelIndex & index ) const +QDir::Filters filter () const +virtual Qt::ItemFlags flags ( const QModelIndex & index ) const +virtual bool hasChildren ( const QModelIndex & parent = QModelIndex() ) const +virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const +QFileIconProvider * iconProvider () const +virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const +QModelIndex index ( const QString & path, int column = 0 ) const +bool isDir ( const QModelIndex & index ) const +bool isReadOnly () const +bool lazyChildCount () const +virtual QMimeData * mimeData ( const QModelIndexList & indexes ) const +virtual QStringList mimeTypes () const +QModelIndex mkdir ( const QModelIndex & parent, const QString & name ) +QStringList nameFilters () const +virtual QModelIndex parent ( const QModelIndex & child ) const +bool remove ( const QModelIndex & index ) +bool resolveSymlinks () const +bool rmdir ( const QModelIndex & index ) +virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const +virtual bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole ) +void setFilter ( QDir::Filters filters ) +void setIconProvider ( QFileIconProvider * provider ) +void setLazyChildCount ( bool enable ) +void setNameFilters ( const QStringList & filters ) +void setReadOnly ( bool enable ) +void setResolveSymlinks ( bool enable ) +void setSorting ( QDir::SortFlags sort ) +virtual void sort ( int column, Qt::SortOrder order = Qt::AscendingOrder ) +QDir::SortFlags sorting () const +virtual Qt::DropActions supportedDropActions () const + + + +void refresh ( const QModelIndex & parent = QModelIndex() ) + + + + + + + + + + diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 9372914829..78b69cca9a 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -86,7 +86,7 @@ EXIT PROCEDURE Qt_End() /*----------------------------------------------------------------------*/ PROCEDURE Main() - Local oLabel, oBtn + Local oLabel, oBtn, oDA, oTabBar Local oWnd, oSize Local oMenuBar, pIcon Local oMenuA, pAction @@ -98,16 +98,13 @@ PROCEDURE Main() pIcon := oWnd:windowIcon() /* The method 2 */ - oWnd:resize( 640, 400 ) - #if 0 - /* The method 2 */ - oSize := QSize():new() - oSize:setWidth( 640 ) - oSize:setHeight( 400 ) - oWnd:resize_1( QT_PTROF( oSize ) ) - #endif + oWnd:resize( 900, 500 ) + + oDA := QWidget():new( oWnd ) + oWnd:setCentralWidget( QT_PTROF( oDA ) ) Build_MenuBar( oWnd ) + Build_ToolBar( oWnd ) oSBar := QStatusBar():new( QT_PTROF( oWnd ) ) oWnd:setStatusBar( QT_PTROF( oSBar ) ) @@ -117,18 +114,11 @@ PROCEDURE Main() oStyle:standardIcon( 2 ) oWnd:setStyle( QT_PTROF( oStyle ) ) - oLabel := QLabel():New( QT_PTROF( oWnd ) ) - oLabel:setText( "Testing Harbour + Qt" ) - oLabel:move( 30,260 ) - oLabel:show() - - oBtn := QPushButton():new( QT_PTROF( oWnd ) ) - oBtn:setText( "Push Button" ) - oBtn:resize( 100,50 ) - oBtn:move( 30,300 ) - oBtn:show() - - Build_Grid( oWnd ) + Build_Label( oDA, { 30,190 }, { 300, 30 } ) + Build_PushButton( oDA, { 30,240 }, { 100,50 } ) + Build_Grid( oDA ) + Build_Tabs( oDA ) + Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) oWnd:Show() @@ -170,7 +160,261 @@ STATIC FUNCTION Build_MenuBar( oWnd ) /*----------------------------------------------------------------------*/ -FUNCTION MsgInfo( cMsg ) +STATIC FUNCTION Build_ToolBar( oWnd ) + LOCAL oTB, oAct + + /* Create a Toolbar Object */ + oTB := QToolBar():new( QT_PTROF( oWnd ) ) + + /* Create an action */ + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&New" ) + oAct:setIcon( "new.png" ) + oAct:setToolTip( "A New File" ) + /* Attach codeblock to be triggered */ + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + /* Attach Action with Toolbar */ + oTB:addAction( QT_PTROF( oAct ) ) + + /* Create another action */ + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Open" ) + oAct:setIcon( "open.png" ) + oAct:setToolTip( "Select a file to be opened!" ) + /* Attach codeblock to be triggered */ + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) + /* Attach Action with Toolbar */ + oTB:addAction( QT_PTROF( oAct ) ) + + oTB:addSeparator() + + /* Create another action */ + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Save" ) + oAct:setIcon( "save.png" ) + oAct:setToolTip( "Save this file!" ) + /* Attach codeblock to be triggered */ + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) + /* Attach Action with Toolbar */ + oTB:addAction( QT_PTROF( oAct ) ) + + /* Add this toolbar with main window */ + oWnd:addToolBar_1( QT_PTROF( oTB ) ) + + /////////////////////////////////////////////////////////// + + /* Build another toolbar - we will have two toolbats now */ + oTB := QToolBar():new( QT_PTROF( oWnd ) ) + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Colors" ) + oAct:setToolTip( "Colors Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Fonts" ) + oAct:setToolTip( "Fonts Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + oTB:addSeparator() + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&PgSetup" ) + oAct:setToolTip( "Page Setup Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Preview" ) + oAct:setToolTip( "Page Preview Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + oTB:addSeparator() + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Webpage" ) + oAct:setToolTip( "Web Browser Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + oAct := QAction():new( QT_PTROF( oWnd ) ) + oAct:setText( "&Wizard" ) + oAct:setToolTip( "Generic Wizard Dialog" ) + Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) + oTB:addAction( QT_PTROF( oAct ) ) + + /* Add this toolbar with main window */ + oWnd:addToolBar_1( QT_PTROF( oTB ) ) + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_PushButton( oWnd, aPos, aSize ) + + oBtn := QPushButton():new( QT_PTROF( oWnd ) ) + oBtn:setText( "Push Button" ) + oBtn:move( aPos[ 1 ],aPos[ 2 ] ) + oBtn:resize( aSize[ 1 ],aSize[ 2 ] ) + oBtn:show() + Qt_Connect_Signal( QT_PTROF( oBtn ), QT_EVE_CLICKED, {|| MsgInfo( "Push Button Pressed" ) } ) + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_Grid( oWnd ) + LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0 + + oGrid := QTableWidget():new( QT_PTROF( oWnd ) ) + oGrid:setRowCount( 2 ) + oGrid:setColumnCount( 4 ) + // + oBrushBackItem0x0 := QBrush():new() + oBrushBackItem0x0:setStyle( 1 ) // Solid Color + oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum + // + oBrushForeItem0x0 := QBrush():new() + oBrushForeItem0x0:setColor_1( 7 ) + // + oGridItem0x0 := QTableWidgetItem():new() + oGridItem0x0:setBackground( QT_PTROF( oBrushBackItem0x0 ) ) + oGridItem0x0:setForeground( QT_PTROF( oBrushForeItem0x0 ) ) + oGridItem0x0:setText( "Item 0x0" ) + // + oGrid:setItem( 0, 0, QT_PTROF( oGridItem0x0 ) ) + // + oGrid:Move( 30, 30 ) + oGrid:ReSize( 450, 150 ) + // + oGrid:Show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_Tabs( oWnd ) + LOCAL oTabWidget, oTab1, oTab2, oTab3 + + oTabWidget := QTabWidget():new( QT_PTROF( oWnd ) ) + + oTab1 := QWidget():new( QT_PTROF( oTabWidget ) ) + oTab2 := QWidget():new( QT_PTROF( oTabWidget ) ) + oTab3 := QWidget():new( QT_PTROF( oTabWidget ) ) + + oTabWidget:addTab( QT_PTROF( oTab1 ), "Folders" ) + oTabWidget:addTab( QT_PTROF( oTab2 ), "Controls" ) + oTabWidget:addTab( QT_PTROF( oTab3 ), "TextBox" ) + + oTabWidget:move( 510, 5 ) + oTabWidget:resize( 360, 400 ) + oTabWidget:show() + + Build_Treeview( oTab1 ) + Build_Controls( oTab2 ) + Build_TextBox( oTab3 ) + + RETURN { oTab1, oTab2, oTab3 } + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_TreeView( oWnd ) + LOCAL oTV, oDModel + + oTV := QTreeView():new( QT_PTROF( oWnd ) ) + + oDirModel := QDirModel():new( QT_PTROF( oTV ) ) + oTV:setModel( QT_PTROF( oDirModel ) ) + oTV:move( 5, 7 ) + oTV:resize( 345, 365 ) + OTV:show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_TextBox( oWnd ) + LOCAL oTextBox + + oTextBox := QTextEdit():new( QT_PTROF( oWnd ) ) + oTextBox:Move( 5, 7 ) + oTextBox:Resize( 345,365 ) + oTextBox:setAcceptRichText( .t. ) + oTextBox:setPlainText( "This is Harbour QT implementation" ) + oTextBox:Show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_Controls( oWnd ) + LOCAL oEdit, oCheckBox, oComboBox, oSpinBox, oRadioButton + + oEdit := QLineEdit():new( QT_PTROF( oWnd ) ) + oEdit:move( 5, 10 ) + oEdit:resize( 345, 30 ) + oEdit:setMaxLength( 40 ) + oEdit:setText( "TextBox Testing Max Length = 40" ) + oEdit:setAlignment( 1 ) // 1: Left 2: Right 4: center 8: use all textbox length + oEdit:show() + + oComboBox := QComboBox():New( QT_PTROF( oWnd ) ) + oComboBox:move( 5, 60 ) + oComboBox:resize( 345, 30 ) + oComboBox:show() + + oCheckBox := QCheckBox():New( QT_PTROF( oWnd ) ) + oCheckBox:setText( "Testing CheckBox HbQt" ) + oCheckBox:move( 5, 110 ) + oCheckBox:resize( 345, 30 ) + oCheckBox:show() + + oSpinBox := QSpinBox():New( QT_PTROF( oWnd ) ) + oSpinBox:Move( 5, 160 ) + oSpinBox:ReSize( 345, 30 ) + oSpinBox:Show() + + oRadioButton := QRadioButton():New( QT_PTROF( oWnd ) ) + oRadioButton:Move( 5, 210 ) + oRadioButton:ReSize( 345, 30 ) + oRadioButton:Show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_ProgressBar( oWnd, aPos, aSize ) + LOCAL oProgressBar + + oProgressBar := QProgressBar():New( QT_PTROF( oWnd ) ) + oProgressBar:SetRange( 1, 1500 ) + oProgressBar:Setvalue( 500 ) + oProgressBar:Move( aPos[ 1 ], aPos[ 2 ] ) + oProgressBar:ReSize( aSize[ 1 ], aSize[ 2 ] ) + oProgressBar:Show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION Build_Label( oWnd, aPos, aSize ) + LOCAL oLabel + + oLabel := QLabel():New( QT_PTROF( oWnd ) ) + oLabel:SetTextFormat( 1 ) // 0 text plain 1 RichText + oLabel:SetText( [This is a Label in Harbour QT] ) + oLabel:Move( aPos[ 1 ], aPos[ 2 ] ) + oLabel:ReSize( aSize[ 1 ], aSize[ 2 ] ) + oLabel:Show() + + RETURN nil + +/*----------------------------------------------------------------------*/ + +STATIC FUNCTION MsgInfo( cMsg ) LOCAL oMB oMB := QMessageBox():new() @@ -427,33 +671,3 @@ STATIC FUNCTION Dummies() /*----------------------------------------------------------------------*/ -STATIC FUNCTION Build_Grid( oWnd ) - LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0 - - oGrid := QTableWidget():new( QT_PTROF( oWnd ) ) - oGrid:setRowCount( 2 ) - oGrid:setColumnCount( 4 ) - // - oBrushBackItem0x0 := QBrush():new() - oBrushBackItem0x0:setStyle( 1 ) // Solid Color - oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum - // - oBrushForeItem0x0 := QBrush():new() - oBrushForeItem0x0:setColor_1( 7 ) - // - oGridItem0x0 := QTableWidgetItem():new() - oGridItem0x0:setBackground( oBrushBackItem0x0:pPtr ) - oGridItem0x0:setForeground( oBrushForeItem0x0:pPtr ) - oGridItem0x0:setText( "Item 0x0" ) - // - oGrid:setItem( 0, 0, oGridItem0x0:pPtr ) - // - oGrid:Move( 30 , 50 ) - oGrid:ReSize( 550 , 200 ) - // - oGrid:Show() - - RETURN nil - -/*----------------------------------------------------------------------*/ -