Bug 416534

Summary: Some ui files are not compilable after editing with designer
Product: [Applications] kmymoney Reporter: Ralf Habacker <ralf.habacker>
Component: generalAssignee: KMyMoney Devel Mailing List <kmymoney-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 5.0.8   
Target Milestone: ---   
Platform: Other   
OS: All   
Latest Commit: Version Fixed In: 4.8.5,5.1.0
Sentry Crash Report:

Description Ralf Habacker 2020-01-21 14:21:26 UTC
STEPS TO REPRODUCE
1. download https://cgit.kde.org/kmymoney.git/plain/kmymoney/wizards/newloanwizard/knewloanwizard.ui?h=5.0
2. open file with designer-qt5

OBSERVED RESULT
designer shows the following warning 28 times

 ** WARNING Attempt to add oject that is not of class WizardPage to a QWizard

Compiling kmymoney with this saved file fails because the designer has removed several widgets from the ui file. 

EXPECTED RESULT
The file should not be corrupted on saving

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Leap 15.1
KDE Frameworks Version: 5.49
Qt Version: 5.9.7

ADDITIONAL INFORMATION
The ui file contains several lines similar to 

<widget class="NewIntroWizardPage" name="m_newIntroPage">

which requires related entries below the <customwidgets> tag e.g. 

  <customwidgets>
   ...
   <customwidget>
    <class>NewIntroWizardPage</class>
    <extends>QWizardPage</extends>
    <header>newintrowizardpage.h</header>
   </customwidget>

For the removed widgets this entry is missing
Comment 1 Jack 2020-01-21 15:00:09 UTC
I read the subject as that you can't edit multiple files (at the same time.)  Should it be "some files"?  Also, is this a bug in Designer or in the KMM ui files?
Comment 2 Ralf Habacker 2020-01-21 15:51:28 UTC
(In reply to Jack from comment #1)
> I read the subject as that you can't edit multiple files (at the same time.)
> Should it be "some files"?  
yes, used a more descriptive subject
> Also, is this a bug in Designer or in the KMM ui files?
Normally, adding custom widgets to a ui file requires the specification of a base class and a header file for insertion, which are missing in the mentioned file for reasons unknown to me.

When loading, the designer removes these incomplete widgets.
Comment 3 Ralf Habacker 2020-01-21 15:59:43 UTC
(In reply to Jack from comment #1)
> Also, is this a bug in Designer or in the KMM ui files?
As the designer could not know which include file to use, I would say the issue is in the kmm ui files.
Comment 4 Ralf Habacker 2020-01-21 16:06:06 UTC
(In reply to Jack from comment #1)
> Also, is this a bug in Designer or in the KMM ui files?

There are other issues when updating ui files with designer that are clearly caused by the designer, such as replacing a "margins" tag with 4 individual tags e.g.

     <number>6</number>
    </property>
-   <property name="margin">
+   <property name="leftMargin">
+    <number>11</number>
+   </property>
+   <property name="topMargin">
+    <number>11</number>
+   </property>
+   <property name="rightMargin">
+    <number>11</number>
+   </property>
+   <property name="bottomMargin">
     <number>11</number>
    </property>

which blow up files without adding any additional information.
Comment 5 Thomas Baumgart 2020-01-21 16:18:07 UTC
Yes, but they don't hurt.  It's a long standing issue (dating back a few years but nobody noticed until now) and I will take care of it.
Comment 6 Thomas Baumgart 2020-01-21 19:53:31 UTC
Git commit fbfba1f6652fc96864399023b83bdb4aabfa8ac6 by Thomas Baumgart.
Committed on 21/01/2020 at 19:53.
Pushed by tbaumgart into branch '5.0'.

Fix missing ui file customwidget definitions
FIXED-IN: 5.0.9

M  +20   -0    kmymoney/wizards/endingbalancedlg/kendingbalancedlg.ui
M  +140  -0    kmymoney/wizards/newloanwizard/knewloanwizard.ui

https://commits.kde.org/kmymoney/fbfba1f6652fc96864399023b83bdb4aabfa8ac6
Comment 7 Thomas Baumgart 2020-01-21 20:03:04 UTC
Git commit e40d7528c315a7c2116ba07a2a23018d7b4164ea by Thomas Baumgart.
Committed on 21/01/2020 at 19:54.
Pushed by tbaumgart into branch 'master'.

Fix missing ui file customwidget definitions
FIXED-IN: 5.0.9
(cherry picked from commit fbfba1f6652fc96864399023b83bdb4aabfa8ac6)

M  +20   -0    kmymoney/wizards/endingbalancedlg/kendingbalancedlg.ui
M  +140  -0    kmymoney/wizards/newloanwizard/knewloanwizard.ui

https://commits.kde.org/kmymoney/e40d7528c315a7c2116ba07a2a23018d7b4164ea
Comment 8 Ralf Habacker 2020-01-22 09:39:34 UTC
Git commit ce23283713d6286d2a6b4cf91a5c03f44223fbc8 by Ralf Habacker.
Committed on 22/01/2020 at 09:31.
Pushed by habacker into branch '4.8'.

Fix missing ui file customwidget definitions
FIXED-IN: 4.8.5,5.0.9
(cherry picked from commit fbfba1f6652fc96864399023b83bdb4aabfa8ac6)

M  +24   -0    kmymoney/wizards/endingbalancedlg/kendingbalancedlgdecl.ui
M  +168  -0    kmymoney/wizards/newloanwizard/knewloanwizarddecl.ui

https://commits.kde.org/kmymoney/ce23283713d6286d2a6b4cf91a5c03f44223fbc8
Comment 9 Thomas Baumgart 2020-01-25 06:16:59 UTC
*** Bug 416564 has been marked as a duplicate of this bug. ***