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 handle amount of text blocks?
QtWS25 Last Chance

How to handle amount of text blocks?

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 1.6k 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.
  • T Offline
    T Offline
    toyman
    wrote on last edited by
    #1

    Hi Guys,

    I would like to know if there is one solution to handle thousands of text blocks and set invisible to them at one time?

    It is very slow if the program sets visiblility to false/true as block by block.

    Thank you in advance

    1 Reply Last reply
    0
    • E Offline
      E Offline
      edmon
      wrote on last edited by
      #2

      Hi toyman,

      you mean in QML? If so, why not using property binding triggered by a "global" property e.g. in your root QML file?

      Let's say your root QML file is called "main.qml":

      @
      ...
      Item {
      id: main

      property bool globalTextVisibleFlag: true // or false, whatever you need here

      ...
      }@

      And in the QMLs using your Text blocks:

      @
      ...
      Text {
      ...
      visible: main.globalTextVisibleFlag
      ...
      }
      ...@

      This allows to set all those text blocks' visibility by one single property change like:
      @
      function setAllTextVisibility(newVisibility) {
      main.globalTextVisibleFlag = newVisibility
      }
      @

      Hope this helps
      Regards, edmon

      1 Reply Last reply
      0
      • T Offline
        T Offline
        toyman
        wrote on last edited by
        #3

        Thanks, edmon.

        It is C++ application not QML.

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

          Hi and welcome to devnet,

          You might be interested by "this":http://qt-project.org/doc/qt-5/qwidget.html#updatesEnabled-prop

          Hope it helps

          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
          • T Offline
            T Offline
            toyman
            wrote on last edited by
            #5

            Hi SGaist,

            Thanks for your help.

            I tried this before but it is still busy to process the visibility for each text block and it has around 10k blocks to be implemented.

            I actually added the setUpdatesEnabled(false) for QPlainTextEdit object before the loop and inserted setUpdatedEnabled(true) after the loop.

            It should stop updating and painting until the visibility has been set and then continue to paint and update for QPlainTextEdit. However, it is still very slow to process.

            1 Reply Last reply
            0
            • T Offline
              T Offline
              toyman
              wrote on last edited by
              #6

              I may have some wrong steps and please correct me :)

              1 Reply Last reply
              0
              • T Offline
                T Offline
                toyman
                wrote on last edited by
                #7

                I found that the text frame (QTextFrame) can warp text blocks but it does not provide any functions in order to set visibility.

                http://qt-project.org/doc/qt-5/qtextframe-members.html

                It there anything can be done with layout or format to achieve this?

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  toyman
                  wrote on last edited by
                  #8

                  I plan to use QTimer and set interval as 40 min sec then it should be resolved.

                  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