CS Designer - Dialog with button box

Report any problems with CopperSpice
Post Reply
crispina
Posts: 22
Joined: Tue Nov 17 2020 2:57 pm

CS Designer - Dialog with button box

Post by crispina »

I think there could be an issue with the way CS Designer creates XML for a dialog with button box. This is the generated XML for the dialog ui.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="windowTitle" stdset="0">
   <string>Dialog</string>
  </property>
  <property name="geometry" stdset="0">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <widget class="QDialogButtonBox" name="buttonBox">
   <property name="standardButtons" stdset="0">
    <set>QDialogButtonBox::Cancel|QDialogButtonBox::FirstButton|QDialogButtonBox::Ok</set>
   </property>
   <property name="orientation" stdset="0">
    <enum>Qt::Horizontal</enum>
   </property>
   <property name="geometry" stdset="0">
    <rect>
     <x>30</x>
     <y>240</y>
     <width>341</width>
     <height>32</height>
    </rect>
   </property>
  </widget>
 </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>
When you use this in a simple dialog example (see github link below) I get the error

error: invalid use of incomplete type ‘class Ui::DialogTest’
However if you change the dialog XML to that below the code compiles with no errors.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>DialogTest</class>
 <widget class="QDialog" name="DialogTest">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>DialogTest</string>
  </property>
  <widget class="QDialogButtonBox" name="buttonBox">
   <property name="geometry">
    <rect>
     <x>30</x>
     <y>240</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>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>DialogTest</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>DialogTest</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>
I don't fully understand what is causing the issue but in the working XML the geometry property is immediately after

Code: Select all

  
  <widget class="QDialogButtonBox" name="buttonBox">


and I have no idea what the purpose of stdset="0" is.

I have put a working code example on my github page below in case this needs further investigation.

https://github.com/crispinalan/copperspice-dialog-example
barbara
Posts: 472
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: CS Designer - Dialog with button box

Post by barbara »

Thanks for submitting this example. We have tracked down an issue related to how the StandardButton enum was being used. These changes will be available on github with in the next few days. You will need to rebuild both CopperSpice and Designer.

Please retest after you have the new commits and let us know the status.

Barbara
barbara
Posts: 472
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: CS Designer - Dialog with button box

Post by barbara »

All reported issues related to the dialog button box have been corrected in Designer.

* * CS Designer 1.0.2 was released on January 31 2023

Pre-built binary files can be found on our download site
https://download.copperspice.com/designer/binary/

Source code and pre-built binary files can be also be found on github
https://github.com/copperspice/cs_designer
Post Reply