[Qt-interest] Generic input widgets for varying types - how to?

Helge Preuss helge.preuss at gmx.net
Fri Mar 27 21:20:29 CET 2009


Sean Harmer wrote:
>> I need a widget which can serve as input widget for several types. For
>> example, if the parameter read from the widget is an integer, it should
>> display a QSpinBox. If it's a string, a QLineEdit. There are other
>> types, but I'll limit myself to these.
>>     
> Take a look at QItemEditorFactory:
>
> http://doc.trolltech.com/4.5/qitemeditorfactory.html
>   
Thanks, this looks like what I need. One concern, though.
QItemEditorFactory::registerEditor() takes a QVariant::Type to designate
the type of data edited. QVariant::Type is restricted to a few
predefined Qt classes. Will I run into a brick wall if I try to define
an editor for my own custom class (e.g. Vector<3>, a class for
three-dimensional vectors (in the mathematical sense))?

Greets,

Helge

-- 
Helge Preuss
Freelance Software Developer
+49 30 40 30 10 90
+49 177 2262 484
helge.preuss at gmx.net

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090327/c92d5bd4/attachment.html 


More information about the Qt-interest-old mailing list