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. [SOLVED] textEdit: how to remove the margins of mainwindow
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] textEdit: how to remove the margins of mainwindow

Scheduled Pinned Locked Moved General and Desktop
8 Posts 4 Posters 8.0k 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.
  • K Offline
    K Offline
    kalster
    wrote on last edited by
    #1

    when putting the textEdit widget inside of a dock widget and maximizing the textEdit widget, it does not maximize to the border of the dock widget. Instead, there is about a 20 pixel gap in between the maximized textEdit widget and the dock widget. How, through style sheets probably, can i get the edges of the maximized textEdit widget to be at the border of the docked widget? in the dock method, I have tried to setContentsMargins() to 0 but that have no effect.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sigrid
      wrote on last edited by
      #2

      Does calling

      @setWidget(yourTextEdit)@

      give you what you need? Then the QTextEdit should fill the dockwidget area. See the documentation on "setWidget":http://doc.qt.nokia.com/latest/qdockwidget.html#setWidget

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kalster
        wrote on last edited by
        #3

        i am getting the error: 'setWidget' was not declared in this scope

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mlong
          wrote on last edited by
          #4

          You need to use
          @
          yourdockwidget->setWidget(...);
          @

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kalster
            wrote on last edited by
            #5

            i got it set correctly now. thank you.

            I have push buttons in the dock widget and now they are gone. how can i get them back while using the setWidget?

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6

              Try setlayout and add all your widgets to that layout...

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • K Offline
                K Offline
                kalster
                wrote on last edited by
                #7

                i found that the following code also works great. does anyone know how to set the margins for the textEdit that is maximized in the mainwindow and without any dock widget? I would like to get the textEdit closer to the edge of the screen.

                @ui->dockWidgetBottomLeft->setContentsMargins(-10,-10,-10,-10);@

                why is the following code not working. its should remove the margins around the textEdit when not inside of a dock widget. the dock widgets is surrounding the mainwindow widget.

                @this->layout()->setMargin( 0 );
                this->layout()->setContentsMargins(-10,-10,-10,-10);@

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kalster
                  wrote on last edited by
                  #8

                  i solved it with the following code.
                  @QMainWindow::centralWidget()->layout()->setContentsMargins(0,0,0,0);@

                  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