Difference between revisions of "Slicer4:Layouts"
From Slicer Wiki
(2 intermediate revisions by the same user not shown) | |||
Line 4: | Line 4: | ||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | ||
+ | <!-- Layouts --> | ||
<xs:element name="layout"> | <xs:element name="layout"> | ||
<xs:complexType> | <xs:complexType> | ||
+ | <xs:annotation> | ||
+ | <xs:documentation xml:lang="en"> | ||
+ | A Layout must contain at least 1 item. | ||
+ | If split is true and the layout type is horizontal or vertical, | ||
+ | then a QSplitter is added between each subelement item. | ||
+ | </xsd:documentation> | ||
+ | </xs:annotation> | ||
<xs:sequence> | <xs:sequence> | ||
<xs:element minOccurs="1" maxOccurs="unbounded" ref="item"/> | <xs:element minOccurs="1" maxOccurs="unbounded" ref="item"/> | ||
</xs:sequence> | </xs:sequence> | ||
<xs:attribute name="split" type="xs:boolean"/> | <xs:attribute name="split" type="xs:boolean"/> | ||
− | <xs:attribute name="type" use="required" type="xs: | + | <xs:attribute name="type" use="required" type="xs:layoutType"/> |
</xs:complexType> | </xs:complexType> | ||
</xs:element> | </xs:element> | ||
+ | <xs:simpleType name="layoutType"> | ||
+ | <xs:restriction base="xs:NMTOKEN"> | ||
+ | <xs:enumeration value="horizontal" /> | ||
+ | <xs:enumeration value="vertical" /> | ||
+ | <xs:enumeration value="grid" /> | ||
+ | <xs:enumeration value="tab" /> | ||
+ | </xs:restriction> | ||
+ | </xs:simpleType> | ||
+ | <!-- Items --> | ||
<xs:element name="item"> | <xs:element name="item"> | ||
<xs:complexType> | <xs:complexType> | ||
− | <xs: | + | <xs:choice> |
− | <xs:element | + | <xs:element ref="layout"/> |
− | + | <xs:element ref="view"/> | |
− | < | + | </xs:choice> |
+ | <xs:attribute name="column" type="xs:nonNegativeInteger" /> | ||
+ | <xs:attribute name="colspan" type="xs:integer" /> | ||
<xs:attribute name="multiple" type="xs:boolean"/> | <xs:attribute name="multiple" type="xs:boolean"/> | ||
<xs:attribute name="name"/> | <xs:attribute name="name"/> | ||
+ | <xs:attribute name="row" type="xs:nonNegativeInteger" /> | ||
+ | <xs:attribute name="rowspan" type="integer" /> | ||
</xs:complexType> | </xs:complexType> | ||
</xs:element> | </xs:element> | ||
+ | <!-- Views --> | ||
<xs:element name="view"> | <xs:element name="view"> | ||
<xs:complexType> | <xs:complexType> |
Latest revision as of 14:36, 5 April 2011
Home < Slicer4:LayoutsXML specification for a layout
- XSD schema for layouts
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="layout">
<xs:complexType>
<xs:annotation>
<xs:documentation xml:lang="en">
A Layout must contain at least 1 item.
If split is true and the layout type is horizontal or vertical,
then a QSplitter is added between each subelement item.
</xsd:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="1" maxOccurs="unbounded" ref="item"/>
</xs:sequence>
<xs:attribute name="split" type="xs:boolean"/>
<xs:attribute name="type" use="required" type="xs:layoutType"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="layoutType">
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="horizontal" />
<xs:enumeration value="vertical" />
<xs:enumeration value="grid" />
<xs:enumeration value="tab" />
</xs:restriction>
</xs:simpleType>
<xs:element name="item">
<xs:complexType>
<xs:choice>
<xs:element ref="layout"/>
<xs:element ref="view"/>
</xs:choice>
<xs:attribute name="column" type="xs:nonNegativeInteger" />
<xs:attribute name="colspan" type="xs:integer" />
<xs:attribute name="multiple" type="xs:boolean"/>
<xs:attribute name="name"/>
<xs:attribute name="row" type="xs:nonNegativeInteger" />
<xs:attribute name="rowspan" type="integer" />
</xs:complexType>
</xs:element>
<xs:element name="view">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" ref="property"/>
</xs:sequence>
<xs:attribute name="class" use="required" type="xs:string"/>
<xs:attribute name="singletontag" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="property">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" use="required" type="xs:string"/>
<xs:attribute name="action" type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
Adding a new layout to Slicer4
- Libs/MRML/vtkMRMLLayoutNode.h
- Add an enum to the list of available layouts
- Libs/MRMLLogic/vtkMRMLLayoutLogic.cxx
- Add a string constant containing the XML describing the layout
- Add a line to the AddDefaultsLayouts() method
- Libs/qMRMLWidgets/Resources/Icons/
- Add an icon
- Applications/SlicerQT/Resources/qSlicerMainWindow.ui
- Add an action using the Action Editor View
- Drag&Drop created action into the LayoutMenu (View->Layout)
- Drag&Drop created action into the LayoutToolbar
- Applications/SlicerQt/qSlicerMainWindow.cxx
- Add a line to setupMenuActions()