QT5 Text rendering issue - qt

I have cross compiled QT5 on a MIPS based platform.
Whenever I run application including sample apps, (Which contains text), first it draws the text and later paints the area of text with "rectangle" fill of Text Color.
So finally I see a black rectangle all the places where text is displayed. If i change the text color, the color of rectangle also changes. Has anybody faced this issue? Any suggestions?
Even when I run qtwebkit, I see that URL part, the text in any HTML page is painted with rectangle fills.
Thanks

Related

QtQuick drawing shapes and colors but not text

I've just tried running my qtquick2 application, my application opens successfully but no text is drawn.
Fonts are probably missing on your target.
You can add them to your layer by appending IMAGE_INSTALL_append with ttf-dejavu-sans, ttf-ubuntu-mono, ttf-ubuntu-sans or any other font.

QML font rendering incorrectly - missing fine details

So as the title says, i have font rendering issue with QML project, using macOS.
Image example
The font is in assets/fonts (local folder), and it's being added in main.qml through FontLoader, like 3 other fonts. All fonts but this one are rendering correctly, and as you can see in screenshot above, my system reads font correctly. All fonts i've loaded are .otf, i don't know if that is relevant to my issue.
Expected result:
My sample QML code is:
Text {
id: welcomeMessageTop
color: "blue"
text: "ASDFGHJKLT"
font.family :
fontLoaded.name
font.pixelSize: 110
font.letterSpacing: -0.4
}
Thanks
I suspect this may have something to do with the default approach to efficienty render dynamically resizable text in QML, which is via distance fields. It is a great way to have smoothly resizing raster graphics and get almost vector graphics like results, but it does eat away small details that do not stand out enough relative to the character size.
You should try setting renderType: Text.NativeRendering for the Text element to see if that helps.
Also, IIRC native text rendering looks pretty bad if your text is dynamic - if it is animated, rotated or its size changes dynamically. It is mostly useful for static stuff, but I suppose the text can be rendered at a larger size to an invisible item, and that item can be used as a shader source which then you can apply dynamic behavior and get results that are not horrific.
In the case you are going to be resizing or rotating the text, note that there are also some env vars that can be modified to tweak the distance field generation and get a better result:
qputenv("QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE", "64");
qputenv("QT_DISTANCEFIELD_DEFAULT_SCALE", "16");
qputenv("QT_DISTANCEFIELD_DEFAULT_RADIUS", "80");
The problem with that is it doesn't seem to be possible to tweak on a per-font basis, so if you increase the distance field resolution, it will end up eating more memory even for fonts that don't need it.

Qt 5.6, how to draw text with a different fill and outline colours

I'm using Qt5.6, I am drawing text on a video window, however sometimes the text is not very readable due to the video content in the window. I'm current drawing the text on the painter context with the 'drawText' method. Whilst I can set the pen colour which controls the fill, I do not seem to be able to set an outline colour.
I would like to draw the text with a black outline to make it stand out. Unfortunately firewall where I am working makes life very difficult and any useful web-site that might help, seems to be blocked, hence this post.
Thank you,
Try using QPainterPath::addText().
You can add the text to a path, then QPainter::fillPath() and QPainter::strokePath() the path.
Or you can direcly use QPainter::drawPath() with a brush and pen set.

Text appears while over on an icon in Webflow

I made some research before writing here, but I couldn't find nothing that satisfied my answer to this specific case.
I have an icon, and when user hover onto it I want the icon become smaller and text (caption for the icon) should appear -at icons bottom.
As now, I have an interaction for the icon, that makes it become smaller.
It's first time for me working with WebFlow, and I see that using overlapping blocks they work as layers in the sense that the one on top is the only one who react to hovering.
I found in other questions that there was the need of setting correctly absolute/relative for blocks, but is not working for me since I have also the icon, inside the same block.
If I move the icon out of the block, I have the problem I shared before about overlapping "layers".
I need that icon decrease in size and text appear at the same time.
Is this achievable?
Thank you for your help!

Qt: Strange Hover-Only transparency losing effects on a button

My Widget declares:
setAttribute(Qt::WA_NoSystemBackground);
In its paintEvent, I set:
painter.setOpacity(0.75);
This gives me the ability to project a png on its entire background with some transparency. This works well.
Problem: I am adding a QPushButton with a transparent png on top of my widget. The opaque portion of the button's image (derived from Qt CSS) is shown correctly, and the transparent areas remain with my widgets' drawn background, which is already somewhat transparent. When I HOVER over the image, my css dictates that my QPushButton changes image. When that happens, the opaque portion of the button image is shown correctly, but for the transparent areas, it's as if my own widget is re-drawing the background image, only with full opacity.
This happens only on Windows. On OS X is works fine. I was wondering whether there was a bug in Windows in that respect and if there's a workaround for it.
Turns out that while
setAttribute(Qt::WA_NoSystemBackground);
is good enough for OS X…
On windows you should also add:
setAttribute(Qt::WA_TranslucentBackground);
That took care of it. Problem resolved.

Resources