hbQT - Post queries in this thread only

Moderator: Rathinagiri

User avatar
l3whmg
Posts: 694
Joined: Mon Feb 23, 2009 8:46 pm
Location: Italy
Contact:

Re: hbQT - Post queries in this thread only

Post by l3whmg » Thu Oct 06, 2011 11:44 am

Hi to everyone.

I spent some time to find a solution about QTranslator; in other words, to show Dialogs in native language (or in a different language than English).

But I have a problem and for this reason I ask Pritpal help.

I know QTranslator can load translated strings in this way QTranslator():load( FileName, FilePath ); my problem regarding FilePath.

By default, Qt stores some values internally and these values can be overwrited with usage of qt.conf and this is an example:

Code: Select all

[Paths]
Prefix = D:/ThisIsMyPath/ThisIsMySubFolder
Plugins = plugins
Translations = translations
and I can find the translations files in this path D:/ThisIsMyPath/ThisIsMySubFolder/translations.

But how can I know this value?

The only way, that I have found, is through usage of the QLibraryInfo class like this:

Code: Select all

QtTranslator():load( FileName , QLibraryInfo():location( QLibraryInfo_TranslationsPath ) )
Where QLibraryInfo_TranslationsPath is a defined value and :location() is a usefull method to know this and other values.
Unfortunately, QLibraryInfo class seems not implemented.

Is there an alternative way to know these values? If not, can be possible to implement the QLibraryInfo class?

Many thanks in advance.
Best regards.
Luigi from Italy
www.L3W.it

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Sat Nov 26, 2011 6:14 pm

Mybe the is an error in QAction() ?

QAction:IsChecked() always returns back .F.

Ricci

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

Post by bedipritpal » Sat Nov 26, 2011 6:22 pm

Ricci wrote:Mybe the is an error in QAction() ?

QAction:IsChecked() always returns back .F.

Ricci
You need to set if QAction is checkable or not:

oAction:setCheckable( .t. )
and then
oAction:isChecked()
will return the actual state.
enjoy hbIDEing... Pritpal Bedi

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Sat Nov 26, 2011 9:08 pm

bedipritpal wrote:
Ricci wrote:Mybe the is an error in QAction() ?

QAction:IsChecked() always returns back .F.

Ricci
You need to set if QAction is checkable or not:

oAction:setCheckable( .t. )
and then
oAction:isChecked()
will return the actual state.
I know, but it didn´t work. We have this method in the MENUITEM class:

Code: Select all

/*..............................................................................
   Checked
..............................................................................*/
METHOD Checked( lArg1 ) CLASS MENUITEM

   IF PCOUNT() == 0
//      RETURN ::oQTObject:IsChecked()                  <-- not working yet
      RETURN ::lChecked
   ELSEIF PCOUNT() == 1 .AND. hb_IsLogical( lArg1 ) 
      ::lChecked := lArg1
      ::oQTObject:setCheckable( .T. )
      ::oQTObject:setChecked( ::lChecked )
   ENDIF

RETURN Self
and we have to use a own property to set and get the state of the checked state.
Btw.: oQTObject is defined with ::oQTObject := QAction( ::oParent:QtParent )

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Thu Dec 08, 2011 7:42 am

Oh oh, an old error in handling DBF/DBT memo fields is back in harbour since some days (maybe since 2011/11/15).

I´m loading the database driver with "REQUEST DBFCDX , DBFFPT"
I have the database "orchids" containing the memofield "info".
When I try to display the content of the field with "msginfo( orchids->info )" the message window is empty.

But when I use "msginfo( left( orchids->Info, len( orchids->Info ) - 1 ) )" it works, only the last character of the memo is missing.

This error is not new, I saw it some month ago.

I found the workaround I use a long time before. Instead of writing

Code: Select all

msginfo( orchids->info )
I write

Code: Select all

ctmp := Orchids->Info
msginfo( ctmp )
and now it is working.

Ricci

mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Post by mrduck » Thu Dec 08, 2011 5:26 pm

Ricci,
msginfo checks if firsta parameter is a char. If it is not, it defaults to empty string.

So I suppose that hb_isChar( info ) returns .F.

Can you please check the value of valtype( orchids->info ) ? I fear it may return M as Memo....



Ricci wrote:Oh oh, an old error in handling DBF/DBT memo fields is back in harbour since some days (maybe since 2011/11/15).

I´m loading the database driver with "REQUEST DBFCDX , DBFFPT"
I have the database "orchids" containing the memofield "info".
When I try to display the content of the field with "msginfo( orchids->info )" the message window is empty.

But when I use "msginfo( left( orchids->Info, len( orchids->Info ) - 1 ) )" it works, only the last character of the memo is missing.

This error is not new, I saw it some month ago.

I found the workaround I use a long time before. Instead of writing

Code: Select all

msginfo( orchids->info )
I write

Code: Select all

ctmp := Orchids->Info
msginfo( ctmp )
and now it is working.

Ricci

Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Post by Ricci » Thu Dec 08, 2011 6:16 pm

mrduck wrote:Ricci,
msginfo checks if firsta parameter is a char. If it is not, it defaults to empty string.

So I suppose that hb_isChar( info ) returns .F.

Can you please check the value of valtype( orchids->info ) ? I fear it may return M as Memo....
Luigi, you are right. It is Memo and hb_isChar( info ) returns .F. :cry:

And this is the reason that I cannot assign orchids->info directly to a EditBox control via oForm:oEditBox:Value( orchids->info ) and lost some data !!!
Because we are checking for hb_isChar( cValue ) == .T.

I changed editbox.prg and .... now it´s working. :D

Thanks Luigi

mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Post by mrduck » Thu Dec 08, 2011 8:46 pm

Ricci wrote: Thanks Luigi
I'm Francesco... .but it's the same...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest