Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, May 2008
Some help with designing forms, please!

Pages: Prev | 1 | 2 | Next

Message 16 in thread

Hi David,

Ok... fired up the laptop with 4.3.4 on it.  Try this one!

Regarding form design - I've come from a Delphi background, and getting 
my head around layouts has been interesting AND frustrating - and I'm 
certainly not there yet.  There are some frustrations with the Designer 
and implementing layouts - particularly with more complex forms.  I 
often find that when there are nested layouts, I have to break lots of 
the parent layouts before I can insert something into an existing grid 
layout.

PL

David Stranz wrote:
> "Scott Aron Bloom" <Scott.Bloom@xxxxxxxxxxxx> wrote in
> news:7DB34253D57D2B47AEB656218FE6AAEF082377@xxxxxxxxxxxxxxxxxxxxxx:
>
>   
>> Ok... So I have found the isse...
>> Wehen you put a horizontal layout on the overall widget, your
>> forgetting to put a horizontal layout on each of the group
>> boxes... 
>>
>> So each group box minimizes to essentially 0.
>> Here is an attached 4.3.4 
>>
>> Scott
>>     
>
> Well... except for the <iconset> elements losing the icons, there's 
> no difference between your UI file and mine...  Perhaps you attached 
> the wrong one?
>
> I've looked pretty hard for some tutorial on how to implement forms, 
> and aside from the Qt Designer manual in Qt Assistant, I haven't 
> found anything.  I seem to run into this problem of being unable to 
> put widgets into layouts every time I design a form.
>
> Back to banging my head on the wall.
>
> David
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
>
>   

-- 
 [ signature omitted ] 
<ui version="4.0" >
 <class>CDatasetClassDBESelectPageClass</class>
 <widget class="QWizardPage" name="CDatasetClassDBESelectPageClass" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>423</width>
    <height>164</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>CDatasetClassDBESelectPage</string>
  </property>
  <layout class="QHBoxLayout" >
   <item>
    <widget class="QGroupBox" name="groupBox" >
     <property name="sizePolicy" >
      <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
       <horstretch>0</horstretch>
       <verstretch>0</verstretch>
      </sizepolicy>
     </property>
     <property name="title" >
      <string>GroupBox</string>
     </property>
     <layout class="QHBoxLayout" >
      <item>
       <widget class="QListWidget" name="mpDSListCtrl" >
        <property name="sizePolicy" >
         <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
       </widget>
      </item>
      <item>
       <layout class="QVBoxLayout" >
        <item>
         <widget class="QPushButton" name="mpDSMoveTopBtn" >
          <property name="toolTip" >
           <string>Move to top</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDSMoveUpBtn" >
          <property name="toolTip" >
           <string>Move up</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDSMoveDownBtn" >
          <property name="toolTip" >
           <string>Move down</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDSMoveBottomBtn" >
          <property name="toolTip" >
           <string>Move to bottom</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <widget class="QGroupBox" name="groupBox_2" >
     <property name="sizePolicy" >
      <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
       <horstretch>0</horstretch>
       <verstretch>0</verstretch>
      </sizepolicy>
     </property>
     <property name="title" >
      <string>GroupBox</string>
     </property>
     <layout class="QHBoxLayout" >
      <item>
       <widget class="QListWidget" name="mpClassListCtrl" >
        <property name="sizePolicy" >
         <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
       </widget>
      </item>
      <item>
       <layout class="QVBoxLayout" >
        <item>
         <widget class="QPushButton" name="mpClassMoveTopBtn" >
          <property name="toolTip" >
           <string>Move to top</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpClassMoveUpBtn" >
          <property name="toolTip" >
           <string>Move up</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpClassMoveDownBtn" >
          <property name="toolTip" >
           <string>Move down</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpClassMoveBottomBtn" >
          <property name="toolTip" >
           <string>Move to bottom</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <widget class="QGroupBox" name="groupBox_3" >
     <property name="sizePolicy" >
      <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
       <horstretch>0</horstretch>
       <verstretch>0</verstretch>
      </sizepolicy>
     </property>
     <property name="title" >
      <string>GroupBox</string>
     </property>
     <layout class="QHBoxLayout" >
      <item>
       <widget class="QListWidget" name="mpDBEListCtrl" >
        <property name="sizePolicy" >
         <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
          <horstretch>0</horstretch>
          <verstretch>0</verstretch>
         </sizepolicy>
        </property>
       </widget>
      </item>
      <item>
       <layout class="QVBoxLayout" >
        <item>
         <widget class="QPushButton" name="mpDBEMoveTopBtn" >
          <property name="toolTip" >
           <string>Move to top</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDBEMoveUpBtn" >
          <property name="toolTip" >
           <string>Move up</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDBEMoveDownBtn" >
          <property name="toolTip" >
           <string>Move down</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QPushButton" name="mpDBEMoveBottomBtn" >
          <property name="toolTip" >
           <string>Move to bottom</string>
          </property>
          <property name="icon" >
           <iconset/>
          </property>
         </widget>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>QWizardPage</class>
   <extends>QWidget</extends>
   <header>qwizardpage.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>

Message 17 in thread

Peter Lee <ptle@xxxxxxxxxxxxxxxxxx> wrote in
news:4834E701.7010204@xxxxxxxxxxxxxxxxxx: 

> Hi David,
> 
> Ok... fired up the laptop with 4.3.4 on it.  Try this one!
> 
> Regarding form design - I've come from a Delphi background, and
> getting my head around layouts has been interesting AND
> frustrating - and I'm certainly not there yet.  There are some
> frustrations with the Designer and implementing layouts -
> particularly with more complex forms.  I often find that when
> there are nested layouts, I have to break lots of the parent
> layouts before I can insert something into an existing grid 
> layout. 
> 
> PL
> 

<snip>

Thanks, Peter, that's almost there.  I think I need to add a 
vertical stretch under the row of group boxes to keep them from 
growing vertically - it looks weird in the wizard, since the 
preceeding page is taller than this one and the wizard will keep 
growing pages as it goes.  In this case, the group boxes grow to 
about 2 1/2 times higher.

So, a vertical layout around the horizontal layout, and a vertical 
stretch between the group box h-layout and the bottom.

I think I'm going to try starting this from scratch and building it 
up as Andre suggested in his response.

I come from long MFC experience, and form layout there is simpler, 
but much less powerful.  Alignment of form elements is manual, but 
the editor gives you convenient graphical ways to do it - tools to 
"make same height", "make same width", "align left sides", etc.  
Elements don't move at run time without underlying code to do it.

Qt is a different model which I like better.  I remember long ago 
John Vlissides (of Gang of Four fame) worked on a GUI system called 
"Interviews" which had some of these same ideas - layouts and 
"glue" (H and V stretch) to hold things together.

If you -want- the form to grow as the user resizes it, the default 
Qt behaviour is great.  It's when you decide that, no, these bits 
need to stay where they are that the trouble starts.

Thanks for all the help.

David

--
 [ signature omitted ]