Qt World Summit: Submit your Presentation

Dimensions of characters

  • Hi everyone.
    I have a question referred to the built of characters. Is the character included in a rectangle depending on the size and not on the font? If yes, how can I save the dimensions of this rectangle?

  • Lifetime Qt Champion


    What rectangle ?
    What font ?
    What are you doing ?

  • This post is deleted!

  • @SGaist I try to explain better the problem.
    We want to place another visible cursor in qtextedit.
    For doing this we try to use labels, but we need to understand its right position on the y axis to put it in.
    If all letters have the same size, it isn't a problem, we can do it with QRect of function QtextEdit::cursorRect() and the cursor appears in the position that we want to.
    But when we switch from a larger size (i.e 72) to a smaller one (i.e 12) and we continue to write on the same line, we resize our cursor and now we don't have any reference to place it.
    So we think that maybe there can be a general rule for fonts (for example all characters of size 9 have to fit a specific rectangle of specific dimensions indipendently on the font) that we can use for doing some proportion and calculate the right position. And if this rectangle exist how can we take its dimensions having only the size of font.

  • Lifetime Qt Champion

    Im not really sure what you are doing with those labels,
    but if its about font and a box around a string then
    can be used to get the rectangle for a given text string.

  • Banned

    This post is deleted!

Log in to reply