On Thursday 08 January 2004 12:43 pm, Alfredo Braunstein wrote:
> On Thursday 08 January 2004 13:32, Angus Leeming wrote:
> > This shell-script adds the necessary function to each Q*Dialog.C file
> > if reject() isn't already defined.
> > #! /bin/sh
> > for file in src/frontends/qt2/Q*Dialog.C
> > do
> >         class=`basename $file`
> >         class=`echo $class | sed 's/\.C$//'`
> >         grep "void  *${class}::reject() *$" ${file} > /dev/null &&
> > continue baseclass="${class}Base"
> >         cat >> ${file} <<EOF
> >
> >
> > void ${class}::reject()
> > {
> >         form_->slotWMHide();
> >         ${baseclass}::reject();
> > }
> > EOF
> > done
> >
> > Shall I commit or would you prefer to test it out further yourself?
>
> what about header files?

Good point ;-)

> Isn't it better if we solve it less drastically? Like defining some
> QDialogPlus : public QDialog and deriving from QDialogPlus instead of
> QDialog?

If you can do that in the .ui file, then great. However, QDialogPlus will need 
to know 'form_' which will be different for each and every Dialog, so you'll 
need

template <typename Parent>
class QDialogPlus : QDialog {
        QDialogPlus(Parent * form) : form_(form) {}
        void reject() { form_->slotWMHide(); QDialog::reject(); }
        Parent * form_;
};

I don't think that this is any better/may well be impossible to encode. Have a 
go.

I'll leave this in your capable hands now.
Angus

Reply via email to