Wrong text display : Qt 5.14 only
-
@Ulysse said in Wrong text display : Qt 5.14 only:
I bet things work fine if i start somethting from the bottom up, it is a pretty basic functionnality
At least you can try to prove it - if it does not work with a simple reproducer then copy your project and remove all stuff until it no longer happens. That's the way the find bugs and why you're a programmer.
-
@Christian-Ehrlicher I am afraid you cannot do that when you have a 250'000 lines application.
One has to narrow his search scope in order to solve bugs
Thus my question : what should i look for ?
And my that i mean particular functions calls, context, options.. anythingMaybe you don't have any idea and that is fine, others will (even myself maybe?) and we will be able to locate the cause of the behavior
But i won't be dismantling my whole application for obvious reasonsRegards
-
Hi,
Where are you loading that text from ?
Where are you setting that text ? -
@Ulysse said in Wrong text display : Qt 5.14 only:
the characters displayed seem to be of the formchar(expectedchar_asciicode - 1):
Show -> RgnvDo you convert / re-interpret or edit the string somewhere?
Very unlikely that the issue comes from
QString
itself. -
@Ulysse said in Wrong text display : Qt 5.14 only:
Thus my question : what should i look for ?
If you want to reproduce a bug, start, as already said, with a simple reproducer. If you then can't reproduce the issue - try to isolate the problem. Since it's a simple widget I'm pretty sure you don't need to touch every 250k lines...
-
We use the "roboto" TrueType font.
Commenting theQFontDatabase::addApplicationFont(":/police/roboto.ttf");
line in the main removes the problem
Has there been any changes between Qt 5.6 and Qt 5.14 that concerns TrueType fonts, or fonts in general ?I can upload the font file if you need me to
Regards
-
So now that you've a point where to start - why not creating a simple reproducer??
-
@Christian-Ehrlicher Because that is what i was doing of course
I was not able to reproduce it though
I verified and roboto is correctly used#include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private: Ui::MainWindow *ui; }; MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } #include <QApplication> #include <QFontDatabase> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; QFontDatabase::addApplicationFont(":/police/roboto.ttf"); w.show(); return a.exec(); }
mainwindow.ui :
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>465</width> <height>262</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <property name="styleSheet"> <string notr="true">QComboBox, QLabel, QAbstractSpinBox, QLineEdit, QTextBrowser, QRadioButton, QCheckBox { font-family: "Roboto Light"; font-size: 40px; qproperty-alignment: AlignCenter; color: black; qproperty-contextMenuPolicy: NoContextMenu; }</string> </property> <widget class="QWidget" name="centralwidget"> <layout class="QHBoxLayout" name="horizontalLayout"> <item> <widget class="QLabel" name="label"> <property name="text"> <string>Hello World</string> </property> </widget> </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>465</width> <height>25</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui>
-
Silly idea: what if you load the font before creating your MainWindow object ?
Instinctively, I would setup all external resources like this one before creating objects that will use them.
-
Hi,
I have also had the same problem as OP but my GUI is QML and platform is Android It has a problem when I move my application from Qt 5.13.2 to Qt 5.14.2.
So now I just strict with Qt 5.13.2 (Even I would like to use a new feature for app bundle ) but I just curious why no one has the problem with display the wrong text after the move to Qt 5.14.2.I try all method as OP and also load the font in QML and set the font to all display text but some text still displays wrong text i.e. under
Menu { title: "Languages" font: Fonts.fontDefault }
from above in GUI it's show "Languages " as below
-
@es-w Did you ever figure anything out on this? I'm having the same issue with QML in Qt 5.15.8 where some text is incorrect on the same screen as some correct text. I also explicitly set the font to Roboto prior to displaying any QML. The weird part is, is the same build works on one Red Hat VM, but does not work on a slightly different RH VM.