[Qt-interest] [Qt-Interest] How can I print QGraphicsTextItem in MFC application?

Long Cheng kevinclcn at gmail.com
Thu Jun 24 10:20:40 CEST 2010


Many thanks :D

On Thu, Jun 24, 2010 at 10:48 AM, Jason H <scorp1us at yahoo.com> wrote:
> http://labs.trolltech.com/blogs/2010/01/18/qt-graphics-and-performance-fast-text/
>
> you totally owe me now ;-)
>
> It does not fix the DC issue, but it might enable you to work as you have been, just with better results.
>
>
>
>
>
> ----- Original Message ----
> From: Long Cheng <kevinclcn at gmail.com>
> To: Jason H <scorp1us at yahoo.com>
> Cc: qt-interest at trolltech.com
> Sent: Wed, June 23, 2010 10:47:39 PM
> Subject: Re: [Qt-interest] [Qt-Interest] How can I print QGraphicsTextItem in  MFC application?
>
> Jason, do you still remember that link? Can I print QPainterPath
> directly to Win32 DC? Thanks!
>
> On Wed, Jun 23, 2010 at 11:57 PM, Jason H <scorp1us at yahoo.com> wrote:
>> There was a post on labs, in reference to drawing text, in response a question, that might help.
>>
>> It described a way to take the text and convert it to a QPainterPath, with only a color limitation. You could do the same, then print the path rather than a bitmap, with the idea that you can scale a path better that a bitmap.
>>
>> HTH.
>>
>>
>>
>>
>>
>> ----- Original Message ----
>> From: Long Cheng <kevinclcn at gmail.com>
>> To: qt-interest at trolltech.com
>> Sent: Wed, June 23, 2010 7:32:06 AM
>> Subject: [Qt-interest] [Qt-Interest] How can I print QGraphicsTextItem in MFC application?
>>
>> I have used QGraphicsTextItem in my MFC applications for text editing,
>> then converted the results to a bitmap to show in the view (screen).
>> But it has issues when printing. For example, if I print to a PDF
>> file, the text is not scalable since it is a bitmap and the file size
>> is also big.
>>
>> How can I print the QGraphicsTextItem in the MFC printing framework?
>> The ideal solution is that we can hook QPrinter into the MFC printing
>> framework or I can initialize QPrinter with Win32 DC. MFC printing
>> framework has prepared printer and DC for me, so I don't need
>> QPrintDialog to do that task again. The code may something like this:
>>
>>      QPrinter printer;
>>      printer.paintEngine()->setDC(myHDC); //**Note: this line is
>> imagined by me.
>>      QPainter painter(&printer);
>>
>> Is that possible? Do I have to reimplement my own QPrinter? Scanning
>> QPrinter's source code, I found it very complex. I hope there is an
>> easy way to get my goal. If I have to implement my own QPrinter, what
>> should I need to notice? Can anyone give me some advices?
>>
>> Thanks,
>> Long
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>>
>>
>>
>>
>>
>
>
>
>
>
>




More information about the Qt-interest-old mailing list