gnreeke
10th September 2009, 22:55
I put some text into a QTextBrowser or a QPlainTextEdit (both have the same problem).
The text has hex numbers separated by multiple blank spaces. In the display, varying numbers of these spaces seem to be deleted. I want the spaces to remain as coded.
In case it matters, I make the text with some old C code and then feed it into the Qt widgets like this (simplified to show the problem):
QString Qmdstr;
char mdln[] = " 13 467AF"
Qmdstr = QString(mdln);
MyApp->DataViewer->appendPlainText(Qmdstr);
What I see in the widget is something like " 13 467AF", i.e. some spaces removed.
I checked with gdb and the char string before conversion to a QString has the right format. I tried using setStyleSheet to get the closest thing I could find in the documentation to monospacing, like this:
MyApp->DataViewer->setStyleSheet("font-family: FixedFont;");
but this didn't help.
Any ideas what I am doing wrong?
[I have Qt 4.5.2 running in RedHat EL 5 64-bit. "DataViewer" is a QPlainTextFile widget created in designer. Everything else about it works OK.]
Thanks
gnreeke
The text has hex numbers separated by multiple blank spaces. In the display, varying numbers of these spaces seem to be deleted. I want the spaces to remain as coded.
In case it matters, I make the text with some old C code and then feed it into the Qt widgets like this (simplified to show the problem):
QString Qmdstr;
char mdln[] = " 13 467AF"
Qmdstr = QString(mdln);
MyApp->DataViewer->appendPlainText(Qmdstr);
What I see in the widget is something like " 13 467AF", i.e. some spaces removed.
I checked with gdb and the char string before conversion to a QString has the right format. I tried using setStyleSheet to get the closest thing I could find in the documentation to monospacing, like this:
MyApp->DataViewer->setStyleSheet("font-family: FixedFont;");
but this didn't help.
Any ideas what I am doing wrong?
[I have Qt 4.5.2 running in RedHat EL 5 64-bit. "DataViewer" is a QPlainTextFile widget created in designer. Everything else about it works OK.]
Thanks
gnreeke