Page 6 of 15

Re: hbQT - Post queries in this thread only

Posted: Thu Sep 09, 2010 5:12 pm
by bedipritpal
Roberto Lopez wrote:Pritpal,

I'm trying to build hbqt libraries from current sources (I've downloaded one hour ago).

libhbqtcore is not built.
Done.

Update afresh.

Re: hbQT - Post queries in this thread only

Posted: Thu Sep 09, 2010 6:32 pm
by Roberto Lopez
bedipritpal wrote:
Roberto Lopez wrote:Pritpal,

I'm trying to build hbqt libraries from current sources (I've downloaded one hour ago).

libhbqtcore is not built.
Done.

Update afresh.
Thanks again!

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 12:05 pm
by Roberto Lopez
Pritpal,

Is not my intention to disturb you with this kind of requests, but I'm stuck on this and I'm not able to find a solution.

As I've said in a previous post, I'm trying to print on the default printer without user interaction.

I've believed that QPRINTERINFO could give the required data (a pointer to the default printer to use with QPAINTER).

But I've found that QPRINTERINFO gives me only the default printer name, but not a pointer to it:

Code: Select all

qPrinterInfo := qPrinterInfo():New()
qpi := qPrinterInfo():from( ::qPrinterInfo:defaultprinter() )
msginfo( qpi:printername() )
Then, I've tried this:

Code: Select all

qPrinter := qprinter():new()
msginfo( qprinter:printername )
It returns the default printer name, but, again, I've not found anything in QPRINTER that returns a pointer to the printer to use with QPAINTER.

Any help on this is welcome.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 12:38 pm
by Rathinagiri
Hi Roberto,

Is this not working?

Code: Select all

oPainter := QPainter():New()
oPrinter := QPrinter():new()
oPainter:begin(oPrinter)
Because that's how I worked for graph commands.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 2:15 pm
by bedipritpal
Roberto Lopez wrote:Pritpal,

Is not my intention to disturb you with this kind of requests, but I'm stuck on this and I'm not able to find a solution.
You may ask n number of questions freely.
As I've said in a previous post, I'm trying to print on the default printer without user interaction.

I've believed that QPRINTERINFO could give the required data (a pointer to the default printer to use with QPAINTER).

But I've found that QPRINTERINFO gives me only the default printer name, but not a pointer to it:

Code: Select all

qPrinterInfo := qPrinterInfo():New()
qpi := qPrinterInfo():from( ::qPrinterInfo:defaultprinter() )
msginfo( qpi:printername() )
Then, I've tried this:

Code: Select all

qPrinter := qprinter():new()
msginfo( qprinter:printername )
It returns the default printer name, but, again, I've not found anything in QPRINTER that returns a pointer to the printer to use with QPAINTER.

Any help on this is welcome.

First update from SVN r.15458, then :

Code: Select all

   qPtinterInfo := QPrinterInfo():new()
   qPrinter := QPrinter():from( qPrinterInfo:defaultPrinter() )
Hope it should work. I have not tested.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 2:25 pm
by Rathinagiri
rathinagiri wrote:Hi Roberto,

Is this not working?

Code: Select all

oPainter := QPainter():New()
oPrinter := QPrinter():new()
oPainter:begin(oPrinter)
Because that's how I worked for graph commands.
I have checked with a sample and it works I think.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 2:30 pm
by Roberto Lopez
Pritpal, Rathinagiri,

Thanks for your answers.

I'll try it ASAP and post the results here.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 2:55 pm
by Roberto Lopez
rathinagiri wrote:Hi Roberto,

Is this not working?

Code: Select all

oPainter := QPainter():New()
oPrinter := QPrinter():new()
oPainter:begin(oPrinter)
Because that's how I worked for graph commands.
Thanks, it works perfect.

All we have bad days... this is the day for me :)

The samples that I've found and I've learned from, uses a pointer to the printer and not a qprinter object to work with qpainter, ie:

Code: Select all

::qPrnDlg := QPrintPreviewDialog():new()
::qPrnDlg:connect( "paintRequested(QPrinter)", {|p| ::paintRequested( p ) } )
Then, in the paintrequest method:

Code: Select all

METHOD PaintRequested( pPrinter ) CLASS PRINTER
<...>
	::qPainter:Begin(::pPrinter)
<...>
From this experience, my believe was that I must use a pointer to the printer only in qpainter:begin and not a qPrinter object.

Well... as I've said... a bad day for me :)

Thanks again.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 3:09 pm
by Roberto Lopez
bedipritpal wrote: First update from SVN r.15458, then :

Code: Select all

   qPtinterInfo := QPrinterInfo():new()
   qPrinter := QPrinter():from( qPrinterInfo:defaultPrinter() )
Hope it should work. I have not tested.
I've created samples for both propositions (you and rathinagiri) .

This (the Rathinagiri solution) worked and solved the problem:

Code: Select all

oPrinter := qPrinter():New()
oPainter := QPainter():New()
oPainter:begin(oPrinter)
oPainter:drawLine_4( 10 , 10 , 100 , 100 )
oPainter:end()
The other sample (based on your proposition) does not work:

Code: Select all

oPrinterInfo := QPrinterInfo():new()
oPrinter := QPrinter():from( oPrinterInfo:defaultPrinter() )
oPainter := QPainter():New()
oPainter:begin(oPrinter)
oPainter:drawLine_4( 10 , 10 , 100 , 100 )
oPainter:end()
I'm not fully sure, but apparently, oPrinter should be the same in both cases.

Re: hbQT - Post queries in this thread only

Posted: Fri Sep 10, 2010 3:10 pm
by Rathinagiri
Yes. I too have got this simple thing only after some 10 hours of confusion!

Qxxxx():new() always gives the pointer to the QT object created. :)