[Qt-interest] QDialogButtonBox in a dialog, accepted events doesn't close the dialog.

Neel Basu neel.basu.z at gmail.com
Wed Apr 29 16:46:02 CEST 2009


On Wednesday 29 April 2009 20:00:42 Giancarlo Amati wrote:
> Hello everybody,
>
> I have ha dialog window created using QDesigner. now, my Dialog has a
> DialogButtonBox widget in it emits the Accpeted and Rejected signals. now,
> I created my own Class CDialog, derived from the Dialog and mapped all the
> events with the proper handlers.
>
> When I need my CDialog show up I do this:
> CRBCreateDlg rbdlg;
> rbdlg.setModal(true);
> ret = rbdlg.exec();
>
>
> so I expect that when I'll press OK I'll run my accepted handler funciton
> and close the dialog. But unfortunately it deosn'thappen, My dialog window
> keeps staying on in foregroudn. How? and why? what's wrong with my code?
> should't I mappe the accepted event with my own handler?
accepted() signal will be emitted only when the Button clicked has AcceptRole 
or YesRole
By default the Standard Ok Button have AcceptRole
I think You have use a button with some other Role and setText("OK");

On the designer you will see StandardButtons
Check Proper Buttons from there.

Neel



More information about the Qt-interest-old mailing list