hbQT - Post queries in this thread only

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Re: hbQT - Post queries in this thread only

Post by Rathinagiri » Fri Sep 17, 2010 5:47 am

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!
......
.....
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Post by bedipritpal » Fri Sep 17, 2010 2:54 pm

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...
enjoy hbIDEing... Pritpal Bedi

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Sep 17, 2010 3:26 pm

Oh! Thank you very much.
but after few hours of trial and error
Oh my God! :(
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Post by bedipritpal » Fri Sep 17, 2010 3:28 pm

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.
enjoy hbIDEing... Pritpal Bedi

User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Post by bedipritpal » Fri Sep 17, 2010 3:33 pm

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.
enjoy hbIDEing... Pritpal Bedi

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Fri Sep 17, 2010 4:01 pm

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!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Sat Sep 18, 2010 2:39 pm

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?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Post by bedipritpal » Sat Sep 18, 2010 3:01 pm

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
enjoy hbIDEing... Pritpal Bedi

User avatar
Rathinagiri
Posts: 5263
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 169 times
Been thanked: 172 times
Contact:

Post by Rathinagiri » Sat Sep 18, 2010 3:37 pm

Thank you Pritpal for your immediate help.

Can we capture this signal?

QApplication::lastWindowClosed ()
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Post by bedipritpal » Sat Sep 18, 2010 8:11 pm

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().
enjoy hbIDEing... Pritpal Bedi

Post Reply