如何在QT Designer中调整分组框的大小

时间:2019-02-19 21:30:59

标签: qt qt-designer

我不确定这是bug还是QT Designer的设计方式,但是我无法使用希望使用的“蓝框”来调整QT小部件上任何元素的大小。我也不允许将最小/最大尺寸编辑为零。我需要更改某些设置吗?还是仅仅是一个错误?

Blue Boxes for resizing

Full QT UI

.UI文件:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MeshGeneratorWidget</class>
 <widget class="QWidget" name="MeshGeneratorWidget">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>927</width>
    <height>789</height>
   </rect>
  </property>
  <property name="sizePolicy">
   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
    <horstretch>0</horstretch>
    <verstretch>0</verstretch>
   </sizepolicy>
  </property>
  <property name="windowTitle">
   <string>Mesh Generator</string>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout_4">
   <item>
    <widget class="AlignmentSceneviewerWidget" name="sceneviewer_widget" native="true">
     <property name="sizePolicy">
      <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
       <horstretch>4</horstretch>
       <verstretch>0</verstretch>
      </sizepolicy>
     </property>
     <widget class="QDockWidget" name="dockWidget">
      <property name="geometry">
       <rect>
        <x>0</x>
        <y>-10</y>
        <width>492</width>
        <height>771</height>
       </rect>
      </property>
      <property name="sizePolicy">
       <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
        <horstretch>1</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="minimumSize">
       <size>
        <width>492</width>
        <height>557</height>
       </size>
      </property>
      <property name="features">
       <set>QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
      </property>
      <property name="allowedAreas">
       <set>Qt::AllDockWidgetAreas</set>
      </property>
      <property name="windowTitle">
       <string>Control Panel</string>
      </property>
      <widget class="QWidget" name="dockWidgetContents">
       <property name="sizePolicy">
        <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
         <horstretch>0</horstretch>
         <verstretch>0</verstretch>
        </sizepolicy>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <widget class="QScrollArea" name="scrollArea">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
          <property name="minimumSize">
           <size>
            <width>0</width>
            <height>0</height>
           </size>
          </property>
          <property name="verticalScrollBarPolicy">
           <enum>Qt::ScrollBarAsNeeded</enum>
          </property>
          <property name="widgetResizable">
           <bool>true</bool>
          </property>
          <widget class="QWidget" name="scrollAreaWidgetContents_2">
           <property name="geometry">
            <rect>
             <x>0</x>
             <y>0</y>
             <width>472</width>
             <height>388</height>
            </rect>
           </property>
           <property name="sizePolicy">
            <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
             <horstretch>0</horstretch>
             <verstretch>0</verstretch>
            </sizepolicy>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_2">
            <property name="leftMargin">
             <number>0</number>
            </property>
            <property name="topMargin">
             <number>0</number>
            </property>
            <property name="rightMargin">
             <number>0</number>
            </property>
            <property name="bottomMargin">
             <number>0</number>
            </property>
            <item>
             <layout class="QVBoxLayout" name="verticalLayout_3">
              <item>
               <widget class="QGroupBox" name="time_groupBox">
                <property name="title">
                 <string>Time:</string>
                </property>
                <layout class="QGridLayout" name="gridLayout_4">
                 <item row="0" column="1">
                  <widget class="QDoubleSpinBox" name="timeValue_doubleSpinBox">
                   <property name="maximum">
                    <double>12000.000000000000000</double>
                   </property>
                  </widget>
                 </item>
                 <item row="1" column="2">
                  <widget class="QCheckBox" name="timeLoop_checkBox">
                   <property name="text">
                    <string>Loop</string>
                   </property>
                  </widget>
                 </item>
                 <item row="0" column="0">
                  <widget class="QLabel" name="timeValue_label">
                   <property name="text">
                    <string>Time value:</string>
                   </property>
                  </widget>
                 </item>
                 <item row="1" column="1">
                  <widget class="QPushButton" name="timePlayStop_pushButton">
                   <property name="text">
                    <string>Play</string>
                   </property>
                  </widget>
                 </item>
                </layout>
               </widget>
              </item>
              <item>
               <widget class="QGroupBox" name="groupBox_2">
                <property name="maximumSize">
                 <size>
                  <width>16777215</width>
                  <height>234</height>
                 </size>
                </property>
                <property name="title">
                 <string>Adjust Data</string>
                </property>
                <widget class="QSlider" name="adjustData_Slider">
                 <property name="geometry">
                  <rect>
                   <x>20</x>
                   <y>50</y>
                   <width>431</width>
                   <height>22</height>
                  </rect>
                 </property>
                 <property name="autoFillBackground">
                  <bool>false</bool>
                 </property>
                 <property name="minimum">
                  <number>-200</number>
                 </property>
                 <property name="maximum">
                  <number>200</number>
                 </property>
                 <property name="singleStep">
                  <number>1</number>
                 </property>
                 <property name="orientation">
                  <enum>Qt::Horizontal</enum>
                 </property>
                 <property name="invertedAppearance">
                  <bool>false</bool>
                 </property>
                </widget>
                <widget class="QLabel" name="label_3">
                 <property name="geometry">
                  <rect>
                   <x>410</x>
                   <y>70</y>
                   <width>55</width>
                   <height>16</height>
                  </rect>
                 </property>
                 <property name="text">
                  <string>+2s</string>
                 </property>
                </widget>
                <widget class="QLabel" name="label_4">
                 <property name="geometry">
                  <rect>
                   <x>30</x>
                   <y>70</y>
                   <width>55</width>
                   <height>16</height>
                  </rect>
                 </property>
                 <property name="text">
                  <string>-2s</string>
                 </property>
                </widget>
                <widget class="QPushButton" name="pushButton_3">
                 <property name="geometry">
                  <rect>
                   <x>60</x>
                   <y>170</y>
                   <width>201</width>
                   <height>24</height>
                  </rect>
                 </property>
                 <property name="text">
                  <string>View data with video</string>
                 </property>
                </widget>
                <widget class="QPushButton" name="viewVideo_button">
                 <property name="geometry">
                  <rect>
                   <x>180</x>
                   <y>90</y>
                   <width>121</width>
                   <height>24</height>
                  </rect>
                 </property>
                 <property name="text">
                  <string>View Video</string>
                 </property>
                </widget>
               </widget>
              </item>
              <item>
               <widget class="QGroupBox" name="video_groupBox">
                <property name="title">
                 <string>Video:</string>
                </property>
                <layout class="QGridLayout" name="gridLayout_2">
                 <item row="0" column="0">
                  <widget class="QLabel" name="frameIndex_label">
                   <property name="text">
                    <string>Frame index:</string>
                   </property>
                  </widget>
                 </item>
                 <item row="1" column="1">
                  <widget class="QSpinBox" name="framesPerSecond_spinBox">
                   <property name="minimum">
                    <number>1</number>
                   </property>
                   <property name="value">
                    <number>25</number>
                   </property>
                  </widget>
                 </item>
                 <item row="0" column="1">
                  <widget class="QSpinBox" name="frameIndex_spinBox">
                   <property name="minimum">
                    <number>1</number>
                   </property>
                   <property name="maximum">
                    <number>10000</number>
                   </property>
                  </widget>
                 </item>
                 <item row="1" column="0">
                  <widget class="QLabel" name="framesPerSecond_label">
                   <property name="text">
                    <string>Frames per second:</string>
                   </property>
                  </widget>
                 </item>
                 <item row="0" column="2">
                  <widget class="QFrame" name="numFrames_frame">
                   <property name="frameShape">
                    <enum>QFrame::StyledPanel</enum>
                   </property>
                   <property name="frameShadow">
                    <enum>QFrame::Raised</enum>
                   </property>
                   <layout class="QHBoxLayout" name="horizontalLayout_4">
                    <property name="leftMargin">
                     <number>0</number>
                    </property>
                    <property name="topMargin">
                     <number>0</number>
                    </property>
                    <property name="rightMargin">
                     <number>0</number>
                    </property>
                    <property name="bottomMargin">
                     <number>0</number>
                    </property>
                    <item>
                     <widget class="QLabel" name="numFrames_label">
                      <property name="text">
                       <string># frames:</string>
                      </property>
                     </widget>
                    </item>
                    <item>
                     <widget class="QLabel" name="numFramesValue_label">
                      <property name="text">
                       <string>TextLabel</string>
                      </property>
                     </widget>
                    </item>
                   </layout>
                  </widget>
                 </item>
                </layout>
               </widget>
              </item>
             </layout>
            </item>
           </layout>
          </widget>
         </widget>
        </item>
        <item>
         <widget class="QGroupBox" name="groupBox">
          <property name="title">
           <string>GroupBox</string>
          </property>
          <widget class="QLineEdit" name="lineEdit">
           <property name="geometry">
            <rect>
             <x>200</x>
             <y>0</y>
             <width>113</width>
             <height>20</height>
            </rect>
           </property>
          </widget>
         </widget>
        </item>
        <item>
         <widget class="QGroupBox" name="blackfynn_groupBox">
          <property name="title">
           <string>Blackfynn:</string>
          </property>
          <layout class="QGridLayout" name="gridLayout_5">
           <item row="6" column="2">
            <widget class="QPushButton" name="downloadData_button">
             <property name="text">
              <string>Download Data</string>
             </property>
            </widget>
           </item>
           <item row="5" column="3">
            <widget class="QPushButton" name="blackfynnTimeSeries_pushButton">
             <property name="toolTip">
              <string>Retrieve time series</string>
             </property>
             <property name="text">
              <string/>
             </property>
             <property name="icon">
              <iconset>
               <normaloff>:/meshgeneratorstep/images/download-icon-blue.png</normaloff>:/meshgeneratorstep/images/download-icon-blue.png</iconset>
             </property>
            </widget>
           </item>
           <item row="9" column="2">
            <widget class="QLineEdit" name="exportDirectory_lineEdit">
             <property name="text">
              <string>C:\Users\jkho021\Projects\MPB</string>
             </property>
            </widget>
           </item>
           <item row="7" column="2">
            <widget class="QPushButton" name="pushButton">
             <property name="text">
              <string>Export for WebGL</string>
             </property>
            </widget>
           </item>
           <item row="2" column="2">
            <widget class="QComboBox" name="blackfynnDatasets_comboBox">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
               <horstretch>1</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
             </property>
            </widget>
           </item>
           <item row="2" column="0">
            <widget class="QLabel" name="blackfynnDatasets_label">
             <property name="text">
              <string>Datasets:</string>
             </property>
            </widget>
           </item>
           <item row="2" column="3">
            <widget class="QPushButton" name="blackfynnDatasets_pushButton">
             <property name="toolTip">
              <string>Retrieve datasets</string>
             </property>
             <property name="text">
              <string/>
             </property>
             <property name="icon">
              <iconset>
               <normaloff>:/meshgeneratorstep/images/download-icon-blue.png</normaloff>:/meshgeneratorstep/images/download-icon-blue.png</iconset>
             </property>
            </widget>
           </item>
           <item row="5" column="2">
            <widget class="QComboBox" name="blackfynnTimeSeries_comboBox">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
               <horstretch>1</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
             </property>
            </widget>
           </item>
           <item row="5" column="0">
            <widget class="QLabel" name="blackfynnTimeSeries_label">
             <property name="text">
              <string>Time series:</string>
             </property>
            </widget>
           </item>
           <item row="8" column="2">
            <widget class="QPushButton" name="pushButton_2">
             <property name="text">
              <string>Upload to Blackfynn</string>
             </property>
            </widget>
           </item>
           <item row="1" column="0" colspan="4">
            <widget class="QGroupBox" name="blackfynnProfiles_groupBox">
             <property name="title">
              <string>Profiles:</string>
             </property>
             <layout class="QHBoxLayout" name="horizontalLayout_5">
              <item>
               <widget class="QComboBox" name="profiles_comboBox">
                <property name="sizePolicy">
                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
                  <horstretch>1</horstretch>
                  <verstretch>0</verstretch>
                 </sizepolicy>
                </property>
               </widget>
              </item>
              <item>
               <widget class="QPushButton" name="addProfile_pushButton">
                <property name="toolTip">
                 <string>Add profile</string>
                </property>
                <property name="text">
                 <string/>
                </property>
                <property name="icon">
                 <iconset>
                  <normaloff>:/meshgeneratorstep/images/plus-icon-green-th.png</normaloff>:/meshgeneratorstep/images/plus-icon-green-th.png</iconset>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
           </item>
           <item row="0" column="0">
            <widget class="QFrame" name="frame_2">
             <property name="frameShape">
              <enum>QFrame::StyledPanel</enum>
             </property>
             <property name="frameShadow">
              <enum>QFrame::Raised</enum>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
        </item>
        <item>
         <widget class="QFrame" name="frame">
          <property name="frameShape">
           <enum>QFrame::StyledPanel</enum>
          </property>
          <property name="frameShadow">
           <enum>QFrame::Raised</enum>
          </property>
          <layout class="QHBoxLayout" name="horizontalLayout_2">
           <property name="leftMargin">
            <number>3</number>
           </property>
           <property name="topMargin">
            <number>3</number>
           </property>
           <property name="rightMargin">
            <number>3</number>
           </property>
           <property name="bottomMargin">
            <number>3</number>
           </property>
           <item>
            <widget class="QPushButton" name="viewAll_button">
             <property name="text">
              <string>View All</string>
             </property>
            </widget>
           </item>
           <item>
            <widget class="QPushButton" name="done_button">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
             </property>
             <property name="text">
              <string>Done</string>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
        </item>
       </layout>
      </widget>
     </widget>
    </widget>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>AlignmentSceneviewerWidget</class>
   <extends>QWidget</extends>
   <header>opencmiss/zincwidgets/alignmentsceneviewerwidget.h</header>
   <container>1</container>
  </customwidget>
 </customwidgets>
 <resources>
  <include location="resources.qrc"/>
 </resources>
 <connections/>
</ui>

1 个答案:

答案 0 :(得分:1)

不是错误。如上面的ekhumoro所述,您无法调整布局中包含的窗口小部件的大小(无论如何不能与Designer一起使用)。您需要先中断布局,然后调整大小,然后重新应用布局。我知道有点痛苦,但过一会儿您就会习惯了。工具栏按钮可以使此操作更快,顺便说一句。

enter image description here