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. Stacked widget on dock widget cutting off display
Forum Updated to NodeBB v4.3 + New Features

Stacked widget on dock widget cutting off display

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 262 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.
  • B Offline
    B Offline
    Bob K.
    wrote on last edited by
    #1

    Qt Creator 8.0.1
    Qt 6.3.1 (MSVC 2019, x86_64)
    revision 9c963ce8ae
    Built on Aug 11 2022 01:13:43
    Windows 11
    C++
    Desktop application

    I have a dock widget which contains a stacked widget. The first page of the stacked widget contains a vertical layout with several widgets. In Qt Creator, and when I run the application, the right side of the display is cut off. I've included a screenshot of Qt Creator and a screenshot of the running application.

    QML

    <?xml version="1.0" encoding="UTF-8"?>
    <ui version="4.0">
     <class>MainWindow</class>
     <widget class="QMainWindow" name="MainWindow">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>0</y>
        <width>1000</width>
        <height>650</height>
       </rect>
      </property>
      <property name="windowTitle">
       <string>MainWindow</string>
      </property>
      <property name="windowIcon">
       <iconset>
        <normaloff>:/img/images/EES.ico</normaloff>:/img/images/EES.ico</iconset>
      </property>
      <widget class="QWidget" name="centralwidget">
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <widget class="QTabWidget" name="tabWidgetData">
          <property name="currentIndex">
           <number>0</number>
          </property>
          <widget class="QWidget" name="Session">
           <attribute name="title">
            <string>Session</string>
           </attribute>
           <layout class="QVBoxLayout" name="verticalLayout_5">
            <item>
             <layout class="QHBoxLayout" name="horizontalLayoutSessionDataTop">
              <item>
               <layout class="QVBoxLayout" name="verticalLayoutSessionDataTop">
                <item>
                 <layout class="QHBoxLayout" name="horizontalLayoutSessionIdentifier">
                  <item>
                   <widget class="QLabel" name="labelIdentifier">
                    <property name="minimumSize">
                     <size>
                      <width>80</width>
                      <height>0</height>
                     </size>
                    </property>
                    <property name="text">
                     <string>Identifier</string>
                    </property>
                    <property name="alignment">
                     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                    </property>
                   </widget>
                  </item>
                  <item>
                   <widget class="QLineEdit" name="lineEditIdentifier"/>
                  </item>
                 </layout>
                </item>
                <item>
                 <layout class="QFormLayout" name="formLayoutSessionType">
                  <item row="0" column="0">
                   <widget class="QLabel" name="labelSessionType">
                    <property name="minimumSize">
                     <size>
                      <width>80</width>
                      <height>0</height>
                     </size>
                    </property>
                    <property name="text">
                     <string>Session Type</string>
                    </property>
                    <property name="alignment">
                     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                    </property>
                   </widget>
                  </item>
                  <item row="0" column="1">
                   <widget class="QComboBox" name="comboBoxSessionType"/>
                  </item>
                 </layout>
                </item>
               </layout>
              </item>
              <item>
               <layout class="QVBoxLayout" name="verticalLayout_3">
                <item>
                 <layout class="QHBoxLayout" name="horizontalLayoutSessionCamera">
                  <item>
                   <widget class="QLabel" name="labelCamera">
                    <property name="minimumSize">
                     <size>
                      <width>60</width>
                      <height>0</height>
                     </size>
                    </property>
                    <property name="text">
                     <string>Camera</string>
                    </property>
                    <property name="alignment">
                     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                    </property>
                   </widget>
                  </item>
                  <item>
                   <widget class="QLineEdit" name="lineEditCamera"/>
                  </item>
                 </layout>
                </item>
                <item>
                 <layout class="QFormLayout" name="formLayoutSessionDate">
                  <item row="0" column="0">
                   <widget class="QLabel" name="labelDate">
                    <property name="minimumSize">
                     <size>
                      <width>60</width>
                      <height>0</height>
                     </size>
                    </property>
                    <property name="text">
                     <string>Date</string>
                    </property>
                    <property name="alignment">
                     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
                    </property>
                   </widget>
                  </item>
                  <item row="0" column="1">
                   <widget class="QDateTimeEdit" name="dateTimeEdit"/>
                  </item>
                 </layout>
                </item>
               </layout>
              </item>
             </layout>
            </item>
            <item>
             <widget class="QTabWidget" name="tabWidgetSessionData">
              <property name="currentIndex">
               <number>0</number>
              </property>
              <widget class="QWidget" name="Analog">
               <attribute name="title">
                <string>Analog</string>
               </attribute>
              </widget>
              <widget class="QWidget" name="Digital">
               <attribute name="title">
                <string>Digital</string>
               </attribute>
              </widget>
              <widget class="QWidget" name="ContactSheet">
               <attribute name="title">
                <string>Contact Sheet</string>
               </attribute>
              </widget>
             </widget>
            </item>
            <item>
             <widget class="QLabel" name="labelNotes">
              <property name="text">
               <string>Notes</string>
              </property>
              <property name="alignment">
               <set>Qt::AlignCenter</set>
              </property>
             </widget>
            </item>
            <item>
             <widget class="QPlainTextEdit" name="plainTextEdit">
              <property name="sizePolicy">
               <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
                <horstretch>0</horstretch>
                <verstretch>0</verstretch>
               </sizepolicy>
              </property>
              <property name="maximumSize">
               <size>
                <width>16777215</width>
                <height>60</height>
               </size>
              </property>
             </widget>
            </item>
            <item>
             <layout class="QHBoxLayout" name="horizontalLayoutSessionData">
              <item>
               <widget class="QPushButton" name="pushButtonSave">
                <property name="text">
                 <string>Save</string>
                </property>
               </widget>
              </item>
              <item>
               <widget class="QPushButton" name="pushButtonDelete">
                <property name="text">
                 <string>Delete</string>
                </property>
               </widget>
              </item>
              <item>
               <widget class="QPushButton" name="pushButtonCancel">
                <property name="text">
                 <string>Cancel</string>
                </property>
               </widget>
              </item>
             </layout>
            </item>
           </layout>
          </widget>
          <widget class="QWidget" name="Exposure">
           <attribute name="title">
            <string>Exposure</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="Output">
           <attribute name="title">
            <string>Output</string>
           </attribute>
          </widget>
          <widget class="QWidget" name="Search">
           <attribute name="title">
            <string>Search</string>
           </attribute>
           <layout class="QVBoxLayout" name="verticalLayout_4"/>
          </widget>
         </widget>
        </item>
       </layout>
      </widget>
      <widget class="QMenuBar" name="menubar">
       <property name="geometry">
        <rect>
         <x>0</x>
         <y>0</y>
         <width>1000</width>
         <height>26</height>
        </rect>
       </property>
       <widget class="QMenu" name="menuFile">
        <property name="title">
         <string>File</string>
        </property>
        <addaction name="actionExit"/>
       </widget>
       <widget class="QMenu" name="menuEdit">
        <property name="title">
         <string>Edit</string>
        </property>
       </widget>
       <widget class="QMenu" name="menuHelp">
        <property name="title">
         <string>Help</string>
        </property>
        <addaction name="actionAbout"/>
       </widget>
       <addaction name="menuFile"/>
       <addaction name="menuEdit"/>
       <addaction name="menuHelp"/>
      </widget>
      <widget class="QStatusBar" name="statusbar"/>
      <widget class="QDockWidget" name="dockWidgetLookup">
       <property name="minimumSize">
        <size>
         <width>350</width>
         <height>500</height>
        </size>
       </property>
       <property name="features">
        <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
       </property>
       <property name="allowedAreas">
        <set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
       </property>
       <attribute name="dockWidgetArea">
        <number>1</number>
       </attribute>
       <widget class="QWidget" name="dockWidgetContents">
        <layout class="QVBoxLayout" name="verticalLayout_2">
         <item>
          <widget class="QStackedWidget" name="stackedWidget">
           <property name="sizePolicy">
            <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
           <widget class="QWidget" name="pageSession">
            <widget class="QWidget" name="layoutWidget">
             <property name="geometry">
              <rect>
               <x>10</x>
               <y>0</y>
               <width>358</width>
               <height>295</height>
              </rect>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_6">
              <item>
               <layout class="QHBoxLayout" name="horizontalLayout">
                <item>
                 <widget class="QPushButton" name="pushButton">
                  <property name="text">
                   <string>Clear</string>
                  </property>
                 </widget>
                </item>
                <item>
                 <widget class="QLineEdit" name="lineEdit"/>
                </item>
                <item>
                 <widget class="QPushButton" name="pushButton_2">
                  <property name="text">
                   <string>Search</string>
                  </property>
                 </widget>
                </item>
               </layout>
              </item>
              <item>
               <widget class="QLabel" name="label">
                <property name="text">
                 <string>TextLabel</string>
                </property>
               </widget>
              </item>
              <item>
               <widget class="QTextEdit" name="textEdit"/>
              </item>
              <item>
               <widget class="QPushButton" name="pushButton_3">
                <property name="text">
                 <string>PushButton</string>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
           </widget>
           <widget class="QWidget" name="page_2"/>
          </widget>
         </item>
        </layout>
       </widget>
      </widget>
      <action name="actionExit">
       <property name="icon">
        <iconset resource="resources.qrc">
         <normaloff>:/images/Exit.png</normaloff>:/images/Exit.png</iconset>
       </property>
       <property name="text">
        <string>Exit</string>
       </property>
      </action>
      <action name="actionAbout">
       <property name="icon">
        <iconset resource="resources.qrc">
         <normaloff>:/images/AboutBox.png</normaloff>:/images/AboutBox.png</iconset>
       </property>
       <property name="text">
        <string>About</string>
       </property>
      </action>
     </widget>
     <resources>
      <include location="resources.qrc"/>
     </resources>
     <connections/>
    

    </ui>

    QtCreatorScreenshot.png

    ScreenshotStackWidget.png

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      You used a red layout it seems.
      Normally you would right-click and Apply a layout as the red ones are
      meant to be inserted into other layouts.

      So does the dock's widget have a layout?

      I think its what's wrong from a quick look.

      1 Reply Last reply
      1
      • B Offline
        B Offline
        Bob K.
        wrote on last edited by
        #3

        Thanks for the info about the red layouts.

        When the dock widget was blank, I added the stacked widget. And right clicking on the stacked widget there were no layouts available.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bob K.
          wrote on last edited by
          #4

          I stand corrected. I was able to add a vertical layout to the dock widget and now the stacked widget display is correct.

          Thank you.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved