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. Resizeable QTextEdit in layout
Forum Updated to NodeBB v4.3 + New Features

Resizeable QTextEdit in layout

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 5.1k 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.
  • A Offline
    A Offline
    arturoman
    wrote on last edited by
    #1

    I would like to mimic a construct that is seen on some web pages, where a text edit area has it's own resize grip in the corner. Even though it is in a layout, the resizing of that single widget forces the entire area to be layed out again based on the new size of the widget.

    Has anyone seen this done of have an idea of how to do it?

    Thanks!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AlekseyOk
      wrote on last edited by
      #2

      Do you want resizing like on this page in "Post a reply" window?

      If so, you need to inherit you class from QTextEdit, override mousePressEvent()/moveEvent()
      and paintEvent().

      1 Reply Last reply
      0
      • A Offline
        A Offline
        arturoman
        wrote on last edited by
        #3

        Yep, that was what I was looking for exactly. I assume I can then over-ride the paintEvent() to make the little grab thingy in the corner?

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AlekseyOk
          wrote on last edited by
          #4

          @
          void BlaBlaBlaClass::paintEvent(QPaintEvent* e)
          {
          QTextEdit::paintEvent(e);

          <code_to_draw_you_corner_grip>;
          }
          @

          1 Reply Last reply
          0
          • A Offline
            A Offline
            arturoman
            wrote on last edited by
            #5

            Sweet. Thanks!

            1 Reply Last reply
            0
            • A Offline
              A Offline
              arturoman
              wrote on last edited by
              #6

              Okay, I have my custom qtextedit working fine. But, the layout that it is in does not adapt to the new size of the custom qtextedit when I am resizing it. I can't seem to force the layout to readapt itself to the new size of the custom widget.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AlekseyOk
                wrote on last edited by
                #7

                As I understand you have QTextEdit layed in QLayout on QWidget. Then, in mouseReleaseEvent() you call QTextEdit::setGeometry(), but size won't change.
                Right?

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  AlekseyOk
                  wrote on last edited by
                  #8

                  May be this help is not too late. To show your size grip you can use

                  @QAbstractScrollArea::setCornerWidget()@

                  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