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 »

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

Re: hbQT - Post queries in this thread only

Post by Ricci »

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

Re: hbQT - Post queries in this thread only

Post 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.
enjoy hbIDEing... Pritpal Bedi
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: hbQT - Post queries in this thread only

Post 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 )
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: hbQT - Post queries in this thread only

Post 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
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: hbQT - Post queries in this thread only

Post 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
Ricci
Posts: 255
Joined: Thu Nov 19, 2009 2:23 pm

Re: hbQT - Post queries in this thread only

Post 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
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: hbQT - Post queries in this thread only

Post by mrduck »

Ricci wrote: Thanks Luigi
I'm Francesco... .but it's the same...
User avatar
AUGE_OHR
Posts: 2092
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: hbQT - Post queries in this thread only

Post by AUGE_OHR »

hi,

it this Group still active :?:
have fun
Jimmy
Post Reply