May 7, 2012

felipe.c.sousa felipe.c.sou..
Ant Farmer
48 posts

Put limits with pixels[SOLVED]

 

I am, using html in Qt, and i want put limits in my strings for pixels, i use “mid” but the letters have diferent size, so not work very well.

sorry for my english. =)

 Signature 

From all, to all.

5 replies

May 8, 2012

DerManu DerManu
Robot Herder
452 posts

  1. QFontMetrics fm(theFontYoureUsing);
  2. QString originalText("very long phrase that might not fit inside the parent window, how sad.");
  3. QString outText = fm.elidedText(originalText, Qt::ElideRight, 200)

the 200 is the maximum width of the text. For example, outText might contain:
“very long phrase that might not fit insi…”

May 9, 2012

felipe.c.sousa felipe.c.sou..
Ant Farmer
48 posts

i can not include “QFontMetric”. Its need a new version to use that? My Qt is the 4.7.4.

 Signature 

From all, to all.

May 9, 2012

Andre Andre
Area 51 Engineer
6031 posts

QFontMetrics (note the ‘s’!) has been around for a very long time, at least since the 3.x days. So, it is there in your 4.7 version of Qt.

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

May 9, 2012

felipe.c.sousa felipe.c.sou..
Ant Farmer
48 posts

hehehe now i can include, i was write the rigth name, but i was drop the “gui”.

 Signature 

From all, to all.

May 9, 2012

felipe.c.sousa felipe.c.sou..
Ant Farmer
48 posts

thanks, is exactly what i want.

 Signature 

From all, to all.

 
  ‹‹ [SOLVED] How can I disable "block highlighting" in Qt Creator C++ source?      Include all source files in a subfolder ››

You must log in to post a reply. Not a member yet? Register here!