From a5bfcfd9c0d916368545cc9cfc1dc947d0197b5a Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 19 Aug 2009 01:49:07 +0000 Subject: [PATCH] 2009-08-18 18:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbqt/hbqt.ch * contrib/hbqt/hbqt_slots.cpp * contrib/hbqt/hbqt_slots.h * contrib/hbqt/moc_slots.cpp + Added more event handlers. --- harbour/ChangeLog | 7 ++ harbour/contrib/hbqt/hbqt.ch | 36 +++++++++ harbour/contrib/hbqt/hbqt_slots.cpp | 23 +++++- harbour/contrib/hbqt/hbqt_slots.h | 3 + harbour/contrib/hbqt/moc_slots.cpp | 111 ++++++++++++++++------------ 5 files changed, 128 insertions(+), 52 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 543185d792..08dceeb6f4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,13 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-08-18 18:46 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt.ch + * contrib/hbqt/hbqt_slots.cpp + * contrib/hbqt/hbqt_slots.h + * contrib/hbqt/moc_slots.cpp + + Added more event handlers. + 2009-08-18 23:32 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/config/win/bcc.mk * eliminated IF EXIST command and updated to work with non NT shells. diff --git a/harbour/contrib/hbqt/hbqt.ch b/harbour/contrib/hbqt/hbqt.ch index 7f16e1fa4a..535c4c74c7 100644 --- a/harbour/contrib/hbqt/hbqt.ch +++ b/harbour/contrib/hbqt/hbqt.ch @@ -2076,6 +2076,42 @@ #define QHeaderView_Stretch 1 // QHeaderView will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically. #define QHeaderView_ResizeToContents 3 // QHeaderView will automatically resize the section to its optimal size based on the contents of the entire column or row. The size cannot be changed by the user or programmatically. (This value was introduced in 4.2) +#define QSizePolicy_DefaultType 0x00000001 // The default type, when none is specified. +#define QSizePolicy_ButtonBox 0x00000002 // A QDialogButtonBox instance. +#define QSizePolicy_CheckBox 0x00000004 // A QCheckBox instance. +#define QSizePolicy_ComboBox 0x00000008 // A QComboBox instance. +#define QSizePolicy_Frame 0x00000010 // A QFrame instance. +#define QSizePolicy_GroupBox 0x00000020 // A QGroupBox instance. +#define QSizePolicy_Label 0x00000040 // A QLabel instance. +#define QSizePolicy_Line 0x00000080 // A QFrame instance with QFrame::HLine or QFrame::VLine. +#define QSizePolicy_LineEdit 0x00000100 // A QLineEdit instance. +#define QSizePolicy_PushButton 0x00000200 // A QPushButton instance. +#define QSizePolicy_RadioButton 0x00000400 // A QRadioButton instance. +#define QSizePolicy_Slider 0x00000800 // A QAbstractSlider instance. +#define QSizePolicy_SpinBox 0x00001000 // A QAbstractSpinBox instance. +#define QSizePolicy_TabWidget 0x00002000 // A QTabWidget instance. +#define QSizePolicy_ToolButton 0x00004000 // A QToolButton instance. +// The ControlTypes type is a typedef for QFlags. It stores an OR combination of ControlType values. + +// enum QSizePolicy::Policy +// This enum describes the various per-dimension sizing types used when constructing a QSizePolicy. +// +#define QSizePolicy_Fixed 0 // The QWidget::sizeHint() is the only acceptable alternative, so the widget can never grow or shrink (e.g. the vertical direction of a push button). +#define QSizePolicy_Minimum QSizePolicy_GrowFlag // The sizeHint() is minimal, and sufficient. The widget can be expanded, but there is no advantage to it being larger (e.g. the horizontal direction of a push button). It cannot be smaller than the size provided by sizeHint(). +#define QSizePolicy_Maximum QSizePolicy_ShrinkFlag // The sizeHint() is a maximum. The widget can be shrunk any amount without detriment if other widgets need the space (e.g. a separator line). It cannot be larger than the size provided by sizeHint(). +#define QSizePolicy_Preferred QSizePolicy_GrowFlag + QSizePolicy_ShrinkFlag // The sizeHint() is best, but the widget can be shrunk and still be useful. The widget can be expanded, but there is no advantage to it being larger than sizeHint() (the default QWidget policy). +#define QSizePolicy_Expanding QSizePolicy_GrowFlag + QSizePolicy_ShrinkFlag + QSizePolicy_ExpandFlag // The sizeHint() is a sensible size, but the widget can be shrunk and still be useful. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a horizontal slider). +#define QSizePolicy_MinimumExpanding QSizePolicy_GrowFlag + QSizePolicy_ExpandFlag // The sizeHint() is minimal, and sufficient. The widget can make use of extra space, so it should get as much space as possible (e.g. the horizontal direction of a horizontal slider). +#define QSizePolicy_Ignored QSizePolicy_ShrinkFlag + QSizePolicy_GrowFlag + QSizePolicy_IgnoreFlag // The sizeHint() is ignored. The widget will get as much space as possible. + +// enum QSizePolicy::PolicyFlag +// These flags are combined together to form the various Policy values: +// +#define QSizePolicy_GrowFlag 1 // The widget can grow beyond its size hint if necessary. +#define QSizePolicy_ExpandFlag 2 // The widget should get as much space as possible. +#define QSizePolicy_ShrinkFlag 4 // The widget can shrink below its size hint if necessary. +#define QSizePolicy_IgnoreFlag 8 // The widget's size hint is ignored. The widget will get as much space as possible. + /*----------------------------------------------------------------------*/ #define _HBQT_CH diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 34dc74146a..c643216547 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -458,6 +458,11 @@ void Slots::mouseReleaseEvent( QMouseEvent * event ) QObject *object = qobject_cast( sender() ); SlotsExecPointer( object, ( char* ) "mouseReleaseEvent()", event ); } +void Slots::wheelEvent( QWheelEvent * event ) +{ + QObject *object = qobject_cast( sender() ); + SlotsExecPointer( object, ( char* ) "wheelEvent()", event ); +} void Slots::resizeEvent( QResizeEvent * event ) { QObject *object = qobject_cast( sender() ); @@ -1417,6 +1422,11 @@ HB_FUNC( QT_CONNECT_SIGNAL ) ret = object->connect( object, SIGNAL( sg_mouseReleaseEvent( QMouseEvent * ) ), s_s, SLOT( mouseReleaseEvent( QMouseEvent * ) ), Qt::AutoConnection ); } + if( signal == ( QString ) "wheelEvent()" ) + { + ret = object->connect( object, SIGNAL( sg_wheelEvent( QWheelEvent * ) ), + s_s, SLOT( wheelEvent( QWheelEvent * ) ), Qt::AutoConnection ); + } if( signal == ( QString ) "resizeEvent()" ) { ret = object->connect( object, SIGNAL( sg_resizeEvent( QResizeEvent * ) ), @@ -1800,6 +1810,10 @@ void HbTableView::mouseReleaseEvent( QMouseEvent * event ) { emit sg_mouseReleaseEvent( event ); } +void HbTableView::wheelEvent( QWheelEvent * event ) +{ + emit sg_wheelEvent( event ); +} void HbTableView::resizeEvent( QResizeEvent * event ) { emit sg_resizeEvent( event ); @@ -1837,16 +1851,19 @@ Qt_WhatsThisRole 5 Qt_SizeHintRole 13 #endif #define HBQT_BRW_CELLVALUE 1001 + #define HBQT_BRW_COLCOUNT 1002 #define HBQT_BRW_ROWCOUNT 1003 + #define HBQT_BRW_COLHEADER 1004 -#define HBQT_BRW_ROWHEADER 1005 #define HBQT_BRW_COLALIGN 1006 #define HBQT_BRW_COLFGCOLOR 1007 #define HBQT_BRW_COLBGCOLOR 1008 +#define HBQT_BRW_COLHEIGHT 1011 + +#define HBQT_BRW_ROWHEADER 1005 #define HBQT_BRW_DATFGCOLOR 1009 #define HBQT_BRW_DATBGCOLOR 1010 -#define HBQT_BRW_COLHEIGHT 1011 #define HBQT_BRW_DATHEIGHT 1012 #define HBQT_BRW_DATALIGN 1013 #define HBQT_BRW_CELLDECORATION 1014 @@ -1947,7 +1964,7 @@ QVariant HbDbfModel::data( const QModelIndex & index, int role ) const QVariant HbDbfModel::headerData( int section, Qt::Orientation orientation, int role ) const { -//char str[ 50 ]; hb_snprintf( str, sizeof( str ), "headerData - section=%i orient=%i role=%i", section, orientation, role ); OutputDebugString( str ); +//char str[ 50 ]; hb_snprintf( str, sizeof( str ), "headerData - section=%i orient=%i role=%i name=%s", section, orientation, role, objectName() ); OutputDebugString( str ); if( orientation == Qt::Horizontal ) { diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index 08611ed587..06da8f7e0b 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -116,6 +116,7 @@ public: void mouseMoveEvent( QMouseEvent * event ); void mousePressEvent( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); + void wheelEvent( QWheelEvent * event ); void resizeEvent( QResizeEvent * event ); void scrollContentsBy( int x, int y ); void scrollTo( const QModelIndex & index, QAbstractItemView::ScrollHint hint = QAbstractItemView::EnsureVisible ); @@ -130,6 +131,7 @@ signals: void sg_mouseDoubleClickEvent( QMouseEvent * event ); void sg_mousePressEvent( QMouseEvent * event ); void sg_mouseReleaseEvent( QMouseEvent * event ); + void sg_wheelEvent( QWheelEvent * event ); void sg_resizeEvent( QResizeEvent * event ); void sg_moveCursor( HbTableView::CursorAction cursorAction, Qt::KeyboardModifiers modifiers ); void sg_scrollContentsBy( int x, int y ); @@ -272,6 +274,7 @@ public slots: void mousePressEvent( QMouseEvent * event ); void mouseReleaseEvent( QMouseEvent * event ); void mouseDoubleClickEvent( QMouseEvent * event ); + void wheelEvent( QWheelEvent * event ); void resizeEvent( QResizeEvent * event ); void scrollContentsBy( int x, int y ); void geometriesChanged(); diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index ddddb29454..c8294a7752 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: Wed Aug 12 22:46:34 2009 +** Created: Tue Aug 18 18:21:01 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 - 8, 12, // methods + 9, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -78,8 +78,9 @@ static const uint qt_meta_data_HbTableView[] = { 119, 13, 12, 12, 0x05, 152, 13, 12, 12, 0x05, 187, 13, 12, 12, 0x05, - 240, 217, 12, 12, 0x05, - 307, 303, 12, 12, 0x05, + 215, 13, 12, 12, 0x05, + 268, 245, 12, 12, 0x05, + 335, 331, 12, 12, 0x05, 0 // eod }; @@ -90,6 +91,7 @@ static const char qt_meta_stringdata_HbTableView[] = { "sg_mouseDoubleClickEvent(QMouseEvent*)\0" "sg_mousePressEvent(QMouseEvent*)\0" "sg_mouseReleaseEvent(QMouseEvent*)\0" + "sg_wheelEvent(QWheelEvent*)\0" "sg_resizeEvent(QResizeEvent*)\0" "cursorAction,modifiers\0" "sg_moveCursor(HbTableView::CursorAction,Qt::KeyboardModifiers)\0" @@ -126,12 +128,13 @@ int HbTableView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 2: sg_mouseDoubleClickEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; case 3: sg_mousePressEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; 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; + case 5: sg_wheelEvent((*reinterpret_cast< QWheelEvent*(*)>(_a[1]))); break; + case 6: sg_resizeEvent((*reinterpret_cast< QResizeEvent*(*)>(_a[1]))); break; + case 7: sg_moveCursor((*reinterpret_cast< HbTableView::CursorAction(*)>(_a[1])),(*reinterpret_cast< Qt::KeyboardModifiers(*)>(_a[2]))); break; + case 8: sg_scrollContentsBy((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; default: ; } - _id -= 8; + _id -= 9; } return _id; } @@ -172,25 +175,32 @@ void HbTableView::sg_mouseReleaseEvent(QMouseEvent * _t1) } // SIGNAL 5 -void HbTableView::sg_resizeEvent(QResizeEvent * _t1) +void HbTableView::sg_wheelEvent(QWheelEvent * _t1) { void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 5, _a); } // SIGNAL 6 -void HbTableView::sg_moveCursor(HbTableView::CursorAction _t1, Qt::KeyboardModifiers _t2) +void HbTableView::sg_resizeEvent(QResizeEvent * _t1) { - void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; + void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 6, _a); } // SIGNAL 7 -void HbTableView::sg_scrollContentsBy(int _t1, int _t2) +void HbTableView::sg_moveCursor(HbTableView::CursorAction _t1, Qt::KeyboardModifiers _t2) { void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)), const_cast(reinterpret_cast(&_t2)) }; QMetaObject::activate(this, &staticMetaObject, 7, _a); } + +// SIGNAL 8 +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, 8, _a); +} static const uint qt_meta_data_MyMainWindow[] = { // content: @@ -311,7 +321,7 @@ static const uint qt_meta_data_Slots[] = { 2, // revision 0, // classname 0, 0, // classinfo - 105, 12, // methods + 106, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -405,23 +415,24 @@ 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, - 2940, 2937, 6, 6, 0x0a, - 2959, 2937, 6, 6, 0x0a, - 2978, 2937, 6, 6, 0x0a, - 3003, 2998, 6, 6, 0x0a, - 3026, 2998, 6, 6, 0x0a, + 2457, 2245, 6, 6, 0x0a, + 2488, 2484, 6, 6, 0x0a, + 2514, 6, 6, 6, 0x0a, + 2552, 2534, 6, 6, 0x0a, + 2612, 2599, 6, 6, 0x0a, + 2650, 2632, 6, 6, 0x0a, + 2679, 2599, 6, 6, 0x0a, + 2705, 2599, 6, 6, 0x0a, + 2725, 2599, 6, 6, 0x0a, + 2800, 2757, 6, 6, 0x0a, + 2826, 2599, 6, 6, 0x0a, + 2875, 2846, 6, 6, 0x0a, + 2922, 2903, 6, 6, 0x0a, + 2965, 2962, 6, 6, 0x0a, + 2984, 2962, 6, 6, 0x0a, + 3003, 2962, 6, 6, 0x0a, + 3028, 3023, 6, 6, 0x0a, + 3051, 3023, 6, 6, 0x0a, 0 // eod }; @@ -494,6 +505,7 @@ static const char qt_meta_stringdata_Slots[] = { "mousePressEvent(QMouseEvent*)\0" "mouseReleaseEvent(QMouseEvent*)\0" "mouseDoubleClickEvent(QMouseEvent*)\0" + "wheelEvent(QWheelEvent*)\0" "resizeEvent(QResizeEvent*)\0x,y\0" "scrollContentsBy(int,int)\0geometriesChanged()\0" "logicalIndex,mode\0" @@ -625,27 +637,28 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 84: mousePressEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; 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; - case 100: buttonClicked((*reinterpret_cast< int(*)>(_a[1]))); break; - case 101: buttonPressed((*reinterpret_cast< int(*)>(_a[1]))); break; - case 102: buttonReleased((*reinterpret_cast< int(*)>(_a[1]))); break; - case 103: linkActivated((*reinterpret_cast< const QString(*)>(_a[1]))); break; - case 104: linkHovered((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 87: wheelEvent((*reinterpret_cast< QWheelEvent*(*)>(_a[1]))); break; + case 88: resizeEvent((*reinterpret_cast< QResizeEvent*(*)>(_a[1]))); break; + case 89: scrollContentsBy((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 90: geometriesChanged(); break; + case 91: sectionAutoResize((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< QHeaderView::ResizeMode(*)>(_a[2]))); break; + case 92: sectionClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 93: sectionCountChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 94: sectionDoubleClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 95: sectionEntered((*reinterpret_cast< int(*)>(_a[1]))); break; + case 96: sectionHandleDoubleClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 97: sectionMoved((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 98: sectionPressed((*reinterpret_cast< int(*)>(_a[1]))); break; + case 99: sectionResized((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; + case 100: sortIndicatorChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< Qt::SortOrder(*)>(_a[2]))); break; + case 101: buttonClicked((*reinterpret_cast< int(*)>(_a[1]))); break; + case 102: buttonPressed((*reinterpret_cast< int(*)>(_a[1]))); break; + case 103: buttonReleased((*reinterpret_cast< int(*)>(_a[1]))); break; + case 104: linkActivated((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 105: linkHovered((*reinterpret_cast< const QString(*)>(_a[1]))); break; default: ; } - _id -= 105; + _id -= 106; } return _id; }