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. QPlainTextEdit resizeEvent not triggered on making document's blocks visible/invisible
Forum Updated to NodeBB v4.3 + New Features

QPlainTextEdit resizeEvent not triggered on making document's blocks visible/invisible

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.5k 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.
  • V Offline
    V Offline
    Varun
    wrote on last edited by
    #1

    I am using QT 4.8 to implement a class (derived from QPlainTextEdit) to log messages, which offers the functionality of folding/unfolding a set of messages. Each message is a QTextBlock.

    class MessageLog : public QPlainTextEdit
    {
       foldOrUnfoldTextBlocks(....)
       {
           // folds/unfolds a set of text blocks by QTextBlock's setVisible() API
           document()->documentLayout()->requestUpdate();
       }
    }
    

    The function foldOrUnfoldTextBlocks() does not trigger the resizeEvent() of MessageLog which leads to some messages being cut at the bottom on unfolding and leaves extra space at the bottom on folding.
    How is resizeEvent() supposed to be triggered on making text blocks visible/invisible in the document?

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

      Hi and welcome to devnet,

      What exactly are you trying to resize for ?

      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
      • V Offline
        V Offline
        Varun
        wrote on last edited by
        #3

        Hi SGaist,

        The resize of QPlainTextEdit is required in following two scenarios:

        • On making some of the invisible QtextBlocks visible, the size of the document changes. To accommodate the extra blocks, the QPlainTextEdit needs to be resized otherwise some of the blocks will be cut at the bottom
        • On making visible blocks invisible, extra white space will be left at the end in QPlainTextEdit
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Is your QPlainTextEdit in a layout ?

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

          V 1 Reply Last reply
          1
          • SGaistS SGaist

            Is your QPlainTextEdit in a layout ?

            V Offline
            V Offline
            Varun
            wrote on last edited by
            #5

            @SGaist QPlainTextEdit is in a QStackedWidget which is in a QVBoxLayout

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

              In that case, the resize of QPlaintTextEdit is managed by QVBoxLayout which manages QStackedWidget which manages your QPlainTextEdit.

              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

              • Login

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