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. QTextEdit make text bold
Forum Updated to NodeBB v4.3 + New Features

QTextEdit make text bold

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 5 Posters 12.7k Views 2 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
    legitnameyo
    wrote on last edited by
    #7

    I've tried quite a number of different fonts, and none of them works with bold. I also added some code so that the text changes to both italic and bold, but the text only changes to italic for my "make bold" function. Then I thought, do I actually change the font weight? I added a log function and the answer is yes, I change the font weight but it still wont show up in QTextEdit when I run the program and write in the text edit window...

    mrjjM 1 Reply Last reply
    0
    • L legitnameyo

      I've tried quite a number of different fonts, and none of them works with bold. I also added some code so that the text changes to both italic and bold, but the text only changes to italic for my "make bold" function. Then I thought, do I actually change the font weight? I added a log function and the answer is yes, I change the font weight but it still wont show up in QTextEdit when I run the program and write in the text edit window...

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #8

      @legitnameyo
      Hi
      So did you try the sample @SGaist linked ?
      http://doc.qt.io/qt-5/qtwidgets-richtext-textedit-example.html
      it would be interesting to know if bold works there.
      Just takes a moment to test and tell us if its a Qt/system thing or
      local to your code.

      1 Reply Last reply
      1
      • L Offline
        L Offline
        legitnameyo
        wrote on last edited by
        #9

        For some weird reason it's global, system wide. It doesn't matter if I use the rich text edit example or some other project, bold doesn't work on my system with QT QTextEdit.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          legitnameyo
          wrote on last edited by
          #10

          I'm using Qt Creator 4.8.0, Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit) on MacBook Air with macOS Mojave. I've not had this issue before. It has worked but somewhere along the way it stopped working.

          mrjjM 1 Reply Last reply
          0
          • L legitnameyo

            I'm using Qt Creator 4.8.0, Based on Qt 5.12.0 (Clang 10.0 (Apple), 64 bit) on MacBook Air with macOS Mojave. I've not had this issue before. It has worked but somewhere along the way it stopped working.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #11

            Hi
            Ok so its global for Qt at least.
            What about other non Qt apps ? Can they do bold?

            1 Reply Last reply
            0
            • L Offline
              L Offline
              legitnameyo
              wrote on last edited by legitnameyo
              #12

              Yes, not being able to see bold text is exclusive to my Qt apps. I get these project errors as well:

              Project WARNING: Qt has only been tested with version 10.13 of the platform SDK, you're using 10.14.
              Project WARNING: This is an unsupported configuration. You may experience build issues, and by using
              Project WARNING: the 10.14 SDK you are opting in to new features that Qt has not been prepared for.
              Project WARNING: E.g., 10.14 enables dark mode and layer-backed views, which Qt 5.11 does not support.
              Project WARNING: Please downgrade the SDK you use to build your app to version 10.13, or configure
              Project WARNING: with CONFIG+=sdk_no_version_check when running qmake to silence this warning.
              

              Is this an issue regarding my os?

              JonBJ 1 Reply Last reply
              0
              • L legitnameyo

                Yes, not being able to see bold text is exclusive to my Qt apps. I get these project errors as well:

                Project WARNING: Qt has only been tested with version 10.13 of the platform SDK, you're using 10.14.
                Project WARNING: This is an unsupported configuration. You may experience build issues, and by using
                Project WARNING: the 10.14 SDK you are opting in to new features that Qt has not been prepared for.
                Project WARNING: E.g., 10.14 enables dark mode and layer-backed views, which Qt 5.11 does not support.
                Project WARNING: Please downgrade the SDK you use to build your app to version 10.13, or configure
                Project WARNING: with CONFIG+=sdk_no_version_check when running qmake to silence this warning.
                

                Is this an issue regarding my os?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #13

                @legitnameyo
                You should maybe take a look at https://forum.qt.io/topic/98943/qpainter-drawtext-bold/5. That user is also experiencing Bold problems under MacOS, maybe your problem is related?

                mrjjM 1 Reply Last reply
                3
                • JonBJ JonB

                  @legitnameyo
                  You should maybe take a look at https://forum.qt.io/topic/98943/qpainter-drawtext-bold/5. That user is also experiencing Bold problems under MacOS, maybe your problem is related?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  @JonB
                  Good call, but turn out to just be QPainter issue and
                  the Rich Text sample did work.

                  1 Reply Last reply
                  1
                  • L Offline
                    L Offline
                    legitnameyo
                    wrote on last edited by legitnameyo
                    #15

                    I tried running an old QTextEdit project with no issues that had a QTextEdit and a make bold funciton, but it doesn't work anymore there either! Is there another way to set text to bold?

                    Edit: When I changed the default html that you see after starting the program to some bold text, the text stays bold. I can display bold text, but I can't edit text to become bold. I can only pre-define bold text, not create bold text nor remake normal text to bold text.

                    Edit2: After double pressing the QTextEdit in Qt creator I get up the "change HTML" window and there I can define some bold text. After creating some bold text, then writing normal text and then compile and run the program I can write and change text to bold as I please. What I am trying to say is that, when I already have bold text AND normal text in the program, the bold function works. The issue then is that there is a slight delay between when I write and when the text shows up on the screen! I've created a thread about this issue earlier but to no success.

                    mrjjM 1 Reply Last reply
                    0
                    • L legitnameyo

                      I tried running an old QTextEdit project with no issues that had a QTextEdit and a make bold funciton, but it doesn't work anymore there either! Is there another way to set text to bold?

                      Edit: When I changed the default html that you see after starting the program to some bold text, the text stays bold. I can display bold text, but I can't edit text to become bold. I can only pre-define bold text, not create bold text nor remake normal text to bold text.

                      Edit2: After double pressing the QTextEdit in Qt creator I get up the "change HTML" window and there I can define some bold text. After creating some bold text, then writing normal text and then compile and run the program I can write and change text to bold as I please. What I am trying to say is that, when I already have bold text AND normal text in the program, the bold function works. The issue then is that there is a slight delay between when I write and when the text shows up on the screen! I've created a thread about this issue earlier but to no success.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by mrjj
                      #16

                      @legitnameyo
                      Hi
                      Please see
                      https://bugreports.qt.io/browse/QTBUG-69955

                      I think that is what we are seeing.

                      Also check out
                      https://forum.qt.io/topic/98943/qpainter-drawtext-bold as he
                      seemingly has the same issue as you.

                      Update:
                      He installed 5.12.1 snapshot and Bold now works for him.
                      If possible, please try that.

                      1 Reply Last reply
                      2
                      • L Offline
                        L Offline
                        legitnameyo
                        wrote on last edited by
                        #17

                        I can't seem to find a qt 5.12.1.dmg file anywhere on qt's website, where exactly is it located?

                        aha_1980A 1 Reply Last reply
                        0
                        • L legitnameyo

                          I can't seem to find a qt 5.12.1.dmg file anywhere on qt's website, where exactly is it located?

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #18

                          @legitnameyo it is not released yet, you can probably find a snapshot or use the online installer.

                          Qt has to stay free or it will die.

                          1 Reply Last reply
                          1
                          • L Offline
                            L Offline
                            legitnameyo
                            wrote on last edited by
                            #19

                            I can't find any "qt 5.12.1 snapshot" .dmg file on the QT wesbite... can anyone give me the link? Also I do not have the "make" command nor the "configure" command, just a heads up! (I don't know why I don't have those commands.)

                            mrjjM 1 Reply Last reply
                            0
                            • L legitnameyo

                              I can't find any "qt 5.12.1 snapshot" .dmg file on the QT wesbite... can anyone give me the link? Also I do not have the "make" command nor the "configure" command, just a heads up! (I don't know why I don't have those commands.)

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by mrjj
                              #20

                              @legitnameyo
                              What about in the maintenance tool ?
                              alt text

                              on windows, its located in the base Qt folder.
                              I assume it somewhat the same on macOS.

                              1 Reply Last reply
                              2
                              • L Offline
                                L Offline
                                legitnameyo
                                wrote on last edited by
                                #21

                                Yup, updating to 5.12.1 solved it! :) Thanks!

                                1 Reply Last reply
                                2

                                • Login

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