[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] Learning Qt5 designer
From:       Hans-Peter Jansen <hpj () urpla ! net>
Date:       2016-12-31 0:14:24
Message-ID: 1619567.MjoTMzsgBA () xrated
[Download RAW message or body]

On Freitag, 30. Dezember 2016 15:35:24 Rich Shepard wrote:
> On Sat, 31 Dec 2016, Hans-Peter Jansen wrote:
> > You can undo your changes, as long as designer is still running.
> 
> Pete,
> 
>    Yes, I saw that under the Edit menu.
> 
> > Have you tried the other layout variant grid and form?
> 
>    Not yet. I'm very familiar with wxPython and trying to translate that
> knowledge to Qt5.

Well, my wx experience is a bit rusty, I turned to PyQt 15 years ago.

> I've read that I should work from the back (frame, tabbed
> window) forward, but that didn't work for me so I am trying to create the
> main data entry (add/modify/delete) dialogs written and configured then
> learn how to place them on tabs.

It's not that hard. First, your edits should be QLineEdits by default, and 
attached is *one* way to layout it using a form layout. You could use a grid 
as well. Take an afternoon and play a bit with designer. It's fun.

Cheers,
Pete
["companydlg.ui" (companydlg.ui)]

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>553</width>
    <height>281</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Company</string>
  </property>
  <property name="whatsThis">
   <string>Company</string>
  </property>
  <layout class="QGridLayout" name="gridLayout">
   <item row="0" column="0">
    <layout class="QFormLayout" name="formLayout">
     <item row="0" column="0">
      <widget class="QLabel" name="label_10">
       <property name="text">
        <string>Industry</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit_10</cstring>
       </property>
      </widget>
     </item>
     <item row="0" column="1">
      <layout class="QHBoxLayout" name="horizontalLayout">
       <item>
        <widget class="QLineEdit" name="plainTextEdit_10"/>
       </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>
       <item>
        <widget class="QLabel" name="label_11">
         <property name="text">
          <string>Status</string>
         </property>
         <property name="buddy">
          <cstring>plainTextEdit_11</cstring>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLineEdit" name="plainTextEdit_11"/>
       </item>
      </layout>
     </item>
     <item row="1" column="0">
      <widget class="QLabel" name="label">
       <property name="text">
        <string>Name</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit</cstring>
       </property>
      </widget>
     </item>
     <item row="1" column="1">
      <widget class="QLineEdit" name="plainTextEdit"/>
     </item>
     <item row="2" column="0">
      <widget class="QLabel" name="label_2">
       <property name="text">
        <string>Address 1</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit_2</cstring>
       </property>
      </widget>
     </item>
     <item row="2" column="1">
      <widget class="QLineEdit" name="plainTextEdit_2"/>
     </item>
     <item row="3" column="0">
      <widget class="QLabel" name="label_3">
       <property name="text">
        <string>Address 2</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit_3</cstring>
       </property>
      </widget>
     </item>
     <item row="3" column="1">
      <widget class="QLineEdit" name="plainTextEdit_3"/>
     </item>
     <item row="4" column="0">
      <widget class="QLabel" name="label_4">
       <property name="text">
        <string>City</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit_4</cstring>
       </property>
      </widget>
     </item>
     <item row="4" column="1">
      <layout class="QHBoxLayout" name="horizontalLayout_2">
       <item>
        <widget class="QLineEdit" name="plainTextEdit_4"/>
       </item>
       <item>
        <spacer name="horizontalSpacer_4">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>13</width>
           <height>36</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QLabel" name="label_5">
         <property name="text">
          <string>State</string>
         </property>
         <property name="buddy">
          <cstring>plainTextEdit_5</cstring>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLineEdit" name="plainTextEdit_5"/>
       </item>
       <item>
        <widget class="QLabel" name="label_6">
         <property name="text">
          <string>Post Code</string>
         </property>
         <property name="buddy">
          <cstring>plainTextEdit_6</cstring>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLineEdit" name="plainTextEdit_6"/>
       </item>
       <item>
        <widget class="QLabel" name="label_7">
         <property name="text">
          <string>Country</string>
         </property>
         <property name="buddy">
          <cstring>plainTextEdit_7</cstring>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLineEdit" name="plainTextEdit_7"/>
       </item>
      </layout>
     </item>
     <item row="5" column="0">
      <widget class="QLabel" name="label_8">
       <property name="text">
        <string>Phone</string>
       </property>
       <property name="buddy">
        <cstring>plainTextEdit_8</cstring>
       </property>
      </widget>
     </item>
     <item row="5" column="1">
      <layout class="QHBoxLayout" name="horizontalLayout_3">
       <item>
        <widget class="QLineEdit" name="plainTextEdit_8"/>
       </item>
       <item>
        <spacer name="horizontalSpacer_2">
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
         </property>
         <property name="sizeHint" stdset="0">
          <size>
           <width>40</width>
           <height>20</height>
          </size>
         </property>
        </spacer>
       </item>
       <item>
        <widget class="QLabel" name="label_9">
         <property name="text">
          <string>URL</string>
         </property>
         <property name="buddy">
          <cstring>plainTextEdit_9</cstring>
         </property>
        </widget>
       </item>
       <item>
        <widget class="QLineEdit" name="plainTextEdit_9"/>
       </item>
      </layout>
     </item>
    </layout>
   </item>
   <item row="1" column="0">
    <widget class="QDialogButtonBox" name="buttonBox">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
     <property name="standardButtons">
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>Dialog</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>Dialog</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>

[Attachment #4 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic