MyImageComboBoxTest.xsl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!--
  2. ============================================================================
  3. For an input image, we use MyComboBox and no Browse button.
  4. But for output image, we use standard ctkPathLineEdit and a Browse button.
  5. ============================================================================
  6. -->
  7. <xsl:template match="parameters/*[name()=('image')]" priority="2">
  8. <xsl:call-template name="gridItemWithLabel"/>
  9. <item row="{position()-1}" column="1">
  10. <layout class="QHBoxLayout">
  11. <xsl:choose>
  12. <xsl:when test="channel = 'input'">
  13. <item>
  14. <widget class="{$imageInputWidget}" name="parameter:{name}">
  15. <xsl:call-template name="commonWidgetProperties"/>
  16. <xsl:call-template name="createQtDesignerStringListProperty"/>
  17. <property name="parameter:valueProperty"> <!-- property name containing current value -->
  18. <string>currentValue</string>
  19. </property>
  20. </widget>
  21. </item>
  22. </xsl:when>
  23. <xsl:otherwise>
  24. <item>
  25. <widget class="{$imageOutputWidget}" name="parameter:{name}">
  26. <xsl:call-template name="commonWidgetProperties"/>
  27. <xsl:call-template name="createQtDesignerStringListProperty"/>
  28. <property name="filters">
  29. <set>ctkPathLineEdit::Files</set>
  30. </property>
  31. </widget>
  32. </item>
  33. <item>
  34. <widget class="QPushButton" name="{name}BrowseButton">
  35. <property name="text">
  36. <string>Browse...</string>
  37. </property>
  38. </widget>
  39. </item>
  40. </xsl:otherwise>
  41. </xsl:choose>
  42. </layout>
  43. </item>
  44. </xsl:template>
  45. <!--
  46. ============================================================================
  47. For an input image, we use MyComboBox and no Browse button.
  48. But for output image, we use standard ctkPathLineEdit and a Browse button.
  49. ============================================================================
  50. -->
  51. <xsl:template match="parameters/*[name()=('image')]" mode="connections" priority="2">
  52. <xsl:if test="channel = 'output'">
  53. <connection>
  54. <sender><xsl:value-of select="name"/>BrowseButton</sender>
  55. <signal>clicked()</signal>
  56. <receiver>parameter:<xsl:value-of select="name"/></receiver>
  57. <slot>browse()</slot>
  58. </connection>
  59. </xsl:if>
  60. </xsl:template>