[Qt-interest] How Do I get QTabWidget in resizable dialog to stretch with dialog?

kent williams nkwmailinglists at gmail.com
Thu Jan 13 23:32:45 CET 2011


I'm having a heck of a time getting a complicated dialog to look nice.

The organization is

QDialog                     -- the dialog
  QTabWidget            -- tabwidget to contain one or more forms
     QVerticalForm      -- each form a vertical list of name/value pairs
        QFormLayout

The problem is that when I resize the dialog the QTabWidget doesn't
resize with the dialog.  How do I get it to resize with the dialog?

The forms are created at runtime and added to the QTabWidget, and
Dialog itself was built with Designer.

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Processing</class>
 <widget class="QDialog" name="Processing">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>440</width>
    <height>639</height>
   </rect>
  </property>
  <property name="contextMenuPolicy">
   <enum>Qt::NoContextMenu</enum>
  </property>
  <property name="windowTitle">
   <string>Dialog</string>
  </property>
  <widget class="QDialogButtonBox" name="buttonBox">
   <property name="geometry">
    <rect>
     <x>80</x>
     <y>600</y>
     <width>341</width>
     <height>32</height>
    </rect>
   </property>
   <property name="orientation">
    <enum>Qt::Horizontal</enum>
   </property>
   <property name="standardButtons">
    <set>QDialogButtonBox::Close</set>
   </property>
  </widget>
  <widget class="QScrollArea" name="scrollArea">
   <property name="geometry">
    <rect>
     <x>10</x>
     <y>10</y>
     <width>421</width>
     <height>581</height>
    </rect>
   </property>
   <property name="widgetResizable">
    <bool>true</bool>
   </property>
   <widget class="QWidget" name="scrollAreaWidgetContents">
    <property name="geometry">
     <rect>
      <x>0</x>
      <y>0</y>
      <width>419</width>
      <height>579</height>
     </rect>
    </property>
    <widget class="QTabWidget" name="tabWidget">
     <property name="geometry">
      <rect>
       <x>0</x>
       <y>0</y>
       <width>421</width>
       <height>581</height>
      </rect>
     </property>
     <property name="sizePolicy">
      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
       <horstretch>1</horstretch>
       <verstretch>1</verstretch>
      </sizepolicy>
     </property>
    </widget>
   </widget>
  </widget>
 </widget>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>Processing</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>248</x>
     <y>254</y>
    </hint>
    <hint type="destinationlabel">
     <x>157</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>Processing</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>316</x>
     <y>260</y>
    </hint>
    <hint type="destinationlabel">
     <x>286</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>



More information about the Qt-interest-old mailing list