[Qt-interest] Grouping existing widgets into a vertical splitter with Qt Designer

K. Frank kfrank29.c at gmail.com
Wed Jul 21 01:33:36 CEST 2010


Hello Jan -

On Tue, Jul 20, 2010 at 6:07 PM, Jan <janusius at gmx.net> wrote:
> sorry, I don't get you ...
>
> maybe just send me the ui file (if it is not secret), so I can get an
> idea what you mean.

No problem -- nothing secret (nor valuable, nor useful...).  The text
of the ui file appears at the bottom of this posting.

> What is the extra vspliter supposed to split: the top horizontalLayout
> and the rest or the grouped tables and the text edit?

The latter -- the grouped tables and the text edit.

In detail (this should agree with the ui file), from top to bottom:

There is the top horizontalLayout, the grouped tables in the middle,
and the textEdit at the bottom.

I would like the user at run time to be able to increase the vertical size
of the textEdit -- at the cost of shrinking the grouped tables -- while
keeping the size of the stuff in the top horizontalLayout unchanged.
My understanding is that a vertical splitter (containing the grouped
tables and the textEdit) is just the tool for this.

I'm pretty sure I can figure out how to do this if I build the form directly
in code (as suggested by Bill), but I would like to understand whether
it is possible (and practical) to do this with Qt Designer.

> Jan

Thanks for the follow-up.


K. Frank

>
> Am 20.07.2010 23:45, schrieb K. Frank:
>> Hi Jan -
>>
>> Thanks for the suggestion.
>>
>> On Tue, Jul 20, 2010 at 5:09 PM, Jan<janusius at gmx.net>  wrote:
>>> sorry for confusing you: it is ...
>>>
>>> table|hsplitter|table|hsplitter|table
>>> ...

Here is the ui file (hopefully not line-wrapped):

===========================
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>TestMain</class>
 <widget class="QMainWindow" name="TestMain">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>618</width>
    <height>678</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Test</string>
  </property>
  <widget class="QWidget" name="centralwidget">
   <layout class="QVBoxLayout" name="verticalLayout_5">
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QGroupBox" name="groupBox">
        <property name="title">
         <string>Test</string>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_7">
         <item>
          <widget class="QRadioButton" name="radioButton">
           <property name="text">
            <string>test</string>
           </property>
           <property name="checked">
            <bool>true</bool>
           </property>
          </widget>
         </item>
         <item>
          <widget class="QRadioButton" name="radioButton_2">
           <property name="text">
            <string>test</string>
           </property>
          </widget>
         </item>
        </layout>
       </widget>
      </item>
      <item>
       <spacer name="horizontalSpacer_2">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
        <property name="sizeType">
         <enum>QSizePolicy::Preferred</enum>
        </property>
        <property name="sizeHint" stdset="0">
         <size>
          <width>5</width>
          <height>20</height>
         </size>
        </property>
       </spacer>
      </item>
      <item>
       <widget class="QGroupBox" name="groupBox_2">
        <property name="title">
         <string>Test</string>
        </property>
        <layout class="QVBoxLayout" name="verticalLayout_8">
         <item>
          <layout class="QFormLayout" name="formLayout">
           <item row="0" column="0">
            <widget class="QLabel" name="label_5">
             <property name="text">
              <string>Test:</string>
             </property>
            </widget>
           </item>
           <item row="0" column="1">
            <widget class="QDoubleSpinBox" name="doubleSpinBox">
             <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
             <property name="buttonSymbols">
              <enum>QAbstractSpinBox::NoButtons</enum>
             </property>
             <property name="decimals">
              <number>2</number>
             </property>
             <property name="minimum">
              <double>-100.000000000000000</double>
             </property>
             <property name="singleStep">
              <double>0.010000000000000</double>
             </property>
             <property name="value">
              <double>1.000000000000000</double>
             </property>
            </widget>
           </item>
           <item row="1" column="0">
            <widget class="QLabel" name="label_6">
             <property name="text">
              <string>Test:</string>
             </property>
            </widget>
           </item>
           <item row="1" column="1">
            <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
             <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
             <property name="buttonSymbols">
              <enum>QAbstractSpinBox::NoButtons</enum>
             </property>
             <property name="decimals">
              <number>2</number>
             </property>
             <property name="minimum">
              <double>-100.000000000000000</double>
             </property>
             <property name="singleStep">
              <double>0.010000000000000</double>
             </property>
             <property name="value">
              <double>1.000000000000000</double>
             </property>
            </widget>
           </item>
           <item row="2" column="0">
            <widget class="QLabel" name="label_7">
             <property name="text">
              <string>Test:</string>
             </property>
            </widget>
           </item>
           <item row="2" column="1">
            <widget class="QDoubleSpinBox" name="doubleSpinBox_3">
             <property name="alignment">
              <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
             </property>
             <property name="buttonSymbols">
              <enum>QAbstractSpinBox::NoButtons</enum>
             </property>
             <property name="decimals">
              <number>4</number>
             </property>
             <property name="maximum">
              <double>100.000000000000000</double>
             </property>
             <property name="singleStep">
              <double>0.000100000000000</double>
             </property>
             <property name="value">
              <double>0.000100000000000</double>
             </property>
            </widget>
           </item>
          </layout>
         </item>
        </layout>
       </widget>
      </item>
      <item>
       <spacer name="horizontalSpacer">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
        </property>
        <property name="sizeHint" stdset="0">
         <size>
          <width>40</width>
          <height>20</height>
         </size>
        </property>
       </spacer>
      </item>
     </layout>
    </item>
    <item>
     <widget class="QSplitter" name="splitter">
      <property name="sizePolicy">
       <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
      <widget class="QWidget" name="layoutWidget">
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <widget class="QLabel" name="label_4">
          <property name="text">
           <string> Test</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="TestClass" name="testClass" native="true"/>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="layoutWidget">
       <layout class="QVBoxLayout" name="verticalLayout_4">
        <item>
         <widget class="QLabel" name="label_3">
          <property name="text">
           <string> Test</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QTableWidget" name="testTableWidget_1">
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
         </widget>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="layoutWidget">
       <layout class="QVBoxLayout" name="verticalLayout_2">
        <item>
         <widget class="QLabel" name="label_2">
          <property name="text">
           <string> Test</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QTableWidget" name="testTableWidget_2">
          <attribute name="verticalHeaderVisible">
           <bool>false</bool>
          </attribute>
          <attribute name="verticalHeaderVisible">
           <bool>false</bool>
          </attribute>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
         </widget>
        </item>
       </layout>
      </widget>
      <widget class="QWidget" name="layoutWidget">
       <layout class="QVBoxLayout" name="verticalLayout_3">
        <item>
         <widget class="QLabel" name="label">
          <property name="text">
           <string> Test</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QTreeWidget" name="testTreeWidget">
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
          <column>
           <property name="text">
            <string>Test</string>
           </property>
          </column>
         </widget>
        </item>
       </layout>
      </widget>
     </widget>
    </item>
    <item>
     <widget class="QTextEdit" name="textEdit"/>
    </item>
   </layout>
  </widget>
  <widget class="QMenuBar" name="menubar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>618</width>
     <height>21</height>
    </rect>
   </property>
   <widget class="QMenu" name="menuFile">
    <property name="title">
     <string>File</string>
    </property>
    <addaction name="actionTest1"/>
    <addaction name="separator"/>
    <addaction name="actionTest2"/>
    <addaction name="separator"/>
    <addaction name="actionExit"/>
   </widget>
   <addaction name="menuFile"/>
  </widget>
  <widget class="QStatusBar" name="statusbar"/>
  <action name="actionTest1">
   <property name="text">
    <string>Test...</string>
   </property>
  </action>
  <action name="actionExit">
   <property name="text">
    <string>Exit</string>
   </property>
  </action>
  <action name="actionTest2">
   <property name="text">
    <string>Test...</string>
   </property>
  </action>
 </widget>
 <customwidgets>
  <customwidget>
   <class>TestClass</class>
   <extends>QWidget</extends>
   <header>test_class.h</header>
   <container>1</container>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>
===========================



More information about the Qt-interest-old mailing list