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

Helge Preuss helge.preuss at gmx.net
Fri Mar 27 22:47:35 CET 2009


Helge Preuss wrote:
>> So you could just do
>> QWidget* inputWigdet = Factory::create( LineEdit );
>> dynamic_cast<ParameterInput*>(inputWidget)->setValue( "SomeString" );
>>     
Okay, this *almost* seems to work. The widgets are displayed, and their
input is passed to the application, but the widgets always appear at
position (0,0) in the parent widget. Apparently I need to override at
least setGeometry() after all. Or which member function?

It turned out I need to cast to QWidget * a couple of times, when I
assemble the UI, because functions such as show(), hide(), setTooltip()
etc. of course expect a QWidget *. Not beautiful, but because it is done
only when assembling the UI I think it's ok.

I said it *seems* to work because I'm sometimes getting segfaults when I
change the UI. Haven't investigated that yet. Anyway, I assume I can
clean that up.

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/dea8d45a/attachment.html 


More information about the Qt-interest-old mailing list