Qt-interest Archive, August 2007
close widget within widget's constructor
Message 1 in thread
Hello All,
I'm new to Qt.
I'm trying to build a form / dialog that will close
immediately if the user doesn't have permission to
launch it. Here are my code :
Form::Form(....)
{
string permission;
permission=cApp->GetPermission(objectName().toStdString());
if (permission=="") destroy(TRUE);
}
I have put destroy(TRUE), but the form / dialog keep
showing (not closed immediately). Have tried to
replace destroy(TRUE) with close() and
done(QDialog::Accepted) / done(QDialog::Rejected) but
same result : the form is not closed immediately. Am I
missing something here ?. Is there something wrong
with my code / design ?.
Thanks in advance for your help,
regards,
si sol
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting
--
[ signature omitted ]
Message 2 in thread
Wouldn't it be easier to check for the permissions before launching the dialog
in the first place?
On Wednesday 15 August 2007, si_sol wrote:
> Hello All,
>
> I'm new to Qt.
> I'm trying to build a form / dialog that will close
> immediately if the user doesn't have permission to
> launch it. Here are my code :
>
> Form::Form(....)
> {
> string permission;
>
> permission=cApp->GetPermission(objectName().toStdString());
> if (permission=="") destroy(TRUE);
> }
>
> I have put destroy(TRUE), but the form / dialog keep
> showing (not closed immediately). Have tried to
> replace destroy(TRUE) with close() and
> done(QDialog::Accepted) / done(QDialog::Rejected) but
> same result : the form is not closed immediately. Am I
> missing something here ?. Is there something wrong
> with my code / design ?.
>
> Thanks in advance for your help,
> regards,
> si sol
--
[ signature omitted ]
Message 3 in thread
Actually the permission is not only applies to form
but to all individual object in the form. That's why
I put the permission check inside the object.
--- Jan Ekholm <jan.ekholm@xxxxxxxxxxxx> wrote:
>
> Wouldn't it be easier to check for the permissions
> before launching the dialog
> in the first place?
>
> On Wednesday 15 August 2007, si_sol wrote:
> > Hello All,
> >
> > I'm new to Qt.
> > I'm trying to build a form / dialog that will
> close
> > immediately if the user doesn't have permission to
> > launch it. Here are my code :
> >
> > Form::Form(....)
> > {
> > string permission;
> >
> >
>
permission=cApp->GetPermission(objectName().toStdString());
> > if (permission=="") destroy(TRUE);
> > }
> >
> > I have put destroy(TRUE), but the form / dialog
> keep
> > showing (not closed immediately). Have tried to
> > replace destroy(TRUE) with close() and
> > done(QDialog::Accepted) / done(QDialog::Rejected)
> but
> > same result : the form is not closed immediately.
> Am I
> > missing something here ?. Is there something wrong
> > with my code / design ?.
> >
> > Thanks in advance for your help,
> > regards,
> > si sol
>
>
> --
> Jan Ekholm
> jan.ekholm@xxxxxxxxxxxx
>
> --
> To unsubscribe - send a mail to
> qt-interest-request@xxxxxxxxxxxxx with "unsubscribe"
> in the subject or the body.
> List archive and information:
> http://lists.trolltech.com/qt-interest/
>
>
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
--
[ signature omitted ]
Message 4 in thread
Why not add a "bool permission_to_launch()" method to the widget then
and call that before showing the widget?
anyways, i guess the best method to close a dialog is to call the quit()
slot.
Cheers,
Peter
> -----Original Message-----
> From: si_sol [mailto:si_sol@xxxxxxxxx]
> Sent: Wednesday, August 15, 2007 9:51 AM
> To: qt-interest@xxxxxxxxxxxxx
> Subject: Re: close widget within widget's constructor
>
>
> Actually the permission is not only applies to form
> but to all individual object in the form. That's why
> I put the permission check inside the object.
--
[ signature omitted ]