qt-interest@trolltech.com
[Top] [All Lists]

Re: QActionGroup

Subject: Re: QActionGroup
From: "Ann Marie"
Date: Mon, 17 Apr 2006 20:53:42 -0700
Thanks!  How do I set one of the items to be the default one selected when the application starts up?

On 4/17/06, Sylviane et Perry White <spwhite@xxxxxxxxxxx> wrote:
On Monday 17 April 2006 16:26, Ann Marie wrote:
> I am using a QActionGroup to handle selections within a popupmenu.
>
> A few questions I have -
>
> When the user selects one of the items, a checkmark next to the item will
> appear. The user can only set one item at a time.
               That is what you want, but you don't get it
> In order to accomplish this, i tried using this the setExclusive property
               The action group is exclusive by default,
> but it does not work. I am allowed to select more than one and a check
> mark appears.
               myActionGroup-> setExclusive ( TRUE ); should work.
>
> How do I fix that?
               don't know, perhaps make sure you placed all your actions in the action
group.
>
> Also, how do I fix it to default to the 1st item when it starts up??
               have you tried myPrefferedAction->setChecked(TRUE); ?

here is a snippet from "assistant":
       alignmentGroup = new QActionGroup(this);
       alignmentGroup->addAction(leftAlignAct);
       alignmentGroup->addAction(rightAlignAct);
       alignmentGroup->addAction(justifyAct);
       alignmentGroup->addAction(centerAct);
       leftAlignAct->setChecked(true);

If you code matches this pattern and still doesn't work, try to send a minimal
compilable example.


Perry

--
BOFH excuse #445: Browser's cookie is corrupted -- someone's been nibbling on
it

--
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/


<Prev in Thread] Current Thread [Next in Thread>