From de81d88417c39e2c90918428fbfedb6a28bdb0c8 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 7 Aug 2009 19:33:41 +0000 Subject: [PATCH] 2009-08-07 12:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/qth/QAbstractItemView.qth ! Fixed one artifact causing limited sources. * contrib/hbqt/hbqt_slots.cpp * contrib/hbqt/hbqt_slots.h * contrib/hbqt/moc_slots.cpp * contrib/hbqt/QAbstractItemView.cpp * contrib/hbqt/TQAbstractItemView.prg + Added more event handlers. ! Fine tuned sub-classes. --- harbour/ChangeLog | 12 ++ harbour/contrib/hbqt/QAbstractItemView.cpp | 17 +- harbour/contrib/hbqt/TQAbstractItemView.prg | 1 + harbour/contrib/hbqt/hbqt_slots.cpp | 153 +++++++++++++++++- harbour/contrib/hbqt/hbqt_slots.h | 15 ++ harbour/contrib/hbqt/moc_slots.cpp | 59 ++++++- .../contrib/hbqt/qth/QAbstractItemView.qth | 3 +- 7 files changed, 243 insertions(+), 17 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9417f7d8e2..ef2f9a9766 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,18 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-07 12:30 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/qth/QAbstractItemView.qth + ! Fixed one artifact causing limited sources. + + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_slots.h + * contrib/hbqt/moc_slots.cpp + * contrib/hbqt/QAbstractItemView.cpp + * contrib/hbqt/TQAbstractItemView.prg + + Added more event handlers. + ! Fine tuned sub-classes. + 2009-08-07 19:05 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * bin/postinst.cmd * bin/postinst.bat diff --git a/harbour/contrib/hbqt/QAbstractItemView.cpp b/harbour/contrib/hbqt/QAbstractItemView.cpp index daa4da26bd..cd2280709e 100644 --- a/harbour/contrib/hbqt/QAbstractItemView.cpp +++ b/harbour/contrib/hbqt/QAbstractItemView.cpp @@ -70,15 +70,6 @@ * enum SelectionMode { SingleSelection, ContiguousSelection, ExtendedSelection, MultiSelection, NoSelection } */ -/* - * Constructed[ 62/63 [ 98.41% ] ] - * - * *** Unconvered Prototypes *** - * ----------------------------- - * - * void update ( const QModelIndex & index - */ - #include @@ -596,6 +587,14 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_SETROOTINDEX ) hbqt_par_QAbstractItemView( 1 )->setRootIndex( *hbqt_par_QModelIndex( 2 ) ); } +/* + * void update ( const QModelIndex & index ) + */ +HB_FUNC( QT_QABSTRACTITEMVIEW_UPDATE ) +{ + hbqt_par_QAbstractItemView( 1 )->update( *hbqt_par_QModelIndex( 2 ) ); +} + /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/TQAbstractItemView.prg b/harbour/contrib/hbqt/TQAbstractItemView.prg index 53c32c09d3..c2580114e1 100644 --- a/harbour/contrib/hbqt/TQAbstractItemView.prg +++ b/harbour/contrib/hbqt/TQAbstractItemView.prg @@ -128,6 +128,7 @@ CREATE CLASS QAbstractItemView INHERIT QAbstractScrollArea METHOD selectAll() INLINE Qt_QAbstractItemView_selectAll( ::pPtr ) METHOD setCurrentIndex( pIndex ) INLINE Qt_QAbstractItemView_setCurrentIndex( ::pPtr, pIndex ) METHOD setRootIndex( pIndex ) INLINE Qt_QAbstractItemView_setRootIndex( ::pPtr, pIndex ) + METHOD update( pIndex ) INLINE Qt_QAbstractItemView_update( ::pPtr, pIndex ) ENDCLASS diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 18f597167c..7478629d4d 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -63,6 +63,8 @@ #include "hbqt_slots.h" +// #include //////////////////////////////////////////////////// + #include #include #include @@ -149,6 +151,26 @@ static void SlotsExecIntInt( QObject* object, char* event, int iValue1, int iVal } } +static void SlotsExecIntIntInt( QObject* object, char* event, int iValue1, int iValue2, int iValue3 ) +{ + if( object ) + { + int i = object->property( event ).toInt(); + if( i > 0 && ( s_s->listActv.at( i - 1 ) == true ) ) + { + PHB_ITEM pObject = hb_itemPutPtr( NULL, ( QObject* ) object ); + PHB_ITEM pValue1 = hb_itemPutNI( NULL, iValue1 ); + PHB_ITEM pValue2 = hb_itemPutNI( NULL, iValue2 ); + PHB_ITEM pValue3 = hb_itemPutNI( NULL, iValue3 ); + hb_vmEvalBlockV( ( PHB_ITEM ) s_s->listBlock.at( i - 1 ), 4, pObject, pValue1, pValue2, pValue3 ); + hb_itemRelease( pObject ); + hb_itemRelease( pValue1 ); + hb_itemRelease( pValue2 ); + hb_itemRelease( pValue3 ); + } + } +} + static void SlotsExecIntIntRect( QObject* object, char* event, int iValue1, int iValue2, const QRect & rect ) { if( object ) @@ -857,6 +879,66 @@ void Slots::timeout() QObject *object = qobject_cast( sender() ); SlotsExec( object, ( char* ) "timeout()" ); } +void Slots::scrollContentsBy( int x, int y ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntInt( object, ( char* ) "scrollContentsBy(int,int)", x, y ); +} +void Slots::geometriesChanged() +{ + QObject *object = qobject_cast( sender() ); + SlotsExec( object, ( char* ) "geometriesChanged()" ); +} +void Slots::sectionAutoResize( int logicalIndex, QHeaderView::ResizeMode mode ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntInt( object, ( char* ) "sectionAutoResize(int,int)", logicalIndex, mode ); +} +void Slots::sectionClicked( int logicalIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecInt( object, ( char* ) "sectionClicked(int)", logicalIndex ); +} +void Slots::sectionCountChanged( int oldCount, int newCount ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntInt( object, ( char* ) "sectionCountChanged(int,int)", oldCount, newCount ); +} +void Slots::sectionDoubleClicked( int logicalIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecInt( object, ( char* ) "sectionDoubleClicked(int)", logicalIndex ); +} +void Slots::sectionEntered( int logicalIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecInt( object, ( char* ) "sectionEntered(int)", logicalIndex ); +} +void Slots::sectionHandleDoubleClicked( int logicalIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecInt( object, ( char* ) "sectionHandleDoubleClicked(int)", logicalIndex ); +} +void Slots::sectionMoved( int logicalIndex, int oldVisualIndex, int newVisualIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntIntInt( object, ( char* ) "sectionMoved(int,int,int)", logicalIndex, oldVisualIndex, newVisualIndex ); +} +void Slots::sectionPressed( int logicalIndex ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecInt( object, ( char* ) "sectionPressed(int)", logicalIndex ); +} +void Slots::sectionResized( int logicalIndex, int oldSize, int newSize ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntIntInt( object, ( char* ) "sectionResized(int,int,int)", logicalIndex, oldSize, newSize ); +} +void Slots::sortIndicatorChanged( int logicalIndex, Qt::SortOrder order ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecIntInt( object, ( char* ) "sortIndicatorChanged(int,int)", logicalIndex, order ); +} /* @@ -1316,6 +1398,66 @@ HB_FUNC( QT_CONNECT_SIGNAL ) ret = object->connect( object, SIGNAL( sg_resizeEvent( QResizeEvent * ) ), s_s, SLOT( resizeEvent( QResizeEvent * ) ), Qt::AutoConnection ); } + if( signal == ( QString ) "scrollContentsBy(int,int)" ) + { + ret = object->connect( object, SIGNAL( sg_scrollContentsBy( int, int ) ), + s_s, SLOT( scrollContentsBy( int, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "geometriesChanged()" ) + { + ret = object->connect( object, SIGNAL( geometriesChanged() ), + s_s, SLOT( geometriesChanged() ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionAutoResize(int,int)" ) + { + ret = object->connect( object, SIGNAL( sectionAutoResize( int, QHeaderView::ResizeMode ) ), + s_s, SLOT( sectionAutoResize( int, QHeaderView::ResizeMode ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionClicked(int)" ) + { + ret = object->connect( object, SIGNAL( sectionClicked( int ) ), + s_s, SLOT( sectionClicked( int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionCountChanged(int,int)" ) + { + ret = object->connect( object, SIGNAL( sectionCountChanged( int, int ) ), + s_s, SLOT( sectionCountChanged( int, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionDoubleClicked(int)" ) + { + ret = object->connect( object, SIGNAL( sectionDoubleClicked( int ) ), + s_s, SLOT( sectionDoubleClicked( int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionEntered(int)" ) + { + ret = object->connect( object, SIGNAL( sectionEntered( int ) ), + s_s, SLOT( sectionEntered( int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionHandleDoubleClicked(int)" ) + { + ret = object->connect( object, SIGNAL( sectionHandleDoubleClicked( int ) ), + s_s, SLOT( sectionHandleDoubleClicked( int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionMoved(int,int,int)" ) + { + ret = object->connect( object, SIGNAL( sectionMoved( int, int, int ) ), + s_s, SLOT( sectionMoved( int, int, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionPressed(int)" ) + { + ret = object->connect( object, SIGNAL( sectionPressed( int ) ), + s_s, SLOT( sectionPressed( int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sectionResized(int,int,int)" ) + { + ret = object->connect( object, SIGNAL( sectionResized( int, int, int ) ), + s_s, SLOT( sectionResized( int, int, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "sortIndicatorChanged(int,int)" ) + { + ret = object->connect( object, SIGNAL( sortIndicatorChanged( int, Qt::SortOrder ) ), + s_s, SLOT( sortIndicatorChanged( int, Qt::SortOrder ) ), Qt::AutoConnection ); + } hb_retl( ret ); @@ -1584,7 +1726,6 @@ HB_FUNC( QT_QDEBUG ) /*----------------------------------------------------------------------*/ HbTableView::HbTableView( QWidget * parent ) : QTableView( parent ) -//HbTableView::HbTableView( QWidget * parent ) : QTableWidget( parent ) { } HbTableView::~HbTableView() @@ -1625,6 +1766,16 @@ QModelIndex HbTableView::navigate( int cursorAction ) { return moveCursor( ( HbTableView::CursorAction ) cursorAction, ( Qt::KeyboardModifiers ) 0 ); } +void HbTableView::scrollContentsBy( int x, int y ) +{ + emit sg_scrollContentsBy( x, y ); +} +void HbTableView::scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint ) +{ +//char str[ 50 ]; hb_snprintf( str, sizeof( str ), "HbTableView:scrollTo row = %i col = %i", index.row(),index.column() ); OutputDebugString( str ); + QTableView::scrollTo( index, hint ); +} + /*----------------------------------------------------------------------*/ #if 0 diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index c726e3c585..1a2164f31d 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -117,6 +117,8 @@ public: void mousePressEvent( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); void resizeEvent( QResizeEvent * event ); + void scrollContentsBy( int x, int y ); + void scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible ); QModelIndex navigate( int cursorAction ); @@ -130,6 +132,7 @@ signals: void sg_mouseReleaseEvent( QMouseEvent * event ); void sg_resizeEvent( QResizeEvent * event ); void sg_moveCursor( HbTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers ); + void sg_scrollContentsBy( int x, int y ); }; /*----------------------------------------------------------------------*/ @@ -270,6 +273,18 @@ public slots: void mouseReleaseEvent( QMouseEvent * event ); void mouseDoubleClickEvent( QMouseEvent * event ); void resizeEvent( QResizeEvent * event ); + void scrollContentsBy( int x, int y ); + void geometriesChanged(); + void sectionAutoResize( int logicalIndex, QHeaderView::ResizeMode mode ); + void sectionClicked( int logicalIndex ); + void sectionCountChanged( int oldCount, int newCount ); + void sectionDoubleClicked( int logicalIndex ); + void sectionEntered( int logicalIndex ); + void sectionHandleDoubleClicked( int logicalIndex ); + void sectionMoved( int logicalIndex, int oldVisualIndex, int newVisualIndex ); + void sectionPressed( int logicalIndex ); + void sectionResized( int logicalIndex, int oldSize, int newSize ); + void sortIndicatorChanged( int logicalIndex, Qt::SortOrder order ); }; class Events: public QObject diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index b09d880504..89cce746f2 100644 --- a/harbour/contrib/hbqt/moc_slots.cpp +++ b/harbour/contrib/hbqt/moc_slots.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'hbqt_slots.h' ** -** Created: Sun Jul 26 20:16:21 2009 +** Created: Thu Aug 6 17:41:56 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0) ** ** WARNING! All changes made in this file will be lost! @@ -66,7 +66,7 @@ static const uint qt_meta_data_HbTableView[] = { 2, // revision 0, // classname 0, 0, // classinfo - 7, 12, // methods + 8, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -79,6 +79,7 @@ static const uint qt_meta_data_HbTableView[] = { 152, 13, 12, 12, 0x05, 187, 13, 12, 12, 0x05, 240, 217, 12, 12, 0x05, + 307, 303, 12, 12, 0x05, 0 // eod }; @@ -92,6 +93,7 @@ static const char qt_meta_stringdata_HbTableView[] = { "sg_resizeEvent(QResizeEvent*)\0" "cursorAction,modifiers\0" "sg_moveCursor(HbTableView::CursorAction,Qt::KeyboardModifiers)\0" + "x,y\0sg_scrollContentsBy(int,int)\0" }; const QMetaObject HbTableView::staticMetaObject = { @@ -126,9 +128,10 @@ int HbTableView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 4: sg_mouseReleaseEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 5: sg_resizeEvent((*reinterpret_cast< QResizeEvent*(*)>(_a[1]))); break; case 6: sg_moveCursor((*reinterpret_cast< HbTableView::CursorAction(*)>(_a[1])),(*reinterpret_cast< Qt::KeyboardModifiers(*)>(_a[2]))); break; + case 7: sg_scrollContentsBy((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; default: ; } - _id -= 7; + _id -= 8; } return _id; } @@ -181,6 +184,13 @@ void HbTableView::sg_moveCursor(HbTableView::CursorAction _t1, Qt::KeyboardModif void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; QMetaObject::activate(this, &staticMetaObject, 6, _a); } + +// SIGNAL 7 +void HbTableView::sg_scrollContentsBy(int _t1, int _t2) +{ + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + QMetaObject::activate(this, &staticMetaObject, 7, _a); +} static const uint qt_meta_data_MyMainWindow[] = { // content: @@ -301,7 +311,7 @@ static const uint qt_meta_data_Slots[] = { 2, // revision 0, // classname 0, 0, // classinfo - 88, 12, // methods + 100, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -395,6 +405,18 @@ static const uint qt_meta_data_Slots[] = { 2364, 2245, 6, 6, 0x0a, 2396, 2245, 6, 6, 0x0a, 2432, 2245, 6, 6, 0x0a, + 2463, 2459, 6, 6, 0x0a, + 2489, 6, 6, 6, 0x0a, + 2527, 2509, 6, 6, 0x0a, + 2587, 2574, 6, 6, 0x0a, + 2625, 2607, 6, 6, 0x0a, + 2654, 2574, 6, 6, 0x0a, + 2680, 2574, 6, 6, 0x0a, + 2700, 2574, 6, 6, 0x0a, + 2775, 2732, 6, 6, 0x0a, + 2801, 2574, 6, 6, 0x0a, + 2850, 2821, 6, 6, 0x0a, + 2897, 2878, 6, 6, 0x0a, 0 // eod }; @@ -467,7 +489,20 @@ static const char qt_meta_stringdata_Slots[] = { "mousePressEvent(QMouseEvent*)\0" "mouseReleaseEvent(QMouseEvent*)\0" "mouseDoubleClickEvent(QMouseEvent*)\0" - "resizeEvent(QResizeEvent*)\0" + "resizeEvent(QResizeEvent*)\0x,y\0" + "scrollContentsBy(int,int)\0geometriesChanged()\0" + "logicalIndex,mode\0" + "sectionAutoResize(int,QHeaderView::ResizeMode)\0" + "logicalIndex\0sectionClicked(int)\0" + "oldCount,newCount\0sectionCountChanged(int,int)\0" + "sectionDoubleClicked(int)\0sectionEntered(int)\0" + "sectionHandleDoubleClicked(int)\0" + "logicalIndex,oldVisualIndex,newVisualIndex\0" + "sectionMoved(int,int,int)\0sectionPressed(int)\0" + "logicalIndex,oldSize,newSize\0" + "sectionResized(int,int,int)\0" + "logicalIndex,order\0" + "sortIndicatorChanged(int,Qt::SortOrder)\0" }; const QMetaObject Slots::staticMetaObject = { @@ -583,9 +618,21 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 85: mouseReleaseEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 86: mouseDoubleClickEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 87: resizeEvent((*reinterpret_cast< QResizeEvent*(*)>(_a[1]))); break; + case 88: scrollContentsBy((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 89: geometriesChanged(); break; + case 90: sectionAutoResize((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QHeaderView::ResizeMode(*)>(_a[2]))); break; + case 91: sectionClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 92: sectionCountChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 93: sectionDoubleClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 94: sectionEntered((*reinterpret_cast< int(*)>(_a[1]))); break; + case 95: sectionHandleDoubleClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 96: sectionMoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 97: sectionPressed((*reinterpret_cast< int(*)>(_a[1]))); break; + case 98: sectionResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 99: sortIndicatorChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Qt::SortOrder(*)>(_a[2]))); break; default: ; } - _id -= 88; + _id -= 100; } return _id; } diff --git a/harbour/contrib/hbqt/qth/QAbstractItemView.qth b/harbour/contrib/hbqt/qth/QAbstractItemView.qth index e8d6ca9399..38b7ed187f 100644 --- a/harbour/contrib/hbqt/qth/QAbstractItemView.qth +++ b/harbour/contrib/hbqt/qth/QAbstractItemView.qth @@ -150,7 +150,8 @@ void scrollToTop () virtual void selectAll () void setCurrentIndex ( const QModelIndex & index ) virtual void setRootIndex ( const QModelIndex & index ) -void update ( const QModelIndex & index ) +void update ( const QModelIndex & index ) + void activated ( const QModelIndex & index )