Qt-interest Archive, July 2006
Determining Character X Position
Message 1 in thread
Hello All!
I am running SuSE 9.3 and Qt. 3.3.6.
I am trying to discover a means of determining the x coordinates of
characters inside a Qt widget that supports text editing. I am currently
using a QMultiLineEdit, setting the cursor position and using
cursorPoint(), although this method is very expensive to use frequently. I
do not believe to be able to use QFontMetrics.width() as I need to support
bi-directional text (in otherwords, I cannot assume that while iterating
character indices, that characters proceed left-to-right or right-to-left).
If anyone has any ideas, your help would be very greatly appreciated!
One other idea that I have would invlove getting the coordinates (or
rectangle or region) of highlighted/marked text. If anyone know how this
could be accomplished, this would also be of exceptional help to me.
Thank You Very Much!
-Craig
--
[ signature omitted ]
Message 2 in thread
> Hello All!
Hi Craig.
> I am trying to discover a means of determining the x coordinates of
> characters inside a Qt widget that supports text editing. I am currently
> using a QMultiLineEdit, setting the cursor position and using
> cursorPoint(), although this method is very expensive to use frequently. I
> do not believe to be able to use QFontMetrics.width() as I need to support
> bi-directional text (in otherwords, I cannot assume that while iterating
> character indices, that characters proceed left-to-right or right-to-left).
Maybe going once through all positions and caching the x coordinates
(and trying tho keep the cache in sync on subsequent changes) is an
option for you.
Andre'
--
[ signature omitted ]