[Qt-interest] Access a dialogue's widgets created with Qt designer from main window?

Robert Wood robert.wood at apostrophe.co.uk
Wed Feb 10 16:27:39 CET 2010


Thanks for the prompt reply, Ian.

 > No you can't, calling userData() will cause a compile error because
 > userData is a QLineEdit pointer. You would just do 
dialogue.userData->text()

I did do dialogue.userData->text() so I'm not clear what you mean here.

 > What I recommend is adding a public function in your dialogue code 
that  returns ui->userData.text()

OK, that works, thanks!

 > The ui compiler just generates code for these widgets. Take a look at
 > the output of uic and you'll see that there is no difference between
 > hand coded widgets and widgets generated from designer.

Which begs the question, if the code's the same, why does the hand coded 
version work but the Qt designer one not? :~)

Cheers,

Rob



More information about the Qt-interest-old mailing list