QPainter drawtext Bold
-
@JonB
Yes, same code works on other platforms.
And if sample dont work either, its an OS/Qt thing. (it seems as no Qt app can make font bold then)
But yes could also be totally a coincidence but i have no macOS to test on. -
@TheCipo76
Hi
Tried your code.
The QPainter was not active. ( logged errors to Creator)
QPainter::begin(): Returned false
QPainter::begin(): Returned false
QPainter::setPen: Painter not active
QPainter::setFont: Painter not active
QPainter::setFont: Painter not active
so font was never set, i think.
if i do.... QPainter painter(&printer); // give it directly //painter.begin(&printer); QPen paintpen (Qt::black); painter.setPen(paintpen); ...
i get
-
@mrjj i've made the changes you told me up but
nothing changed
no way to have bold textwith qdebug i've checked font selection
this is debug messagePainter isActive: true
Painter Font: QFont( "Verdana,20,-1,5,75,0,0,0,0,0" ) //Bold
Painter Font: QFont( "Verdana,12,-1,5,50,0,0,0,0,0" )
Painter Font: QFont( "Verdana,10,-1,5,50,0,0,0,0,0" )
Painter Font: QFont( "Verdana,12,-1,5,75,0,0,0,0,0" ) //Bold
Painter Font: QFont( "Verdana,11,-1,5,75,0,0,0,0,0" ) //Bold
Painter Font: QFont( "Verdana,11,-1,5,50,0,0,0,0,0" )
Painter Font: QFont( "Verdana,11,-1,5,75,0,0,0,0,0" ) //Bold
Painter Font: QFont( "Verdana,11,-1,5,50,0,0,0,0,0" )75 is Bold ( as i've setted by code..)
but was not applied
Probably was a bug
-
Hi
Could you try test app ?
https://www.dropbox.com/s/eftitvdqvw60otr/boldfont.zip?dl=0I wanna know if you get bold on image and please also try to pdf and tell
if font still not bold there. -
@TheCipo76
Oh so PDF also worked with this sample ? -
@TheCipo76
Sample is like 98% your code. just removed the Date stuff.
Even to Image is your code, just to a pixmap.
Rest of it, is the same. So something must have went wrong
altering the code, or maybe it didnt use new code or something. -
@TheCipo76
Good hunting. Now we know it will work so
its just to compare sample to actual code and see what could be difference. -
@TheCipo76
When you find it, please tell here.
Its always good for me to know what i missed. -
@TheCipo76
Aha, and did you try the
http://doc.qt.io/qt-5/qtwidgets-richtext-textedit-example.html
example on mac too ?
We have other poster that has Bold issue on macOs.
https://forum.qt.io/topic/98726/qtextedit-make-text-boldso its kinda important to know if RichText sample do not go bold for you either as it then
smells like a Qt thing /Xcode / macOS version thing. -
Hi
(only talking macOs)
So Rich Text can do bold but your code does not ?
So unlike other poster - its sort of mixed.
Very odd.
Also if not even my sample with image give Bold text then
something is not workings it should.
I wonder if the font itself could be the issue.
did you try with other fonts in the code ? -
@TheCipo76
Ok so seems the same as other poster.
Do you also have message in Creator ?
like
Project WARNING: Qt has only been tested with version 10.13 of the platform SDK, you're using 10.14.