QPainter drawtext Bold
-
Hi
What platform ? -
@TheCipo76
Ok, im asking as it seems just as odd as
https://forum.qt.io/topic/98726/qtextedit-make-text-bold
which is also mac.Could you also try with
http://doc.qt.io/qt-5/qtwidgets-richtext-textedit-example.html
and use Verdana and see if that sample can make it bold ? -
@TheCipo76 , @mrjj
Hmm, is it simple coincidence that the on-going https://forum.qt.io/topic/98726/qtextedit-make-text-bold seems unresolved and is reporting a similar problem with no-bold, though admittedly in aQTextEdit
. Any connection...?? -
@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.