no default size for RichTextAnnotations

Discussions about the development of the TechDraw workbench
User avatar
wandererfan
Posts: 4078
Joined: Tue Nov 06, 2012 5:42 pm

Re: no default size for RichTextAnnotations

Postby wandererfan » Thu Jan 30, 2020 9:16 pm

uwestoehr wrote:
Thu Jan 30, 2020 6:52 pm
OK, so should I use 14 pt?
If not, I don't know how to set the font-size at runtime. I searched yesterday some forums and they said one has to do this in the UI file. So my patch is basically the solution I found in the forums.
What about this?

Code: Select all

void TaskRichAnno::setUiPrimary()
{
...
    double newSize = prefFontSize();           //like MRichTextEdit::getDefFontSizeNum
    ui->teAnnoText->setFontPointSize(newSize);
...
}

same in setUIEdit
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

Re: no default size for RichTextAnnotations

Postby uwestoehr » Fri Jan 31, 2020 12:08 am

wandererfan wrote:
Thu Jan 30, 2020 9:16 pm
What about this?
double newSize = prefFontSize(); //like MRichTextEdit::getDefFontSizeNum
ui->teAnnoText->setFontPointSize(newSize);
This doesn't compile. But with this:

Code: Select all

MRichTextEdit mre;
    ui->teAnnoText->setFontPointSize(mre.getDefFontSizeNum());
I get what I want. I made a new PR: https://github.com/FreeCAD/FreeCAD/pull/2975

I only need this in setUiPrimary().

Here here on my Win 7 machine it returns a 10 pt font, (what is indeed the default text size here):

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">test</span></p></body></html>
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: no default size for RichTextAnnotations

Postby vocx » Sat Feb 01, 2020 6:05 pm

uwestoehr wrote:
Fri Jan 31, 2020 12:08 am
...
I get what I want. I made a new PR: https://github.com/FreeCAD/FreeCAD/pull/2975
...
https://travis-ci.org/FreeCAD/FreeCAD/b ... hub_status

https://travis-ci.org/FreeCAD/FreeCAD/j ... 7056-L7067

I'm not sure, but since that pull request that you made, the Travis tests are failing for GCC with Python 2. All other tests with Python 3, GCC, Clang and Windows pass.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

Re: no default size for RichTextAnnotations

Postby uwestoehr » Sat Feb 01, 2020 6:42 pm

vocx wrote:
Sat Feb 01, 2020 6:05 pm
I'm not sure, but since that pull request that you made, the Travis tests are failing for GCC with Python 2. All other tests with Python 3, GCC, Clang and Windows pass.
Seems to be a Qt4 issue.

In the developer forum I raised a discussion about making right now a release that supports Py2 and Qt4 and as I understood it, this won't happen and the next release will not officially support Py2 and Qt4.

Nevertheless if you have a fix, please port it. i don't have neither py2 nor Qt4.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: no default size for RichTextAnnotations

Postby vocx » Sat Feb 01, 2020 7:15 pm

uwestoehr wrote:
Sat Feb 01, 2020 6:42 pm
...
In the developer forum I raised a discussion about making right now a release that supports Py2 and Qt4 and as I understood it, this won't happen and the next release will not officially support Py2 and Qt4....
No. You understood wrong. The next stable release 0.19 will support Python 2 and Qt4 because we are still testing for it in Travis. Once that release happens, then the Travis test for Python 2 will be removed, and we will de facto not test Python2/Qt4 compatibility any more.

Basically, right now we don't want to have failing Travis tests, and that implies fixing any small Py2/Qt4 issues.

What won't happen is a release right now. It will happen, but around April.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
uwestoehr
Posts: 2144
Joined: Sun Jan 27, 2019 3:21 am

Re: no default size for RichTextAnnotations

Postby uwestoehr » Sun Feb 02, 2020 4:19 pm

uwestoehr wrote:
Sat Feb 01, 2020 6:42 pm
Seems to be a Qt4 issue.
Indeed. This PR should fix it: https://github.com/FreeCAD/FreeCAD/pull/2984
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: no default size for RichTextAnnotations

Postby vocx » Mon Feb 03, 2020 4:35 am

uwestoehr wrote:
Sun Feb 02, 2020 4:19 pm
Indeed. This PR should fix it: https://github.com/FreeCAD/FreeCAD/pull/2984
Awesome. Thank you for your service!
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.