From be1a0ff9d9abfa487a4041408b99828b8b85c6fe Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 22 Jun 2009 05:13:40 +0000 Subject: [PATCH] 2009-06-21 22:11 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/hbqt_slots.cpp * harbour/contrib/hbqt/hbqt_slots.h * harbour/contrib/hbqt/moc_slots.cpp + Added more event handlers. --- harbour/ChangeLog | 6 ++ harbour/contrib/hbqt/hbqt_slots.cpp | 143 ++++++++++++++++++++++++++++ harbour/contrib/hbqt/hbqt_slots.h | 15 ++- harbour/contrib/hbqt/moc_slots.cpp | 38 +++++++- 4 files changed, 196 insertions(+), 6 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d1970b678d..76ee0fa154 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-21 22:11 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbqt/hbqt_slots.cpp + * harbour/contrib/hbqt/hbqt_slots.h + * harbour/contrib/hbqt/moc_slots.cpp + + Added more event handlers. + 2009-06-21 20:54 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL + Added iccia64 build example. diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index c7ce95bd42..09841d04d8 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -401,6 +401,95 @@ void Slots::textEdited( const QString & text ) QWidget *widget = qobject_cast( sender() ); SlotsExecString( widget, ( char* ) "textEdited(QString)", text ); } +/* TreeViewWidget */ +void Slots::currentItemChanged( QTreeWidgetItem * current, QTreeWidgetItem * previous ) +{ + QWidget *widget = qobject_cast( sender() ); + if( widget ) + { + int i = widget->property( "currentItemChanged(QTWItem)" ).toInt(); + if( ( i > 0 ) && ( s->listActv.at( i-1 ) == true ) ) + { + PHB_ITEM pWidget = hb_itemPutPtr( NULL, widget ); + PHB_ITEM pItemC = hb_itemPutPtr( NULL, current ); + PHB_ITEM pItemP = hb_itemPutPtr( NULL, previous ); + hb_vmEvalBlockV( ( PHB_ITEM ) s->listBlock.at( i-1 ), 3, pWidget, pItemC, pItemP ); + hb_itemRelease( pWidget ); + hb_itemRelease( pItemC ); + hb_itemRelease( pItemP ); + } + } +} +static void SlotsExecTreeWidgetItemInt( QWidget * widget, char* event, QTreeWidgetItem * item, int column ) +{ + if( widget ) + { + int i = widget->property( event ).toInt(); + if( ( i > 0 ) && ( s->listActv.at( i-1 ) == true ) ) + { + PHB_ITEM pWidget = hb_itemPutPtr( NULL, widget ); + PHB_ITEM pItem = hb_itemPutPtr( NULL, item ); + if( column != -1001 ) + { + PHB_ITEM pColumn = hb_itemPutNI( NULL, column ); + hb_vmEvalBlockV( ( PHB_ITEM ) s->listBlock.at( i-1 ), 3, pWidget, pItem, pColumn ); + hb_itemRelease( pColumn ); + } + else + { + hb_vmEvalBlockV( ( PHB_ITEM ) s->listBlock.at( i-1 ), 2, pWidget, pItem ); + } + hb_itemRelease( pWidget ); + hb_itemRelease( pItem ); + } + } +} +void Slots::itemActivated( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemActivated(QTWItem)", item, column ); +} +void Slots::itemChanged( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemChanged(QTWItem)", item, column ); +} +void Slots::itemClicked( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemClicked(QTWItem)", item, column ); +} +void Slots::itemDoubleClicked( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemDoubleClicked(QTWItem)", item, column ); +} +void Slots::itemEntered( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemEntered(QTWItem)", item, column ); +} +void Slots::itemPressed( QTreeWidgetItem * item, int column ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemPressed(QTWItem)", item, column ); +} +void Slots::itemExpanded( QTreeWidgetItem * item ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemExpanded(QTWItem)", item, -1001 ); +} +void Slots::itemCollapsed( QTreeWidgetItem * item ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecTreeWidgetItemInt( widget, ( char* ) "itemCollapsed(QTWItem)", item, -1001 ); +} +void Slots::itemSelectionChanged() +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExec( widget, ( char* ) "itemSelectionChanged()" ); +} + /* @@ -567,6 +656,60 @@ HB_FUNC( QT_CONNECT_SIGNAL ) ret = widget->connect( widget, SIGNAL( textEdited( const QString &) ), s, SLOT( textEdited( const QString & ) ), Qt::AutoConnection ); } + /* QTreeViewWidget */ + if( signal == ( QString ) "currentItemChanged(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), + s, SLOT( currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemActivated(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemActivated( QTreeWidgetItem *, int ) ), + s, SLOT( itemActivated( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemChanged(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemChanged( QTreeWidgetItem *, int ) ), + s, SLOT( itemChanged( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemClicked(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), + s, SLOT( itemClicked( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemCollapsed(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemCollapsed( QTreeWidgetItem * ) ), + s, SLOT( itemCollapsed( QTreeWidgetItem * ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemDoubleClicked(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemDoubleClicked( QTreeWidgetItem *, int ) ), + s, SLOT( itemDoubleClicked( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemEntered(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemEntered( QTreeWidgetItem *, int ) ), + s, SLOT( itemEntered( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemExpanded(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemExpanded( QTreeWidgetItem * ) ), + s, SLOT( itemExpanded( QTreeWidgetItem * ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemPressed(QTWItem)" ) + { + ret = widget->connect( widget, SIGNAL( itemPressed( QTreeWidgetItem *, int ) ), + s, SLOT( itemPressed( QTreeWidgetItem *, int ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "itemSelectionChanged()" ) + { + ret = widget->connect( widget, SIGNAL( itemSelectionChanged() ), + s, SLOT( itemSelectionChanged() ), Qt::AutoConnection ); + } + + + hb_retl( ret ); diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index bb791d92c7..e306000ed5 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -65,6 +65,8 @@ #include #include #include +#include +#include #include "hbapi.h" #include "hbapiitm.h" @@ -148,6 +150,17 @@ public slots: void selectionChanged(); void textChanged( const QString & text ); void textEdited( const QString & text ); + /* QTreeWidget */ + void currentItemChanged( QTreeWidgetItem * current, QTreeWidgetItem * previous ); + void itemActivated( QTreeWidgetItem * item, int column ); + void itemChanged( QTreeWidgetItem * item, int column ); + void itemClicked( QTreeWidgetItem * item, int column ); + void itemCollapsed( QTreeWidgetItem * item ); + void itemDoubleClicked( QTreeWidgetItem * item, int column ); + void itemEntered( QTreeWidgetItem * item, int column ); + void itemExpanded( QTreeWidgetItem * item ); + void itemPressed( QTreeWidgetItem * item, int column ); + void itemSelectionChanged(); }; class Events: public QObject @@ -157,8 +170,6 @@ class Events: public QObject public: Events( QObject *parent = 0 ); ~Events(); - //QList list1; - //QList list2; QList listBlock; QList listActv; diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index 07fcc6f815..695433e6a3 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: Sat Jun 20 01:36:16 2009 +** Created: Sun Jun 21 14:24:40 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0) ** ** WARNING! All changes made in this file will be lost! @@ -137,7 +137,7 @@ static const uint qt_meta_data_Slots[] = { 2, // revision 0, // classname 0, 0, // classinfo - 30, 12, // methods + 40, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -173,6 +173,16 @@ static const uint qt_meta_data_Slots[] = { 564, 6, 6, 6, 0x0a, 588, 583, 6, 6, 0x0a, 609, 583, 6, 6, 0x0a, + 646, 629, 6, 6, 0x0a, + 712, 700, 6, 6, 0x0a, + 748, 700, 6, 6, 0x0a, + 782, 700, 6, 6, 0x0a, + 821, 816, 6, 6, 0x0a, + 853, 700, 6, 6, 0x0a, + 893, 700, 6, 6, 0x0a, + 927, 816, 6, 6, 0x0a, + 958, 700, 6, 6, 0x0a, + 992, 6, 6, 6, 0x0a, 0 // eod }; @@ -195,7 +205,17 @@ static const char qt_meta_stringdata_Slots[] = { "iOld,iNew\0cursorPositionChanged(int,int)\0" "editingFinished()\0returnPressed()\0" "selectionChanged()\0text\0textChanged(QString)\0" - "textEdited(QString)\0" + "textEdited(QString)\0current,previous\0" + "currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)\0" + "item,column\0itemActivated(QTreeWidgetItem*,int)\0" + "itemChanged(QTreeWidgetItem*,int)\0" + "itemClicked(QTreeWidgetItem*,int)\0" + "item\0itemCollapsed(QTreeWidgetItem*)\0" + "itemDoubleClicked(QTreeWidgetItem*,int)\0" + "itemEntered(QTreeWidgetItem*,int)\0" + "itemExpanded(QTreeWidgetItem*)\0" + "itemPressed(QTreeWidgetItem*,int)\0" + "itemSelectionChanged()\0" }; const QMetaObject Slots::staticMetaObject = { @@ -253,9 +273,19 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 27: selectionChanged(); break; case 28: textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; case 29: textEdited((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 30: currentItemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< QTreeWidgetItem*(*)>(_a[2]))); break; + case 31: itemActivated((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 32: itemChanged((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 33: itemClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 34: itemCollapsed((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; + case 35: itemDoubleClicked((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 36: itemEntered((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 37: itemExpanded((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1]))); break; + case 38: itemPressed((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 39: itemSelectionChanged(); break; default: ; } - _id -= 30; + _id -= 40; } return _id; }