Page 10 of 15

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 5:47 am
by Rathinagiri
Hi Pritpal,

I invite your kind attention to this thread...

http://hmgforum.com/viewtopic.php?f=34&t=1675&start=0

I think you have resolved this with QIcon object. However it seems not working for me.

This is regarding two states of icon (on/off) image. Is this working for you?

Code: Select all

......
......
   oItem := QTreeWidgetItem()
   If ValType( cItemCaption ) != 'U'
      oItem:setText( 0,cItemCaption )
   Endif
   If Valtype( aImages ) == 'A'
      If len( aImages ) > 0
         oImage := QIcon()
         oNormalImage := QPixmap( aImages[1] )
         oImage:addPixmap( oNormalImage,QIcon_Normal,QIcon_On )    
         If len(aImages) > 1
            oSelectedImage := QPixmap( aImages[2] )
            oImage:addPixmap( oSelectedImage,QIcon_Selected,QIcon_On )    
         Endif
         oItem:setIcon( 0,oImage ) && Not supported by HBQT!
......
.....

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 2:54 pm
by bedipritpal
rathinagiri wrote:Hi Pritpal,

I invite your kind attention to this thread...
http://hmgforum.com/viewtopic.php?f=34&t=1675&start=0
I think you have resolved this with QIcon object. However it seems not working for me.
Confirmed, it is not working.
Trying to resolve what is wrong with this implementation
but after few hours of trial and error I am not been
able to locate its cause.

Still trying...

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 3:26 pm
by Rathinagiri
Oh! Thank you very much.
but after few hours of trial and error
Oh my God! :(

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 3:28 pm
by bedipritpal
rathinagiri wrote:Oh! Thank you very much.
but after few hours of trial and error
Oh my God! :(
And HE listened to you.

Fixed under ChangeLog:

2010-09-17 08:19 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtgui/qth/QIcon.qth
! An important change in constructor.

TO-REMEMBER: whenever any parameter has to be tested with
HB_ISCHAR() and HB_ISPOINTER(), HB_ISCHAR() must ever be
checked first then HB_ISPOINTER(), at least for hbQT.

* contrib/hbqt/utils/hbqtgen.prg
! Fixed: how a QIcon() is passed to another methods.

* contrib/hbqt/qt*/g/*.prg
* contrib/hbqt/qt*/doc/en/*.txt
* Auto generated.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 3:33 pm
by bedipritpal
rathinagiri wrote:

Code: Select all

......
......
   oItem := QTreeWidgetItem()
   If ValType( cItemCaption ) != 'U'
      oItem:setText( 0,cItemCaption )
   Endif
   If Valtype( aImages ) == 'A'
      If len( aImages ) > 0
         oImage := QIcon()
         oNormalImage := QPixmap( aImages[1] )
         oImage:addPixmap( oNormalImage,QIcon_Normal,QIcon_On )    
         If len(aImages) > 1
            oSelectedImage := QPixmap( aImages[2] )
            oImage:addPixmap( oSelectedImage,QIcon_Selected,QIcon_On )    
         Endif
         oItem:setIcon( 0,oImage ) && Not supported by HBQT!
......
.....
If you don't mind...

Code: Select all

         oIcon := QIcon()
         oIcon:addPixmap( QPixmap( aImages[ 1 ] ), QIcon_Normal, QIcon_On )    
         IF len( aImages ) > 1
            oImage:addPixmap( QPixmap( aImages[ 2 ] ), QIcon_Selected, QIcon_On )    
         ENDIF
         oItem:setIcon( 0, oIcon ) && Supported by HBQT!
Always use variable names synonymous to actual Qt class.
It will help you debug code properly in case it is needed.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 17, 2010 4:01 pm
by Rathinagiri
Super!

Thanks a lot man! You are just great.

I like your way of systematic approach and coding.

I noted this one too with a smiling face. :)
&& Supported by HBQT!

Re: hbQT - Post queries in this thread only

Posted: Sat Sep 18, 2010 2:39 pm
by Rathinagiri
Hi,

Can you please guide me how to set window style flags?

::oQTObject:setWindowFlags()

How can we verify whether a particular Enum Flag (hexa value) included in the windowflags.

From QT Documentation:

They verify whether a particular flag is set or not using the following code:

Code: Select all

if (flags & Qt::MSWindowsFixedSizeDialogHint)
Now, how should we do this in HBQT?

Re: hbQT - Post queries in this thread only

Posted: Sat Sep 18, 2010 3:01 pm
by bedipritpal
rathinagiri wrote:Hi,

Can you please guide me how to set window style flags?

::oQTObject:setWindowFlags()

How can we verify whether a particular Enum Flag (hexa value) included in the windowflags.

From QT Documentation:

They verify whether a particular flag is set or not using the following code:

Code: Select all

if (flags & Qt::MSWindowsFixedSizeDialogHint)
Now, how should we do this in HBQT?

Code: Select all

   nFlags := ::oWidget:windowFlags()
   nnFlags := nFlags
   IF !( ::maxButton )
      IF hb_bitAnd( nFlags, Qt_WindowMaximizeButtonHint ) == Qt_WindowMaximizeButtonHint
         nFlags -= Qt_WindowMaximizeButtonHint
      ENDIF
   ENDIF
   IF !( ::minButton )
      IF hb_bitAnd( nFlags, Qt_WindowMinimizeButtonHint ) == Qt_WindowMinimizeButtonHint
         nFlags -= Qt_WindowMinimizeButtonHint
      ENDIF
   ENDIF

Re: hbQT - Post queries in this thread only

Posted: Sat Sep 18, 2010 3:37 pm
by Rathinagiri
Thank you Pritpal for your immediate help.

Can we capture this signal?

QApplication::lastWindowClosed ()

Re: hbQT - Post queries in this thread only

Posted: Sat Sep 18, 2010 8:11 pm
by bedipritpal
rathinagiri wrote:Thank you Pritpal for your immediate help.

Can we capture this signal?

QApplication::lastWindowClosed ()

Should be possible after r15502 under this changelog:

2010-09-18 13:05 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_hbslots.cpp
* contrib/hbqt/qtcore/hbqt_hbslots.h
+ Added: signals for QApplication().