Kai,

What about QGraphicsWidget? There seems no visual editor for it. 
Besides, it is not clear on how to add a new sub class QDelarativeItem to item 
library. I tried the following:
I. in myplugin.cpp:
 qmlRegisterType<QDeclarativeItem>("test_mtf_plugin",1,0,"QDeclarativeItem");

2. in .metainfo
metainfo>
  <node name="test_mtf_plugin/QDeclarativeItem" showInItemLibrary="true" 
category="Bauhaus - Basic" isContainer="true" 
icon=":/fxplugin/images/item-icon.png">
    <inherits name="Qt/Item" />
    <propertyDefaultValue name="width" type="int" defaultValue="600"/>
    <propertyDefaultValue name="height" type="int" defaultValue="400"/>
    <itemlibraryrepresentation name="MTF Item" 
icon=":/fxplugin/images/item-icon.png">
      <property name="width" type="int" value="200"/>
      <property name="height" type="int" value="200"/>
    </itemlibraryrepresentation>
  </node>
</metainfo>


Notice that I use "<inherits name="Qt/Item" />" in the metainfo file, or it 
will not show in item library.

Although with these codes, qmldesigner can show a item in the library, when I 
drag the item on top of an item, qtcreator crashes with:

property list interface not fully implemented for Class  
QDeclarativeListProperty<QObject>  in property  "data" ! 
Property list interface not fully implemented for Class  
QDeclarativeListProperty<QObject>  in property  "data" ! 
Property list interface not fully implemented for Class  
QDeclarativeListProperty<QObject>  in property  "data" ! 
Property list interface not fully implemented for Class  
QDeclarativeListProperty<QObject>  in property  "data" ! 
terminate called after throwing an instance of 'QmlDesigner::RewritingException'


If I change " test_mtf_plugin" to "Qt", everything is OK. Should I always put 
my customized class to "Qt" ?


Best regards,

John Chen

-----Original Message-----
From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
Behalf Of Kai Koehne
Sent: Wednesday, July 21, 2010 3:56 PM
To: qt-qml@trolltech.com
Subject: Re: [Qt-qml] Any one knows how to write a qmldesigner plugin?

On 7/21/2010 9:04 AM, ext Chen, Zhang Z wrote:
> Kai,
>
> I found that only sub class of QDelarativeItem can be added to the item 
> library of Quick Designer. Is that by design? QML runtime plugin can register 
> any QObject type, why shouldn't QuickDesigner? If I want to import QLabel to 
> the designer, should I create a class which inherits both QDelarativeItem and 
> QLabel?

Hi,

the idea of QuickDesigner is obviously to lay out stuff visually. To do 
this, the things you drag&drop have to implement an interface. 
QuickDesigner needs a way to e.g. set a width, height, position, and 
tell the thingy to paint itself. That's why we cannot handle 'arbitrary' 
QObject based classes (at least QuickDesigner is not able to do anything 
interesting with it).

You're right in that QuickDesigner only supports items inheriting from 
QDeclarativeItem. It would be indeed possible to also add support for 
QWidget based stuff, but it would be a major effort, and given the fact 
that we don't support QWidget bindings for Qml, and there is already a 
visual editor for QWidgets (QtDesigner), it's unlikely that we look into 
this any time soon.

Kai

> Best regard,
>
> John Chen
>
> -----Original Message-----
> From: qt-qml-boun...@trolltech.com [mailto:qt-qml-boun...@trolltech.com] On 
> Behalf Of Kai Koehne
> Sent: Wednesday, July 21, 2010 1:51 PM
> To: qt-qml@trolltech.com
> Subject: Re: [Qt-qml] Any one knows how to write a qmldesigner plugin?
>
> On 7/20/2010 11:17 AM, ext Chen, Zhang Z wrote:
>> Hi All,
>> I'm trying to make a customized type to be "designable" with QML
>> designer. I tried to write a plugin using fxplugin as a template. But as
>> long as I use types instead of those in fx.metainfo, I can't have them
>> displayed on QML designer. Anyone can give me a rough idea on what is
>> the problem?
>
> Hi,
>
> we haven't really spend much time on enabling support for external C++
> plugins in QuickDesigner, so consider this experimental for now (like
> the whole plugin). Anyhow, maybe it's a small issue easy to fix. Can you
> file a more detailed report (e.g. what does 'can't have them displayed'
> mean?) to bugreports.qt.nokia.com, ideally with some example code?
>
> Thanks,
>
> Kai
>
>


-- 
--
Kai Koehne
Software Engineer
Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to