Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Two textEdits both were called with setFont( sameFont) , yet one has larger font than the other ... but still they are the same font family..
Qt 6.11 is out! See what's new in the release blog

Two textEdits both were called with setFont( sameFont) , yet one has larger font than the other ... but still they are the same font family..

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lineaxe
    wrote on last edited by
    #1

    Hi , I have 2 textEdit windows , each have been given the same information on setting their fonts

    ui->textEdit->setFont(m_Font);    ui->textEdit_2->setFont(m_Font);
    

    note: the m_Font had been switched from points over to pixels to work with my display

    m_Font.setPixelSize(QFontInfo(m_Font).pixelSize());

    When I check to see what type of font each textEdit has , I get the following ...

    ui->textEdit->font() family:Sans Serif | ui->textEdit_2->font() family:Sans Serif
    ui->textEdit->font() pixelSize:21 | ui->textEdit_2->font() pixelSize:21
    ui->textEdit->font() bold:0 | ui->textEdit_2->font() bold():0
    Yet the fonts show up as different sizes in the two textEdits , what could be going on here ? Anyone have an idea ?

    1 Reply Last reply
    0
    • hskoglundH Offline
      hskoglundH Offline
      hskoglund
      wrote on last edited by
      #2

      Hi, if you look in Control Panel, Display, what's the size setting? If it's set not to 100% but instead 125% or 150%, then those kinds of inconsistencies I think can occur.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lineaxe
        wrote on last edited by
        #3

        Hi, I am not programming on a windoz machine at the moment. It is a Linux box ... However I am not sure if I can find similar settings to make one of the textEdits a different scale than the other. If i did it somehow while coding, I sure don't know where or when... :)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          have you changed the m_font pixelSize property before to assign it to both QTextEdit (or after)? Did you changed something between the 2 assignment?

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lineaxe
            wrote on last edited by
            #5

            Hi , m_font pixelSize is set in the constructor , it is also modified by reading a value in from a couple of different Xml files ...So it does get modified. I think that they must be losing sync in values somewhere.. Been debugging without qdebug since the target machine won't run it. So I am using other more primitive methods. Well, About time this code got a little UML anyhow I suppose !

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Lineaxe
              wrote on last edited by
              #6

              Well I cleaned up the code a bunch anyhow.. Still got some strange responses .I put the textedits into an update function so that when one font gets changed over to a new one (the 2nd textbox also gets modified.) No where else in the code are the fonts Set. There is a font merge that might be affecting things... On the search goes

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Lineaxe
                wrote on last edited by
                #7

                Well It was about time I cleaned up that code anyhow. Alot of it was experimental as I was trying out textEdit, textCursors, documents and all textedit related goodies..seems I did have a mergecharformat in there , as well ...

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcosta
                  wrote on last edited by
                  #8

                  Hi,

                  could you show some code that reproduce the issue??

                  Once your problem is solved don't forget to:

                  • Mark the thread as SOLVED using the Topic Tool menu
                  • Vote up the answer(s) that helped you to solve the issue

                  You can embed images using (http://imgur.com/) or (http://postimage.org/)

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved