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 lags when starting to write
Forum Updated to NodeBB v4.3 + New Features

QTextEdit lags when starting to write

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 5 Posters 1.9k 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
    legitnameyo
    wrote on last edited by
    #1

    I've got a QTextEdit in my program and everything has worked fine without lag, until some compile's ago. I don't know what it is but for some reason the first time I start writing in the QTextEdit it takes about 2 - 3 seconds before the text actually shows up! I can start the program and then wait like 1 minute before writing but it still takes a few seconds for the text to show up. After the lag however there is no lag, just the first text written. Any ideas on why? Anyone else experienced this issue as well?

    1 Reply Last reply
    1
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      Quick Question - which Qt version & platform to check this ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

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

        I'm using Qt creator 4.7.2 built on Qt 5.11.2 Clang 8.0 on MacOS

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #4

          Tried with Qt 5.11.0 on MacOS. I did not see the issue. Very difficult to tell what is the issue. Can you try simple example with only QTextEdit ? Does it give the same issue ? Can you try with simple lineEdit as well ? Does it also give the same issue ?

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

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

            I've tried with a normal QTextEdit example and I did not see the issue. LineEdit does not appear to have the issue either.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hi,

              What do you mean by normal QTextEdit ? How is it different from the one you are seeing that delay on ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                With "normal" I mean I used the example on qt's own website, nothing flashy, fancy, compile heavy or uses tons of include files to fix problems impractically.

                aha_1980A 1 Reply Last reply
                0
                • L legitnameyo

                  With "normal" I mean I used the example on qt's own website, nothing flashy, fancy, compile heavy or uses tons of include files to fix problems impractically.

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

                  Hi @legitnameyo,

                  The question was more: what is different in your text edit to the plain Qt one? Obviously there is a difference.

                  Qt has to stay free or it will die.

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

                    The difference is that I changed the code in the HTML BEFORE the program even launched. Ever if I delete the change, the lag persists. The only thing that works is creating a new QTextEdit inside the project. As soon as I double click it and edit anything, the text edit lags when I start writing in it after compile and launch.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Then you have to write down a minimal compilable example that shows that behaviour. We currently can only do guess jobs about what might going on.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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

                        I can do it in steps:

                        1. Start QT creator
                        2. Create a regular desktop project
                        3. Add a QTextEdit
                        4. Double click on it and write something in the HTML edit tab that pops up
                        5. Save and compile
                        6. Start it, and the close the program
                        7. Double click on the QTextEdit and remove the added text
                        8. Save all and compile
                        9. Laggy text after you start the program
                        

                        That's a overly detailed example of what makes QTextEdit lag on my computer. It's all about adding and removing text once in the QTextEdit after double clicking on it

                        aha_1980A 1 Reply Last reply
                        0
                        • L legitnameyo

                          I can do it in steps:

                          1. Start QT creator
                          2. Create a regular desktop project
                          3. Add a QTextEdit
                          4. Double click on it and write something in the HTML edit tab that pops up
                          5. Save and compile
                          6. Start it, and the close the program
                          7. Double click on the QTextEdit and remove the added text
                          8. Save all and compile
                          9. Laggy text after you start the program
                          

                          That's a overly detailed example of what makes QTextEdit lag on my computer. It's all about adding and removing text once in the QTextEdit after double clicking on it

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

                          @legitnameyo what happens, if you don't add text with the designer, but by program?

                          Qt has to stay free or it will die.

                          1 Reply Last reply
                          0
                          • Y Offline
                            Y Offline
                            yatima1460
                            wrote on last edited by yatima1460
                            #13

                            I have the exact same issue

                            #include <QtWidgets/QApplication>
                            #include <QtWidgets/QTextEdit>
                            
                            int main(int argc, char* argv[])
                            {
                            	QApplication a(argc, argv);
                            
                            	QTextEdit textEdit;
                            	textEdit.show();
                            
                            	return a.exec();
                            }
                            

                            Just this is enough to make QTextEdit lag like @legitnameyo said.
                            Maybe because of different hardware but on my PC it takes about 0.5 seconds before something appears in the text edit.

                            EDIT: yes it happens even in Release mode without a debugger attached

                            Qt: 5.13.0 msvc2017_64

                            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