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. Label text obscured in QFrame in QMainWindow (QT5)
Forum Updated to NodeBB v4.3 + New Features

Label text obscured in QFrame in QMainWindow (QT5)

Scheduled Pinned Locked Moved Unsolved General and Desktop
26 Posts 6 Posters 5.0k 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.
  • C charred_array

    @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

    @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

    Why are my g's obscured and how do I fix this?

    Apply a layout to your centralWidget and check if it still occurs

    How do I apply a layout to my widget?

    Pl45m4P Offline
    Pl45m4P Offline
    Pl45m4
    wrote on last edited by
    #4

    @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

    How do I apply a layout to my widget?

    Since you are already using the design mode to create an *.ui for your GUI:
    Rightclick centralWidget (as seen in your third screenshot) and select Layout.
    The red crossed circle symbol next to it indicates that centralWidget currently has no layout.


    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

    ~E. W. Dijkstra

    1 Reply Last reply
    1
    • C charred_array

      @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

      @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

      Why are my g's obscured and how do I fix this?

      Apply a layout to your centralWidget and check if it still occurs

      How do I apply a layout to my widget?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #5

      @charred_array Right-click on centralWidget and pick Set Layout (or maybe Layout>) on the menu.

      C 1 Reply Last reply
      0
      • JonBJ JonB

        @charred_array Right-click on centralWidget and pick Set Layout (or maybe Layout>) on the menu.

        C Offline
        C Offline
        charred_array
        wrote on last edited by
        #6

        @JonB
        screenshot 2023-05-16 135259.png

        I can not find this option.

        JonBJ Pl45m4P 2 Replies Last reply
        0
        • C charred_array

          @JonB
          screenshot 2023-05-16 135259.png

          I can not find this option.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #7

          @charred_array
          ! Umm, you can see neither @Pl45m4 nor I expected to see this! It's more like you are right-clicking on the QMainWindow than on the centralWidget, but I can see you have centralWidget selected.... :(

          From Creator's Help > About what version of Creator does it say you are using?

          C 1 Reply Last reply
          0
          • C charred_array

            @JonB
            screenshot 2023-05-16 135259.png

            I can not find this option.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #8

            @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

            I can not find this option.

            Strange...

            Two other options:

            • right-click inside the centralWidget area on your widget in Designer and then look for Layout or
            • select the centralWidget by left-clicking it and pick one layout option from the layout toolbar at the top (above the design area)

            More info:

            https://doc.qt.io/qt-6/designer-layouts.html
            https://doc.qt.io/qt-6/designer-layouts.html#setting-a-top-level-layout


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            1 Reply Last reply
            0
            • JonBJ JonB

              @charred_array
              ! Umm, you can see neither @Pl45m4 nor I expected to see this! It's more like you are right-clicking on the QMainWindow than on the centralWidget, but I can see you have centralWidget selected.... :(

              From Creator's Help > About what version of Creator does it say you are using?

              C Offline
              C Offline
              charred_array
              wrote on last edited by
              #9

              @JonB
              I'm using Qt Creator 7.0.2 with QT 5.15.2. I cannot change this since we are stuck with this version for this project.

              M 1 Reply Last reply
              0
              • C charred_array

                @JonB
                I'm using Qt Creator 7.0.2 with QT 5.15.2. I cannot change this since we are stuck with this version for this project.

                M Offline
                M Offline
                mpergand
                wrote on last edited by
                #10

                @charred_array

                Works even with older QCreator.

                C 1 Reply Last reply
                0
                • M mpergand

                  @charred_array

                  Works even with older QCreator.

                  C Offline
                  C Offline
                  charred_array
                  wrote on last edited by
                  #11

                  @mpergand
                  Thanks. I do have those options.
                  I tried applying the "Form Layout", but it didn't have the desired effect. Not much changed other than a weird grey square behind the screen during booting and z order of widgets screwed up. Still an obscured g.
                  Also the screens that do work don't have a layout either:

                  screenshot 2023-05-16 165440.png

                  Pl45m4P 1 Reply Last reply
                  0
                  • C charred_array

                    @mpergand
                    Thanks. I do have those options.
                    I tried applying the "Form Layout", but it didn't have the desired effect. Not much changed other than a weird grey square behind the screen during booting and z order of widgets screwed up. Still an obscured g.
                    Also the screens that do work don't have a layout either:

                    screenshot 2023-05-16 165440.png

                    Pl45m4P Offline
                    Pl45m4P Offline
                    Pl45m4
                    wrote on last edited by Pl45m4
                    #12

                    @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                    I tried applying the "Form Layout"

                    Form layout is not be the best option to pick here. Go for horizontal- or verticalLayout.
                    Form layout works best for simple inputs where you usually have a pair of widgets in each row (e.g. QLabel description + some widget like a QLineEdit input field or some QSpinBox)

                    Also the screens that do work don't have a layout either

                    There you only have one widget. (Might or might not be the point)
                    Layouts really start to work once you have multiple widgets in one container.


                    If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                    ~E. W. Dijkstra

                    C 1 Reply Last reply
                    0
                    • C charred_array

                      I have a label inside a QFrame. This QFrame is inside a qwidget and this widget is inside of a QMainWindow. The text in this label is obscured: the g is only partially visible. This is strange since the frame is large enough for the text.
                      In all of the screens it works fine except in the main window. It also looks good in the preview.
                      The settings for these widgets are identical. I even copied a QFrame with its label from a different screen and it is also obscured. The only difference is that it's inside the main window. I checked all the settings in the ui files and in the qss file and I couldn't find anything.
                      I tried to set the margins to 0 in software:

                      this->setContentsMargins(0,0,0,0);
                      ui->centralWidget->setContentsMargins(0,0,0,0);
                      ui->frame_6->setContentsMargins(0,0,0,0);
                      ui->ScreenName_2->setContentsMargins(0,0,0,0);
                      

                      But this didn't change anything.

                      Good label on a second screen.ui:
                      IMG_20230516_120618.jpg

                      Obscured label on main screen:
                      IMG_20230516_120605.jpg

                      Settings:

                      screenshots 2023-05-16 122355.png

                      Why are my g's obscured and how do I fix this?

                      JoeCFDJ Offline
                      JoeCFDJ Offline
                      JoeCFD
                      wrote on last edited by
                      #13

                      @charred_array Your font size is too big or your label height is too small. Maybe try to set its sizePolicy to [Preferred, Expanding.0,0]

                      C 1 Reply Last reply
                      0
                      • Pl45m4P Pl45m4

                        @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                        I tried applying the "Form Layout"

                        Form layout is not be the best option to pick here. Go for horizontal- or verticalLayout.
                        Form layout works best for simple inputs where you usually have a pair of widgets in each row (e.g. QLabel description + some widget like a QLineEdit input field or some QSpinBox)

                        Also the screens that do work don't have a layout either

                        There you only have one widget. (Might or might not be the point)
                        Layouts really start to work once you have multiple widgets in one container.

                        C Offline
                        C Offline
                        charred_array
                        wrote on last edited by
                        #14

                        @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

                        There you only have one widget. (Might or might not be the point)
                        Layouts really start to work once you have multiple widgets in one container.

                        I only showed 1 widget, but the screens all have over a hundred of widgets, labels popups etc.

                        @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

                        Form layout is not be the best option to pick here. Go for horizontal- or verticalLayout.
                        Form layout works best for simple inputs where you usually have a pair of widgets in each row (e.g. QLabel description + some widget like a QLineEdit input field or some QSpinBox)

                        Changing this to vertical or horizontal will screw up the current layout that took hundreds of hours to tweak. There is nothing wrong with the positioning in this screen. Only the text field that is not rendering properly for an unknown reason.

                        1 Reply Last reply
                        0
                        • JoeCFDJ JoeCFD

                          @charred_array Your font size is too big or your label height is too small. Maybe try to set its sizePolicy to [Preferred, Expanding.0,0]

                          C Offline
                          C Offline
                          charred_array
                          wrote on last edited by charred_array
                          #15

                          @JoeCFD said in Label text obscured in QFrame in QMainWindow (QT5):

                          @charred_array Your font size is too big or your label height is too small. Maybe try to set its sizePolicy to [Preferred, Expanding.0,0]

                          Tweaking the size did work. But it screwed up the alignment. Now the screen label on the main screen is lower than that of other screens. I cannot edit geometry as it's greyed out. It's at least 7 pixels below the frame. It's a little better, but it still doesn't answer my question why the same label is rendered differently on a different screen.

                          Pl45m4P 1 Reply Last reply
                          0
                          • C charred_array

                            @JoeCFD said in Label text obscured in QFrame in QMainWindow (QT5):

                            @charred_array Your font size is too big or your label height is too small. Maybe try to set its sizePolicy to [Preferred, Expanding.0,0]

                            Tweaking the size did work. But it screwed up the alignment. Now the screen label on the main screen is lower than that of other screens. I cannot edit geometry as it's greyed out. It's at least 7 pixels below the frame. It's a little better, but it still doesn't answer my question why the same label is rendered differently on a different screen.

                            Pl45m4P Offline
                            Pl45m4P Offline
                            Pl45m4
                            wrote on last edited by Pl45m4
                            #16

                            @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                            Tweaking the size did work. But it screwed up the alignment. Now the screen label on the main screen is lower than that of other screens.

                            There is a solution for this: layouts *cough*

                            I would assume that a layout would take care of the (or at least some) issues and resize (i.e. expand) the label and the rest according to its content size.
                            But I clearly do not know what else do you have in there, how "the rest" of your app / GUI look like and what impact mentioned changes would have.


                            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                            ~E. W. Dijkstra

                            Christian EhrlicherC C 2 Replies Last reply
                            0
                            • Pl45m4P Pl45m4

                              @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                              Tweaking the size did work. But it screwed up the alignment. Now the screen label on the main screen is lower than that of other screens.

                              There is a solution for this: layouts *cough*

                              I would assume that a layout would take care of the (or at least some) issues and resize (i.e. expand) the label and the rest according to its content size.
                              But I clearly do not know what else do you have in there, how "the rest" of your app / GUI look like and what impact mentioned changes would have.

                              Christian EhrlicherC Offline
                              Christian EhrlicherC Offline
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on last edited by
                              #17

                              @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

                              There is a solution for this: layouts cough

                              And that's the only valid solution tbh - everything else will break sooner or later.

                              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                              Visit the Qt Academy at https://academy.qt.io/catalog

                              1 Reply Last reply
                              2
                              • Pl45m4P Pl45m4

                                @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                                Tweaking the size did work. But it screwed up the alignment. Now the screen label on the main screen is lower than that of other screens.

                                There is a solution for this: layouts *cough*

                                I would assume that a layout would take care of the (or at least some) issues and resize (i.e. expand) the label and the rest according to its content size.
                                But I clearly do not know what else do you have in there, how "the rest" of your app / GUI look like and what impact mentioned changes would have.

                                C Offline
                                C Offline
                                charred_array
                                wrote on last edited by charred_array
                                #18

                                @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

                                There is a solution for this: layouts *cough*

                                Unfortunately it doesn't work. I used vertical layout and the g's are still covered up or misaligned. Plus there is an extra margin around the edge. Why isn't QT simply WYSIWYG?

                                I also tried grid layout, but there is an extra margin around the edge.
                                I tried to get rid of the margin but nothing helped:

                                margin: 0px;
                                spacing: 0px;
                                padding: 0px;
                                border: 0px;
                                
                                Pl45m4P 1 Reply Last reply
                                0
                                • C charred_array

                                  @Pl45m4 said in Label text obscured in QFrame in QMainWindow (QT5):

                                  There is a solution for this: layouts *cough*

                                  Unfortunately it doesn't work. I used vertical layout and the g's are still covered up or misaligned. Plus there is an extra margin around the edge. Why isn't QT simply WYSIWYG?

                                  I also tried grid layout, but there is an extra margin around the edge.
                                  I tried to get rid of the margin but nothing helped:

                                  margin: 0px;
                                  spacing: 0px;
                                  padding: 0px;
                                  border: 0px;
                                  
                                  Pl45m4P Offline
                                  Pl45m4P Offline
                                  Pl45m4
                                  wrote on last edited by
                                  #19

                                  @charred_array

                                  Can you post a small example GUI to reproduce your situation (widget, font size, text...)
                                  I doubt that you cant fix this issue using layouts and maybe some additional tuning (padding, margin etc.)


                                  If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                  ~E. W. Dijkstra

                                  C 1 Reply Last reply
                                  0
                                  • Pl45m4P Pl45m4

                                    @charred_array

                                    Can you post a small example GUI to reproduce your situation (widget, font size, text...)
                                    I doubt that you cant fix this issue using layouts and maybe some additional tuning (padding, margin etc.)

                                    C Offline
                                    C Offline
                                    charred_array
                                    wrote on last edited by
                                    #20

                                    @Pl45m4
                                    I stripped the screen in question (I was able to compile it after deleting code reffering to elements on the screen, but I cannot run it. I deleted too many things).
                                    Here is the ui file:

                                    <?xml version="1.0" encoding="UTF-8"?>
                                    <ui version="4.0">
                                     <class>ExampleScreen</class>
                                     <widget class="QMainWindow" name="ExampleScreen">
                                      <property name="enabled">
                                       <bool>true</bool>
                                      </property>
                                      <property name="geometry">
                                       <rect>
                                        <x>0</x>
                                        <y>0</y>
                                        <width>800</width>
                                        <height>480</height>
                                       </rect>
                                      </property>
                                      <property name="font">
                                       <font>
                                        <family>Segoe UI</family>
                                       </font>
                                      </property>
                                      <property name="windowTitle">
                                       <string notr="true">Project name</string>
                                      </property>
                                      <property name="styleSheet">
                                       <string notr="true">background-color: rgb(89, 89, 89);
                                        font-family: Segoe UI;</string>
                                      </property>
                                      <widget class="QWidget" name="centralWidget">
                                       <widget class="QFrame" name="frame_5">
                                        <property name="geometry">
                                         <rect>
                                          <x>0</x>
                                          <y>0</y>
                                          <width>640</width>
                                          <height>48</height>
                                         </rect>
                                        </property>
                                        <property name="minimumSize">
                                         <size>
                                          <width>640</width>
                                          <height>48</height>
                                         </size>
                                        </property>
                                        <property name="styleSheet">
                                         <string notr="true">background-color: #4d4d4d;</string>
                                        </property>
                                        <property name="frameShape">
                                         <enum>QFrame::NoFrame</enum>
                                        </property>
                                        <property name="frameShadow">
                                         <enum>QFrame::Raised</enum>
                                        </property>
                                        <layout class="QHBoxLayout" name="horizontalLayout_5">
                                         <item>
                                          <spacer name="horizontalSpacer_10">
                                           <property name="orientation">
                                            <enum>Qt::Horizontal</enum>
                                           </property>
                                           <property name="sizeType">
                                            <enum>QSizePolicy::Fixed</enum>
                                           </property>
                                           <property name="sizeHint" stdset="0">
                                            <size>
                                             <width>10</width>
                                             <height>20</height>
                                            </size>
                                           </property>
                                          </spacer>
                                         </item>
                                         <item>
                                          <widget class="QLabel" name="ScreenName">
                                           <property name="font">
                                            <font>
                                             <family>Segoe UI</family>
                                             <pointsize>-1</pointsize>
                                            </font>
                                           </property>
                                           <property name="styleSheet">
                                            <string notr="true">background-color: #4d4d4d;
                                    color : white;
                                    font-size: 23px;</string>
                                           </property>
                                           <property name="text">
                                            <string>ggggggggggggg</string>
                                           </property>
                                           <property name="alignment">
                                            <set>Qt::AlignCenter</set>
                                           </property>
                                           <property name="margin">
                                            <number>0</number>
                                           </property>
                                           <property name="indent">
                                            <number>48</number>
                                           </property>
                                          </widget>
                                         </item>
                                         <item>
                                          <spacer name="horizontalSpacer_11">
                                           <property name="orientation">
                                            <enum>Qt::Horizontal</enum>
                                           </property>
                                           <property name="sizeHint" stdset="0">
                                            <size>
                                             <width>40</width>
                                             <height>20</height>
                                            </size>
                                           </property>
                                          </spacer>
                                         </item>
                                         <item>
                                          <widget class="QLabel" name="networkActiveIcon">
                                           <property name="minimumSize">
                                            <size>
                                             <width>35</width>
                                             <height>30</height>
                                            </size>
                                           </property>
                                           <property name="maximumSize">
                                            <size>
                                             <width>35</width>
                                             <height>30</height>
                                            </size>
                                           </property>
                                           <property name="styleSheet">
                                            <string notr="true">color  :#a7a7a9;
                                    font-size: 20px;
                                    background-color: #4d4d4d;</string>
                                           </property>
                                           <property name="text">
                                            <string notr="true"/>
                                           </property>
                                           <property name="pixmap">
                                            <pixmap resource="my-project/recource.qrc">:/images/images/network/Icon_Network_Busy.png</pixmap>
                                           </property>
                                           <property name="scaledContents">
                                            <bool>true</bool>
                                           </property>
                                           <property name="alignment">
                                            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                                           </property>
                                          </widget>
                                         </item>
                                         <item>
                                          <widget class="QLabel" name="systemDateTime">
                                           <property name="styleSheet">
                                            <string notr="true">color  :#a7a7a9;
                                    font-size: 20px;
                                    background-color: #4d4d4d;</string>
                                           </property>
                                           <property name="text">
                                            <string notr="true">05 Jan 2017  16:25</string>
                                           </property>
                                           <property name="alignment">
                                            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                                           </property>
                                          </widget>
                                         </item>
                                        </layout>
                                       </widget>
                                      </widget>
                                     </widget>
                                     <layoutdefault spacing="6" margin="11"/>
                                     <resources>
                                      <include location="my-project/recource.qrc"/>
                                     </resources>
                                     <connections/>
                                     <slots>
                                     </slots>
                                    </ui>
                                    
                                    M 1 Reply Last reply
                                    0
                                    • C charred_array

                                      @Pl45m4
                                      I stripped the screen in question (I was able to compile it after deleting code reffering to elements on the screen, but I cannot run it. I deleted too many things).
                                      Here is the ui file:

                                      <?xml version="1.0" encoding="UTF-8"?>
                                      <ui version="4.0">
                                       <class>ExampleScreen</class>
                                       <widget class="QMainWindow" name="ExampleScreen">
                                        <property name="enabled">
                                         <bool>true</bool>
                                        </property>
                                        <property name="geometry">
                                         <rect>
                                          <x>0</x>
                                          <y>0</y>
                                          <width>800</width>
                                          <height>480</height>
                                         </rect>
                                        </property>
                                        <property name="font">
                                         <font>
                                          <family>Segoe UI</family>
                                         </font>
                                        </property>
                                        <property name="windowTitle">
                                         <string notr="true">Project name</string>
                                        </property>
                                        <property name="styleSheet">
                                         <string notr="true">background-color: rgb(89, 89, 89);
                                          font-family: Segoe UI;</string>
                                        </property>
                                        <widget class="QWidget" name="centralWidget">
                                         <widget class="QFrame" name="frame_5">
                                          <property name="geometry">
                                           <rect>
                                            <x>0</x>
                                            <y>0</y>
                                            <width>640</width>
                                            <height>48</height>
                                           </rect>
                                          </property>
                                          <property name="minimumSize">
                                           <size>
                                            <width>640</width>
                                            <height>48</height>
                                           </size>
                                          </property>
                                          <property name="styleSheet">
                                           <string notr="true">background-color: #4d4d4d;</string>
                                          </property>
                                          <property name="frameShape">
                                           <enum>QFrame::NoFrame</enum>
                                          </property>
                                          <property name="frameShadow">
                                           <enum>QFrame::Raised</enum>
                                          </property>
                                          <layout class="QHBoxLayout" name="horizontalLayout_5">
                                           <item>
                                            <spacer name="horizontalSpacer_10">
                                             <property name="orientation">
                                              <enum>Qt::Horizontal</enum>
                                             </property>
                                             <property name="sizeType">
                                              <enum>QSizePolicy::Fixed</enum>
                                             </property>
                                             <property name="sizeHint" stdset="0">
                                              <size>
                                               <width>10</width>
                                               <height>20</height>
                                              </size>
                                             </property>
                                            </spacer>
                                           </item>
                                           <item>
                                            <widget class="QLabel" name="ScreenName">
                                             <property name="font">
                                              <font>
                                               <family>Segoe UI</family>
                                               <pointsize>-1</pointsize>
                                              </font>
                                             </property>
                                             <property name="styleSheet">
                                              <string notr="true">background-color: #4d4d4d;
                                      color : white;
                                      font-size: 23px;</string>
                                             </property>
                                             <property name="text">
                                              <string>ggggggggggggg</string>
                                             </property>
                                             <property name="alignment">
                                              <set>Qt::AlignCenter</set>
                                             </property>
                                             <property name="margin">
                                              <number>0</number>
                                             </property>
                                             <property name="indent">
                                              <number>48</number>
                                             </property>
                                            </widget>
                                           </item>
                                           <item>
                                            <spacer name="horizontalSpacer_11">
                                             <property name="orientation">
                                              <enum>Qt::Horizontal</enum>
                                             </property>
                                             <property name="sizeHint" stdset="0">
                                              <size>
                                               <width>40</width>
                                               <height>20</height>
                                              </size>
                                             </property>
                                            </spacer>
                                           </item>
                                           <item>
                                            <widget class="QLabel" name="networkActiveIcon">
                                             <property name="minimumSize">
                                              <size>
                                               <width>35</width>
                                               <height>30</height>
                                              </size>
                                             </property>
                                             <property name="maximumSize">
                                              <size>
                                               <width>35</width>
                                               <height>30</height>
                                              </size>
                                             </property>
                                             <property name="styleSheet">
                                              <string notr="true">color  :#a7a7a9;
                                      font-size: 20px;
                                      background-color: #4d4d4d;</string>
                                             </property>
                                             <property name="text">
                                              <string notr="true"/>
                                             </property>
                                             <property name="pixmap">
                                              <pixmap resource="my-project/recource.qrc">:/images/images/network/Icon_Network_Busy.png</pixmap>
                                             </property>
                                             <property name="scaledContents">
                                              <bool>true</bool>
                                             </property>
                                             <property name="alignment">
                                              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                                             </property>
                                            </widget>
                                           </item>
                                           <item>
                                            <widget class="QLabel" name="systemDateTime">
                                             <property name="styleSheet">
                                              <string notr="true">color  :#a7a7a9;
                                      font-size: 20px;
                                      background-color: #4d4d4d;</string>
                                             </property>
                                             <property name="text">
                                              <string notr="true">05 Jan 2017  16:25</string>
                                             </property>
                                             <property name="alignment">
                                              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                                             </property>
                                            </widget>
                                           </item>
                                          </layout>
                                         </widget>
                                        </widget>
                                       </widget>
                                       <layoutdefault spacing="6" margin="11"/>
                                       <resources>
                                        <include location="my-project/recource.qrc"/>
                                       </resources>
                                       <connections/>
                                       <slots>
                                       </slots>
                                      </ui>
                                      
                                      M Offline
                                      M Offline
                                      mpergand
                                      wrote on last edited by mpergand
                                      #21

                                      @charred_array
                                      Add a layout to main window.

                                      and a spacer if you want your hlayout to be on top.

                                      C 1 Reply Last reply
                                      1
                                      • M mpergand

                                        @charred_array
                                        Add a layout to main window.

                                        and a spacer if you want your hlayout to be on top.

                                        C Offline
                                        C Offline
                                        charred_array
                                        wrote on last edited by
                                        #22

                                        @mpergand said in Label text obscured in QFrame in QMainWindow (QT5):

                                        @charred_array
                                        Add a layout to main window.

                                        and a spacer if you want your hlayout to be on top.

                                        How do I get frame_5 at the very top? I still see spacing in your example.

                                        M C 2 Replies Last reply
                                        0
                                        • C charred_array

                                          @mpergand said in Label text obscured in QFrame in QMainWindow (QT5):

                                          @charred_array
                                          Add a layout to main window.

                                          and a spacer if you want your hlayout to be on top.

                                          How do I get frame_5 at the very top? I still see spacing in your example.

                                          M Offline
                                          M Offline
                                          mpergand
                                          wrote on last edited by mpergand
                                          #23

                                          @charred_array said in Label text obscured in QFrame in QMainWindow (QT5):

                                          How do I get frame_5 at the very top? I still see spacing in your example.

                                          Set the top margin to 0 :

                                          and to the central widget as well if you like.

                                          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