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. How to speed up performance of QTextEdit?
QtWS25 Last Chance

How to speed up performance of QTextEdit?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 2.1k Views
  • 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.
  • John-VuJ Offline
    John-VuJ Offline
    John-Vu
    wrote on last edited by
    #1

    I am implementing a panel which use QTextEdit to log message. I have a issue, when a long message is being printed on this panel, the results appear much faster if the panel is shorter than if it is taller(just resize it between larger and smaller).
    How to speed up performance the right way?

    raven-worxR 1 Reply Last reply
    0
    • John-VuJ John-Vu

      I am implementing a panel which use QTextEdit to log message. I have a issue, when a long message is being printed on this panel, the results appear much faster if the panel is shorter than if it is taller(just resize it between larger and smaller).
      How to speed up performance the right way?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @John-Vu
      this is due to the text layouting engine, which has to relayout on changes.
      Do you depend on QTextEdit?
      If no you could also use a QListView and add the log lines as rows to a model and let the item view widget layout it's visible items.
      This should perform better than the QTextEdit in this case.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      John-VuJ 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @John-Vu
        this is due to the text layouting engine, which has to relayout on changes.
        Do you depend on QTextEdit?
        If no you could also use a QListView and add the log lines as rows to a model and let the item view widget layout it's visible items.
        This should perform better than the QTextEdit in this case.

        John-VuJ Offline
        John-VuJ Offline
        John-Vu
        wrote on last edited by
        #3

        @raven-worx Thanks
        I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
        Can I use QListView and add the QTextEdit as rows? And do I have to add a model in this case?

        raven-worxR 1 Reply Last reply
        0
        • John-VuJ John-Vu

          @raven-worx Thanks
          I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.
          Can I use QListView and add the QTextEdit as rows? And do I have to add a model in this case?

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by raven-worx
          #4

          @John-Vu said:

          I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.

          This isn't really dependent than, but lazy ;)
          I meant dependent by any of QTextEdit features.
          Probably you just have a bad design? Why are do many parts in your application depend on a widget, but not just simply interchange the text directly, or at least a light-weight data class/struct.

          Can I use QListView and add the QTextEdit as rows?

          yes you could. But from a certain point onwards you performance will probably be even worse after all.

          And do I have to add a model in this case?

          A model is always involved when using item vie widgets.

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          John-VuJ 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @John-Vu said:

            I depend on QTextEdit because there are a lot of objects use this panel. If I don't use QTextEdit, I have to change a lot of things.

            This isn't really dependent than, but lazy ;)
            I meant dependent by any of QTextEdit features.
            Probably you just have a bad design? Why are do many parts in your application depend on a widget, but not just simply interchange the text directly, or at least a light-weight data class/struct.

            Can I use QListView and add the QTextEdit as rows?

            yes you could. But from a certain point onwards you performance will probably be even worse after all.

            And do I have to add a model in this case?

            A model is always involved when using item vie widgets.

            John-VuJ Offline
            John-VuJ Offline
            John-Vu
            wrote on last edited by
            #5

            @raven-worx I am implementing a terminal with QTextEdit in qt4.7.4 for a long time. I need some features of QTextEdit as: change text color, hyperlink, key & mouse events, call back previous command. Are these features available in QListView or am I able to implement them with QListView?
            And is QStringListModel compatible in this case?

            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