C++ segmentation Module building fails with Qt5 - compatibility with Qt4/Qt5 of ui files?

Hi all,

I have developed a C++ segmentation module in Slicer in a previous environment (Slicer 4.9 on Mac Os El Capitan 10.11, using Qt4), and I am now trying to build it in a new Slicer environment (Slicer 4.9 on Mac OS Sierra 10.12, using Qt5.10). I encountered difficulties in building this new Slicer with Qt4 so I used Qt5 as it was recommended as the most maintained/tested now and it worked, but the building of my segmentation modules failed in the ui files, and more especially in the qSlicerModuleNameFooBarWidget.ui (copied below), indicating an RCC Parse Error Line: 2 Column: 18 [unexpected tag: ui], and I can’t find any help on such error.
Did someone ever have this error ? The ui file is very basic and I have read that there was a compatibility from Qt4 to Qt5 for the ui files ?

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <widget class="QWidget" name="qSlicerSeedSegmentation3FooBarWidget">
  <property name="geometry">
  <property name="windowTitle">
   <string>Foo bar</string>
  <layout class="QVBoxLayout" name="verticalLayout">
   <property name="margin">
    <widget class="QPushButton" name="FooBarButton">
     <property name="text">
      <string>Foo Bar</string>

Thanks for your help!

There is no such file in the Slicer source code. If the file is in your own module, then I would recommend to create a new module skeleton using Slicer’s Extension Wizard module and compare the differences to your own module. Or, you can have a look at changes to the extension template since you generated your module and apply the same changes to your module manually.