Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QLabel inserts (automatic) a blank line
Forum Updated to NodeBB v4.3 + New Features

QLabel inserts (automatic) a blank line

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 5 Posters 822 Views 3 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.
  • P Offline
    P Offline
    peter-70
    wrote on last edited by
    #1

    I have written a post on stackoverflow. If anyone knows, I would be very grateful for a description!

    https://stackoverflow.com/questions/54178206/qlabel-inserts-automatic-a-blank-line

    K 1 Reply Last reply
    0
    • P peter-70

      I have written a post on stackoverflow. If anyone knows, I would be very grateful for a description!

      https://stackoverflow.com/questions/54178206/qlabel-inserts-automatic-a-blank-line

      K Offline
      K Offline
      koahnig
      wrote on last edited by koahnig
      #2

      @peter-70

      You should give more details of your actual source here.

      Also info on OS and Qt versions.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • P Offline
        P Offline
        peter-70
        wrote on last edited by
        #3

        Qt Creator 4.6.2
        Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)
        Built on Jun 18 2018 11:51:56
        From revision 1ddfb443b6

        iOS 12.1.2

        Hope it helps!

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

          Perhaps your labels are for some reason aligned at bottom. Use setAlignment() to try to fix.

          P 1 Reply Last reply
          0
          • M mvuori

            Perhaps your labels are for some reason aligned at bottom. Use setAlignment() to try to fix.

            P Offline
            P Offline
            peter-70
            wrote on last edited by
            #5

            @mvuori No, I set the alignment extra to top. It is an additional line break at begin of my text. But these line break is inserted by QLabel!

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

              Hi,

              Can you provide a minimal compilable example that reproduces that behaviour ?

              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
              • P peter-70

                Qt Creator 4.6.2
                Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)
                Built on Jun 18 2018 11:51:56
                From revision 1ddfb443b6

                iOS 12.1.2

                Hope it helps!

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @peter-70 said in QLabel inserts (automatic) a blank line:

                Qt Creator 4.6.2
                Based on Qt 5.11.1 (Clang 8.0 (Apple), 64 bit)

                Just a note for the future: this is NOT necessarily Qt version you're using. This is the Qt version which was used to compile QtCreator. To find out which Qt version you're using go to your Kit configuration and see there.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                3
                • P Offline
                  P Offline
                  peter-70
                  wrote on last edited by
                  #8

                  EDIT:

                  I noticed something (probably) quite important. If I build my UI so that it is not embraced by a vertical layout, then the QLabels will be displayed correctly. But if I build them up so that all elements are spanned by a vertical layout, then there is the rendering problem (as described above). This extremely strange behavior is comprehensible and man can be switched back and forth: with QVBoxLayout-> display error, without QVBoxLayout-> no errors, and so on ...

                  Here you can see the UI-Code without vertical layout around the UI-elements:

                  [?xml version="1.0" encoding="UTF-8"?]
                  [ui version="4.0"]
                   [class]PrjNameMeldung1_5[/class]
                   [widget class="QMainWindow" name="PrjNameMeldung1_5"]
                    [property name="geometry"]
                     [rect]
                      [x]0[/x]
                      [y]0[/y]
                      [width]375[/width]
                      [height]444[/height]
                     [/rect]
                    [/property]
                    [property name="windowTitle"]
                     [string]MainWindow[/string]
                    [/property]
                    [widget class="QWidget" name="centralwidget"]
                     [widget class="QWidget" name="gridLayoutWidget"]
                      [property name="geometry"]
                       [rect]
                        [x]9[/x]
                        [y]25[/y]
                        [width]361[/width]
                        [height]401[/height]
                       [/rect]
                      [/property]
                      [layout class="QGridLayout" name="gridLayout"]
                       [item row="3" column="0"]
                        [widget class="PrjListControl" name="listWidget"]
                         [property name="sizePolicy"]
                          [sizepolicy hsizetype="Expanding" vsizetype="Expanding"]
                           [horstretch]0[/horstretch]
                           [verstretch]0[/verstretch]
                          [/sizepolicy]
                         [/property]
                        [/widget]
                       [/item]
                       [item row="1" column="0"]
                        [widget class="QLabel" name="m_editTPAggregat"]
                         [property name="text"]
                          [string]TPAggregat[/string]
                         [/property]
                        [/widget]
                       [/item]
                       [item row="2" column="0"]
                        [widget class="QLabel" name="m_labelAuswahl"]
                         [property name="text"]
                          [string]Baugruppe[/string]
                         [/property]
                         [property name="alignment"]
                          [set]Qt::AlignCenter[/set]
                         [/property]
                        [/widget]
                       [/item]
                       [item row="0" column="0"]
                        [widget class="QLabel" name="m_editTP"]
                         [property name="text"]
                          [string]TP[/string]
                         [/property]
                         [property name="alignment"]
                          [set]Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop[/set]
                         [/property]
                        [/widget]
                       [/item]
                      [/layout]
                     [/widget]
                     [widget class="PrjToolBar" name="m_groupMenuBar" native="true"]
                      [property name="geometry"]
                       [rect]
                        [x]9[/x]
                        [y]425[/y]
                        [width]357[/width]
                        [height]16[/height]
                       [/rect]
                      [/property]
                      [property name="sizePolicy"]
                       [sizepolicy hsizetype="Preferred" vsizetype="Fixed"]
                        [horstretch]0[/horstretch]
                        [verstretch]0[/verstretch]
                       [/sizepolicy]
                      [/property]
                      [property name="minimumSize"]
                       [size]
                        [width]0[/width]
                        [height]10[/height]
                       [/size]
                      [/property]
                     [/widget]
                     [widget class="PrjNavigationBar" name="m_groupWindowTitle" native="true"]
                      [property name="geometry"]
                       [rect]
                        [x]9[/x]
                        [y]9[/y]
                        [width]357[/width]
                        [height]16[/height]
                       [/rect]
                      [/property]
                      [property name="sizePolicy"]
                       [sizepolicy hsizetype="Preferred" vsizetype="Fixed"]
                        [horstretch]0[/horstretch]
                        [verstretch]0[/verstretch]
                       [/sizepolicy]
                      [/property]
                      [property name="minimumSize"]
                       [size]
                        [width]0[/width]
                        [height]10[/height]
                       [/size]
                      [/property]
                     [/widget]
                    [/widget]
                   [/widget]
                   [customwidgets]
                    [customwidget]
                     [class]PrjToolBar[/class]
                     [extends]QWidget[/extends]
                     [header location="global"]controls/Prjtoolbar.h[/header]
                     [container]1[/container]
                    [/customwidget]
                    [customwidget]
                     [class]PrjNavigationBar[/class]
                     [extends]QWidget[/extends]
                     [header location="global"]controls/Prjnavigationbar.h[/header]
                     [container]1[/container]
                    [/customwidget]
                    [customwidget]
                     [class]PrjListControl[/class]
                     [extends]QListWidget[/extends]
                     [header location="global"]controls/Prjlistcontrol.h[/header]
                    [/customwidget]
                   [/customwidgets]
                   [resources/]
                   [connections/]
                  [/ui]
                  

                  And here you can see the UI-Code with vertical layout around the UI-elements:

                  [?xml version="1.0" encoding="UTF-8"?]
                  [ui version="4.0"]
                   [class]PrjNameMeldung1_5[/class]
                   [widget class="QMainWindow" name="PrjNameMeldung1_5"]
                    [property name="geometry"]
                     [rect]
                      [x]0[/x]
                      [y]0[/y]
                      [width]375[/width]
                      [height]444[/height]
                     [/rect]
                    [/property]
                    [property name="windowTitle"]
                     [string]MainWindow[/string]
                    [/property]
                    [widget class="QWidget" name="centralwidget"]
                     [layout class="QVBoxLayout" name="verticalLayout"]
                      [item]
                       [widget class="PrjNavigationBar" name="m_groupWindowTitle" native="true"]
                        [property name="sizePolicy"]
                         [sizepolicy hsizetype="Preferred" vsizetype="Fixed"]
                          [horstretch]0[/horstretch]
                          [verstretch]0[/verstretch]
                         [/sizepolicy]
                        [/property]
                        [property name="minimumSize"]
                         [size]
                          [width]0[/width]
                          [height]10[/height]
                         [/size]
                        [/property]
                       [/widget]
                      [/item]
                      [item]
                       [layout class="QGridLayout" name="gridLayout"]
                        [item row="3" column="0"]
                         [widget class="PrjListControl" name="listWidget"]
                          [property name="sizePolicy"]
                           [sizepolicy hsizetype="Expanding" vsizetype="Expanding"]
                            [horstretch]0[/horstretch]
                            [verstretch]0[/verstretch]
                           [/sizepolicy]
                          [/property]
                         [/widget]
                        [/item]
                        [item row="1" column="0"]
                         [widget class="QLabel" name="m_editTPAggregat"]
                          [property name="text"]
                           [string]TPAggregat[/string]
                          [/property]
                         [/widget]
                        [/item]
                        [item row="2" column="0"]
                         [widget class="QLabel" name="m_labelAuswahl"]
                          [property name="text"]
                           [string]Baugruppe[/string]
                          [/property]
                          [property name="alignment"]
                           [set]Qt::AlignCenter[/set]
                          [/property]
                         [/widget]
                        [/item]
                        [item row="0" column="0"]
                         [widget class="QLabel" name="m_editTP"]
                          [property name="text"]
                           [string]TP[/string]
                          [/property]
                          [property name="alignment"]
                           [set]Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop[/set]
                          [/property]
                         [/widget]
                        [/item]
                       [/layout]
                      [/item]
                      [item]
                       [widget class="PrjToolBar" name="m_groupMenuBar" native="true"]
                        [property name="sizePolicy"]
                         [sizepolicy hsizetype="Preferred" vsizetype="Fixed"]
                          [horstretch]0[/horstretch]
                          [verstretch]0[/verstretch]
                         [/sizepolicy]
                        [/property]
                        [property name="minimumSize"]
                         [size]
                          [width]0[/width]
                          [height]10[/height]
                         [/size]
                        [/property]
                       [/widget]
                      [/item]
                     [/layout]
                    [/widget]
                   [/widget]
                   [customwidgets]
                    [customwidget]
                     [class]PrjToolBar[/class]
                     [extends]QWidget[/extends]
                     [header location="global"]controls/Prjtoolbar.h[/header]
                     [container]1[/container]
                    [/customwidget]
                    [customwidget]
                     [class]PrjNavigationBar[/class]
                     [extends]QWidget[/extends]
                     [header location="global"]controls/Prjnavigationbar.h[/header]
                     [container]1[/container]
                    [/customwidget]
                    [customwidget]
                     [class]PrjListControl[/class]
                     [extends]QListWidget[/extends]
                     [header location="global"]controls/Prjlistcontrol.h[/header]
                    [/customwidget]
                   [/customwidgets]
                   [resources/]
                   [connections/]
                  [/ui]
                  
                  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