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 not Expanding
Qt 6.11 is out! See what's new in the release blog

QTextEdit not Expanding

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.8k 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.
  • a8wzA Offline
    a8wzA Offline
    a8wz
    wrote on last edited by a8wz
    #1

    In Windows 7 64bit, using QtCreator 3.0.1 with Qt 5.2.1 I have a MainWindow with nothing inside but a QTextEdit widget, I am using a Grid Layout. When I test the window with the preview function (Alt+Shift-R) the text widget expands and shrinks with the MainWindow as it should, but when I run the app, the same text widget expands no more than a certain size while the MainWindow keeps expanding. I tried sizePolicies (Preferred,Preferred) and (Expanding, Expending) but they don't make a difference. There is no code that manipulates size policies or window sizes in the app.

    What could i be doing wrong or missing, any help is appreciated.

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ckakman
      wrote on last edited by
      #2

      It is not possible to fin out what's wrong without seeing any code/ui but make sure that the maximum width/height of QTextEdit is not set to values less that than your screen's width/height.

      If you can, create a sample project that reproduces your issue and upload it somewhere so that people here can take a look.

      1 Reply Last reply
      0
      • a8wzA Offline
        a8wzA Offline
        a8wz
        wrote on last edited by
        #3

        Ok, I will do that, thanks, and by the way the min/max width/height are at their default values (0x0) and (16777215x16777215)

        1 Reply Last reply
        0
        • a8wzA Offline
          a8wzA Offline
          a8wz
          wrote on last edited by
          #4

          I think I located the source of the problem. In mycode I am using:

          @ui->textEdit->installEventFilter(mainWindow);@

          to handle mouse events, does this require me to also handle resize events manually?

          1 Reply Last reply
          0
          • a8wzA Offline
            a8wzA Offline
            a8wz
            wrote on last edited by
            #5

            I found the solution. I needed to add the following code in MainWindow::eventFilter. Now the textEdit widget resizes properly.

            @ if (event->type() == QEvent::Resize) {
            return false;
            }
            @

            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