Page 15 of 15

Re: hbQT - Post queries in this thread only

Posted: Thu Oct 06, 2011 11:44 am
by l3whmg
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.

Re: hbQT - Post queries in this thread only

Posted: Sat Nov 26, 2011 6:14 pm
by Ricci
Mybe the is an error in QAction() ?

QAction:IsChecked() always returns back .F.

Ricci

Re: hbQT - Post queries in this thread only

Posted: Sat Nov 26, 2011 6:22 pm
by bedipritpal
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.

Re: hbQT - Post queries in this thread only

Posted: Sat Nov 26, 2011 9:08 pm
by Ricci
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 )

Re: hbQT - Post queries in this thread only

Posted: Thu Dec 08, 2011 7:42 am
by Ricci
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

Re: hbQT - Post queries in this thread only

Posted: Thu Dec 08, 2011 5:26 pm
by mrduck
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

Re: hbQT - Post queries in this thread only

Posted: Thu Dec 08, 2011 6:16 pm
by Ricci
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

Re: hbQT - Post queries in this thread only

Posted: Thu Dec 08, 2011 8:46 pm
by mrduck
Ricci wrote: Thanks Luigi
I'm Francesco... .but it's the same...