[Qt-interest] QPainter.drawText on windows: Access violation
Malyushytsky, Alex
alex at wai.com
Fri Jul 3 02:10:36 CEST 2009
I am glad that problem is fixed for you, but this is definitely a bug.
None of the classes you were using supposed to require QApplication.
I would suggest you to report the bug to nokia.
Regards,
Alex
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Yanhao Zhu
Sent: Thursday, July 02, 2009 6:15 AM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] QPainter.drawText on windows: Access violation
Thank you so much, Patrick! That fixed the error. Appreciate your help
very much!
--Yanhao
On Thu, Jul 2, 2009 at 1:41 AM, Patrick Vollebregt<jeet.nl at gmail.com> wrote:
> Hi,
>
> Change QCoreApplication in QApplication and it should work. Maybe (haven't
> really looked into it) some initialization regarding palettes is done in
> QApplication, which isn't in QCoreApplication.
>
> Kinds regards,
>
> Patrick.
>>
>> Hi, all,
>>
>> I keep getting [Access violation] error with QPainter::drawText method
>> on windows. Here is the very simple code I used:
>>
>> -------------------------------------------------------------
>> #include <QtCore/QCoreApplication>
>> #include <QImage>
>> #include <QPainter>
>> #include <QFont>
>>
>> int main(int argc, char *argv[])
>> {
>> QCoreApplication a(argc, argv);
>>
>> QFont font("Lucida Console", 16);
>>
>> QImage image(256, 256, QImage::Format_ARGB32);
>>
>> QPainter painter(&image);
>> painter.setFont(font);
>> painter.drawText(10, 100, "Hello, world!");
>>
>> image.save("test.png", "PNG");
>>
>> //return a.exec();
>> }
>> ------------------------------------
>>
>> The following is the partial call stack:
>> QtCored4.dll!QBasicAtomicInt::ref() Line 257 + 0x8 bytes C++
>> QtGuid4.dll!QColormap::QColormap() Line 145 + 0x1d bytes C++
>> QtGuid4.dll!QColormap::instance(int __formal=-1) Line 141 + 0x13 bytes
>> C++
>> QtGuid4.dll!QNativeImage::systemFormat() Line 138 + 0xb bytes C++
>> QtGuid4.dll!QFontEngineWin::drawGDIGlyph(HFONT__ * font=0x2e0a0446,
>> unsigned int glyph=85, int margin=0, const QTransform & t={...}) Line
>> 1411 + 0x29 bytes C++
>> QtGuid4.dll!QFontEngineWin::alphaMapForGlyph(unsigned int glyph=85,
>> const QTransform & xform={...}) Line 1452 + 0x19 bytes C++
>> QtGuid4.dll!QImageTextureGlyphCache::fillTexture(const
>> QTextureGlyphCache::Coord & c={...}, unsigned int g=85) Line 227 +
>> 0x36 bytes C++
>> QtGuid4.dll!QTextureGlyphCache::populate(const QTextItemInt &
>> ti={...}, const QVarLengthArray<unsigned int,256> & glyphs={...},
>> const QVarLengthArray<QFixedPoint,256> & __formal={...}) Line 143
>> C++
>> QtGuid4.dll!QRasterPaintEngine::drawCachedGlyphs(const QPointF &
>> p={...}, const QTextItemInt & ti={...}) Line 2925 C++
>> QtGuid4.dll!QRasterPaintEngine::drawTextItem(const QPointF & p={...},
>> const QTextItem & textItem={...}) Line 3125 C++
>> QtGuid4.dll!QPainter::drawTextItem(const QPointF & p={...}, const
>> QTextItem & _ti={...}) Line 6123 C++
>> QtGuid4.dll!QPainter::drawText(const QPointF & p={...}, const QString
>> & str={...}, int tf=0, int justificationPadding=0) Line 5680 C++
>> QtGuid4.dll!QPainter::drawText(const QPointF & p={...}, const QString
>> & str={...}) Line 5618 C++
>> QtGuid4.dll!QPainter::drawText(int x=10, int y=100, const QString &
>> s={...}) Line 910 C++
>>
>>
>> The same code worked fine in Mac OS X. Any idea why it did not work on
>> windows? Did I miss something?
>>
>> I am using qt 4.5.1 on window with visual c++.
>>
>>
>> Thank you so much,
>>
>> Yanhao Zhu
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.
"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."
"Please consider our environment before printing this email."
More information about the Qt-interest-old
mailing list