Skip to content
Snippets Groups Projects
Commit cd21181f authored by Kavindra Devi Palaraja's avatar Kavindra Devi Palaraja
Browse files

Doc - polishing more of part 2

parent 3cc33561
No related merge requests found
...@@ -160,6 +160,8 @@ ...@@ -160,6 +160,8 @@
Place your widgets accordingly and save the form by choosing Place your widgets accordingly and save the form by choosing
\gui{File | Save} or using the \key{Ctrl+S} shortcut. \gui{File | Save} or using the \key{Ctrl+S} shortcut.
A common
\section1 The AddressBook Class \section1 The AddressBook Class
...@@ -259,7 +261,27 @@ ...@@ -259,7 +261,27 @@
\section1 Placing Widgets on the Form \section1 Placing Widgets on the Form
Now that we have the labels and input fields set up, we add push buttons to Now that we have the labels and input fields set up, we add push buttons to
complete the process of adding a contact. complete the process of adding a contact. So, we begin by breaking the
existing layouts. Then, we add three push buttons. Double-click on each of
them to set their text to "Add", "Submit", and "Cancel". We now require a
vertical spacer to ensure that the push buttons will be laid out neatly;
drag one from the \gui{Widget Box}.
Next, lay out these three push buttons and the spacer vertically, by
selecting all three of them (using the \key{Ctrl + click}) and choosing
\gui{Lay out Vertically} from the context menu. Alternatively you can click
on the ... button or use the \key{Ctrl+L} shortcut. We use the spacer as we
do not want the buttons to be evenly spaced, but arranged closer to the top
of the widget. The figure below shows the difference between using the
spacer and not using it.
## image
Select all the objects on the form (use \key{Ctrl+A}) and lay them out in a
grid.
*/ */
...@@ -6,14 +6,22 @@ ...@@ -6,14 +6,22 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>356</width> <width>463</width>
<height>261</height> <height>245</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>AddressBook</string> <string>AddressBook</string>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>413</width>
<height>225</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="nameEdit"> <widget class="QLabel" name="nameEdit">
...@@ -38,6 +46,44 @@ ...@@ -38,6 +46,44 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QTextEdit" name="textEdit"/> <widget class="QTextEdit" name="textEdit"/>
</item> </item>
<item row="1" column="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="text">
<string>Submit</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment