Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, May 2008
QDialogButtonBox


Message 1 in thread

Hello,

I'm wanting to put a 'Help' and 'Ok' button on a form, which needs to 
work on Mac and Windows, so a QDialogButtonBox seems like a good idea to 
sort out layout issues automatically.  The 'Ok' button has been defined 
in Designer - so I presume using QDialogButtonBox::Ok.

The form needs some data validation performed once the user has clicked 
on the 'Ok' button, and we may not want the form to close, depending on 
the results of that validation.  Is there any way to stop this from 
happening?

Thanks,

Peter Lee

-- 
 [ signature omitted ] 

Message 2 in thread

Hi,

> I'm wanting to put a 'Help' and 'Ok' button on a form, which needs to work 
> on Mac and Windows, so a QDialogButtonBox seems like a good idea to sort 
> out layout issues automatically.  The 'Ok' button has been defined in 
> Designer - so I presume using QDialogButtonBox::Ok.
>
> The form needs some data validation performed once the user has clicked on 
> the 'Ok' button, and we may not want the form to close, depending on the 
> results of that validation.  Is there any way to stop this from happening?
Hi,

Of course you can: simply make sure that you don't connect your 
QDialgoButtonBox's accepted signal to the QDialog's accept slot.

Instead, you hook the accepted() signal to your own slot, do your 
validation, and call accept() from there if the validation succeeds.

André
 

--
 [ signature omitted ]