Saturday 15 June 2013

python 2.7 - How to make Qt widgets resizeable? -



python 2.7 - How to make Qt widgets resizeable? -

i want create application consists of qlineedit , 2 qtableview widgets in vertical layout.

sample code:

<?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>400</width> <height>300</height> </rect> </property> <property name="windowtitle"> <string>dialog</string> </property> <widget class="qwidget" name="verticallayoutwidget"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>401</width> <height>301</height> </rect> </property> <layout class="qvboxlayout" name="verticallayout"> <item> <widget class="qlineedit" name="lineedit"/> </item> <item> <widget class="qtableview" name="tableview_2"/> </item> <item> <widget class="qtableview" name="tableview"/> </item> </layout> </widget> </widget> <resources/> <connections> <connection> <sender>lineedit</sender> <signal>returnpressed()</signal> <receiver>dialog</receiver> <slot>close()</slot> <hints> <hint type="sourcelabel"> <x>200</x> <y>14</y> </hint> <hint type="destinationlabel"> <x>199</x> <y>149</y> </hint> </hints> </connection> </connections> </ui>

but these qtableview widgets not resizable. didn't found property in qt this.

so how can create these qtableview widgets resizable or auto expand , contract?

means if cut down size of first qtableview widget automatically size of sec qtableview widget should increment means every widget should expand or contract automatically if alter size of widget within vertical layout @ run time.

the sample code designed in qt4 designer on ubuntu 14.04.

break current layout, select 2 widgets, click layout vertically in splitter , select form , click layout vertically.

qt python-2.7 widget qtableview

No comments:

Post a Comment