Commit 5ab2b734 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.itemLibary: keep track of version

We have to define a version for the item library.
Before 4.7 was hardcoded.
Slight update of the itemlibrary.
parent e0eaa1b9
......@@ -109,10 +109,29 @@ void MetaInfoParser::handleNodeItemLibraryEntryElement(QXmlStreamReader &reader,
{
if (reader.isStartElement() && reader.name() == "itemlibraryentry")
{
const QString versionNumber = reader.attributes().value("version").toString();
int major = 1;
int minor = 0;
if (!versionNumber.isEmpty()) {
int val;
bool ok;
if (versionNumber.contains('.')) {
val = versionNumber.split('.').first().toInt(&ok);
major = ok ? val : major;
val = versionNumber.split('.').last().toInt(&ok);
minor = ok ? val : minor;
} else {
val = versionNumber.toInt(&ok);
major = ok ? val : major;
}
}
const QString name = reader.attributes().value("name").toString();
ItemLibraryEntry entry;
entry.setType(className, 4, 7);
entry.setType(className, major, minor);
entry.setName(name);
entry.setIcon(icon);
......
<metainfo>
<node name="Qt/Item" icon=":/qtquickplugin/images/item-icon16.png">
<itemlibraryentry name="Item" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/item-icon.png">
<itemlibraryentry name="Item" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/item-icon.png" version="4.7">
<property name="width" type="int" value="200"/>
<property name="height" type="int" value="200"/>
</itemlibraryentry>
</node>
<node name="Qt/Rectangle" icon=":/qtquickplugin/images/rect-icon16.png">
<itemlibraryentry name="Rectangle" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/rect-icon.png">
<itemlibraryentry name="Rectangle" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/rect-icon.png" version="4.7">
<property name="color" type="QColor" value="#ffffff"/>
<property name="width" type="int" value="200"/>
<property name="height" type="int" value="200"/>
</itemlibraryentry>
</node>
<node name="Qt/Text" icon=":/qtquickplugin/images/text-icon16.png">
<itemlibraryentry name="Text" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-icon.png">
<itemlibraryentry name="Text" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-icon.png" version="4.7">
<property name="width" type="int" value="80"/>
<property name="height" type="int" value="20"/>
<property name="text" type="QString" value="text"/>
......@@ -19,7 +21,7 @@
</itemlibraryentry>
</node>
<node name="Qt/TextEdit" icon=":/qtquickplugin/images/text-edit-icon16.png">
<itemlibraryentry name="Text Edit" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-edit-icon.png">
<itemlibraryentry name="Text Edit" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-edit-icon.png" version="4.7">
<property name="width" type="int" value="80"/>
<property name="height" type="int" value="20"/>
<property name="text" type="QString" value="textEdit"/>
......@@ -27,7 +29,7 @@
</itemlibraryentry>
</node>
<node name="Qt/TextInput" icon=":/qtquickplugin/images/text-input-icon16.png">
<itemlibraryentry name="Text Input" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-input-licon.png">
<itemlibraryentry name="Text Input" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/text-input-icon.png" version="4.7">
<property name="width" type="int" value="80"/>
<property name="height" type="int" value="20"/>
<property name="text" type="QString" value="textInput"/>
......@@ -35,70 +37,93 @@
</itemlibraryentry>
</node>
<node name="Qt/MouseArea" icon=":/qtquickplugin/images/mouse-area-icon16.png">
<itemlibraryentry name="Mouse Area" category="Qt - Interaction" libraryIcon=":/qtquickplugin/images/mouse-area-icon.png">
<itemlibraryentry name="Mouse Area" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/mouse-area-icon.png" version="4.7">
<property name="width" type="int" value="100"/>
<property name="height" type="int" value="100"/>
</itemlibraryentry>
</node>
<node name="Qt/Image" icon=":/qtquickplugin/images/image-icon16.png">
<itemlibraryentry name="Image" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/image-icon.png">
<itemlibraryentry name="Image" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/image-icon.png" version="4.7">
<property name="width" type="int" value="100"/>
<property name="height" type="int" value="100"/>
<property name="source" type="QUrl" value="qrc:/qtquickplugin/images/template_image.png"/>
</itemlibraryentry>
</node>
<node name="Qt/BorderImage" icon=":/qtquickplugin/images/border-image-icon16.png">
<itemlibraryentry name="Border Image" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/border-image-icon.png">
<itemlibraryentry name="Border Image" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/border-image-icon.png" version="4.7">
<property name="width" type="int" value="100"/>
<property name="height" type="int" value="100"/>
<property name="source" type="QUrl" value="qrc:/qtquickplugin/images/template_image.png"/>
</itemlibraryentry>
</node>
<node name="Qt/Flickable" icon=":/qtquickplugin/images/flickable-icon16.png">
<itemlibraryentry name="Flickable" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/flickable-icon.png">
<itemlibraryentry name="Flickable" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/flickable-icon.png" version="4.7">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
</itemlibraryentry>
</node>
<node name="Qt/Flipable" icon=":/qtquickplugin/images/flipable-icon16.png">
<itemlibraryentry name="Flipable" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/flipable-icon.png">
<itemlibraryentry name="Flipable" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/flipable-icon.png" version="4.7">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
</itemlibraryentry>
</node>
<node name="Qt/GridView" icon=":/qtquickplugin/images/gridview-icon16.png">
<itemlibraryentry name="Grid View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/gridview-icon.png">
<itemlibraryentry name="Grid View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/gridview-icon.png" version="4.7">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
</itemlibraryentry>
</node>
<node name="Qt/ListView" icon=":/qtquickplugin/images/listview-icon16.png">
<itemlibraryentry name="List View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/listview-icon.png">
<itemlibraryentry name="List View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/listview-icon.png" version="4.7">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
</itemlibraryentry>
</node>
<node name="Qt/PathView" icon=":/qtquickplugin/images/pathview-icon16.png">
<itemlibraryentry name="Path View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/pathview-icon.png">
<itemlibraryentry name="Path View" category="Qt - Views" libraryIcon=":/qtquickplugin/images/pathview-icon.png" version="4.7">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
</itemlibraryentry>
</node>
<node name="Qt/FocusScope" icon=":/qtquickplugin/images/focusscope-icon16.png">
<itemlibraryentry name="Focus Scope" category="Qt - Interaction" libraryIcon=":/qtquickplugin/images/focusscope-icon.png">
<itemlibraryentry name="Focus Scope" category="Qt - Basic" libraryIcon=":/qtquickplugin/images/focusscope-icon.png" version="4.7">
<property name="width" type="int" value="100"/>
<property name="height" type="int" value="100"/>
</itemlibraryentry>
</node>
<node name="QtWebKit/WebView" icon=":/qtquickplugin/images/webview-icon16.png">
<itemlibraryentry name="Web View" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/webview-icon.png">
<itemlibraryentry name="Web View" category="Qt - Widgets" libraryIcon=":/qtquickplugin/images/webview-icon.png" version="1.0">
<property name="width" type="int" value="300"/>
<property name="height" type="int" value="300"/>
<property name="url" type="QString" value="http://qt.nokia.com"/>
</itemlibraryentry>
</node>
</metainfo>
<node name="Qt/Row" icon=":/qtquickplugin/images/item-icon16.png">
<itemlibraryentry name="Row" category="Qt - Positioner" libraryIcon=":/qtquickplugin/images/item-icon.png" version="4.7">
<property name="width" type="int" value="400"/>
<property name="height" type="int" value="200"/>
</itemlibraryentry>
</node>
<node name="Qt/Column" icon=":/qtquickplugin/images/item-icon16.png">
<itemlibraryentry name="Column" category="Qt - Positioner" libraryIcon=":/qtquickplugin/images/item-icon.png" version="4.7">
<property name="width" type="int" value="200"/>
<property name="height" type="int" value="400"/>
</itemlibraryentry>
</node>
<node name="Qt/Grid" icon=":/qtquickplugin/images/item-icon16.png">
<itemlibraryentry name="Grid" category="Qt - Positioner" libraryIcon=":/qtquickplugin/images/item-icon.png" version="4.7">
<property name="width" type="int" value="400"/>
<property name="height" type="int" value="400"/>
</itemlibraryentry>
</node>
<node name="Qt/Flow" icon=":/qtquickplugin/images/item-icon16.png">
<itemlibraryentry name="Flow" category="Qt - Positioner" libraryIcon=":/qtquickplugin/images/item-icon.png" version="4.7">
<property name="width" type="int" value="400"/>
<property name="height" type="int" value="400"/>
</itemlibraryentry>
</node>
</metainfo>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment