Hi Pritpal,
first of all: remember I'm not a C programmer so take my answer with care :-))
I have compared (ie) QTablewidget.cpp related with method currentItem() and I read this C code
HB_FUNC_STATIC( CURRENTITEM )
{
QTableWidget * p = ( QTableWidget * ) hbqt_par_ptr( 0 );
if( p )
{
hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, p->currentItem(), "HB_QTABLEWIDGETITEM", hbqt_del_QTableWidgetItem, HBQT_BIT_NONE ) );
}
}
As you can see p->currentItem is used (I think) to create and return a HB_QTABLEWIDGETITEM. For this reason I thought my code was the right; but I have read other code related with metod :itemPrototype() and here I see hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, new QTableWidgetItem( *( p->itemPrototype() ) ) that is (more or less) the same code as original QLabel.cpp. So, I'm very confused.
Did you try to compile the above code ?
How can I do? Because the QLabel.cpp source code is auto created through hbmk2_qt.hb (it is my guess)
I have no idea why it would crash.
It will through a RTE if the parameter is not of type pixmap.
why do you propose this hypothesis? Where is the code that emits RTE? There isn't into QLabel.qth. Again can be related with
hbmk2_qt.hb?
I think the code must be (more or less)
HB_FUNC_STATIC( PIXMAP )
{
QLabel * p = ( QLabel * ) hbqt_par_ptr( 0 );
if( p )
{
if p->pixmap() == 0 {
hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, new QPixmap() ), "HB_QPIXMAP", hbqt_del_QPixmap, HBQT_BIT_NONE |
HBQT_BIT_OWNER ) );
} else {
hb_itemReturnRelease( hbqt_bindGetHbObject( NULL, new QPixmap( p->pixmap() ) ), "HB_QPIXMAP", hbqt_del_QPixmap, HBQT_BIT_NONE | HBQT_BIT_OWNER ) );
}
}
}
In some way I'm checking pixmap; if it is 0 I create a new empty QPixmap else I need to return a QPixmap copy. Probably, for a C programmer there is a best code.
Regards
Luigi