[Qt-interest] Problems with `password dialog'
Eirik Ulvik
eiriku at simsurgery.com
Wed Mar 10 10:09:36 CET 2010
Den 10.03.2010 10:01, skrev Aaron Lewis:
> Hi,
> I have a main window, and i want to dynamically create a Dialog to
> get informations ( kinds of user-name , password e.g)
>
> I have two classes , qsqlcc and qgetpass.
>
> I tried some sample code:
>
> I) In class getpass , i tried to take advantage of construct
> function , tried to pass pointers to it:
> qgetpass::qgetpass (QWidget *parent , QString *username , QString
> *passwd , QString *host)
> ..
>
> II) In MainWindow , in some function
>
> qgetpass *passDialog = new qgetpass(&_username,&_passwd,&_host);
>
> I then will got empty strings . I thought i should use connections ,
> but i've got no ideas..
>
> Any ideas will appreciate .
>
>
Depending if you want a modal dialog or not you should use different
approaches. I would in any case subclass QDialog and either show it with
exec() or show(). exec shows it in modal way, show() is non modal. When
exec returns you can use the object to fetch the information that was
entered. When show() is used connect to the dialog's accepted signal.
You should the use pointer to the dialog object to get entered
information in the slot that receives the accepted signal.
Hope this helps.
Regards,
Eirik
More information about the Qt-interest-old
mailing list