FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveTouch Printing with FiveTouch
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Printing with FiveTouch
Posted: Tue Mar 12, 2019 02:23 PM
You need to download the new FiveTouch.apk version from here:

https://github.com/FiveTechSoft/fivetouch-Qt-Creator-4.8.2-and-Qt-5.12.1-2019/tree/master/download

print01.prg
Code (fw): Select all Collapse
#include "FiveTouch.ch"

function Main()

   QPrintPreviewDialog( QPrinter() ):Exec()

return nil


regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Printing with FiveTouch
Posted: Tue Mar 12, 2019 03:17 PM
A real example:

QT print defines are here:
https://doc.qt.io/archives/qt-4.8/qprinter.html

print02.prg
Code (fw): Select all Collapse
#include "FiveTouch.ch"

#define QPRINTER_A4            0
#define QPRINTER_PORTRAIT    0
#define QPRINTER_MILLIMETER   0
#define QPRINTER_NATIVEFORMAT  0

function Main()

      local oPrinter, oPrintPreviewDialog

      oPrinter = QPrinter()
      oPrinter:setPageSize( QPageSize( QPRINTER_A4 ) )
      oPrinter:setPageOrientation( QPRINTER_PORTRAIT )
      oPrinter:setPageMargins( QMarginsF( 15, 15, 15, 15 ), QPRINTER_MILLIMETER )
      oPrinter:setFullPage( .F. )
      oPrinter:setOutputFormat( QPRINTER_NATIVEFORMAT )

      oPrintPreviewDialog := QPrintPreviewDialog( oPrinter )
      oPrintPreviewDialog:Connect( "paintRequested(QPrinter*)", { | oPrinter | PrintPage( oPrinter ) } )
      oPrintPreviewDialog:Exec()

return nil

function PrintPage( oPrinter )

      local oPainter

      oPainter = QPainter()
      oPainter:Begin( oPrinter )
      oPainter:DrawText( 100, 100, "Some text" )
      oPainter:End()

return nil




Many thanks to Cristian Francolino for his great example on qtcontribs google group:
https://groups.google.com/d/msg/qtcontribs/ftmFJn_py-k/v5zUyVfCBAAJ
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion