Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How make ui controls expandable?
QtWS25 Last Chance

How make ui controls expandable?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
design studio
4 Posts 3 Posters 410 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AndrzejB
    wrote on 4 Apr 2022, 20:12 last edited by
    #1

    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 :

    1. I want my controls change size depend on dialog size
    2. Tree and Listview should be possible change size by mouse
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 4 Apr 2022, 20:18 last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AndrzejB
        wrote on 4 Apr 2022, 21:55 last edited by
        #3

        I try QHBoxLayout but not works.
        QSplitter I can't find in Designer menu.

        J 1 Reply Last reply 5 Apr 2022, 05:25
        0
        • A AndrzejB
          4 Apr 2022, 21:55

          I try QHBoxLayout but not works.
          QSplitter I can't find in Designer menu.

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 5 Apr 2022, 05:25 last edited by
          #4

          @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.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2

          1/4

          4 Apr 2022, 20:12

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved