Unsolved How make ui controls expandable?
-
My sample ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MyDialog</class> <widget class="QDialog" name="MyDialog"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>419</width> <height>299</height> </rect> </property> <property name="windowTitle"> <string>Dialog</string> </property> <widget class="QDialogButtonBox" name="buttonBox"> <property name="geometry"> <rect> <x>50</x> <y>260</y> <width>341</width> <height>32</height> </rect> </property> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="standardButtons"> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> </property> </widget> <widget class="QTreeView" name="treeView"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>201</width> <height>211</height> </rect> </property> </widget> <widget class="QListView" name="listView"> <property name="geometry"> <rect> <x>210</x> <y>0</y> <width>191</width> <height>211</height> </rect> </property> </widget> </widget> <resources/> <connections> <connection> <sender>buttonBox</sender> <signal>accepted()</signal> <receiver>MyDialog</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>MyDialog</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>
How :
- I want my controls change size depend on dialog size
- Tree and Listview should be possible change size by mouse
-
Hi,
Use layouts to position your widgets. They will also take care of resizing your widgets when you change your dialog size.
If you need some manual control, then QSplitter might be what you are looking for.
-
I try QHBoxLayout but not works.
QSplitter I can't find in Designer menu. -
@AndrzejB said in How make ui controls expandable?:
I try QHBoxLayout but not works.
What does not work? How do you use it?
To use a splitter select both widgets which you want to separate with the splitter and then select "Lay Out Horizontaly in Splitter" (or Vertically) in top tool bar.