[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QDialogButtonBox question
From:       Arno Rehn <kde-devel () arnorehn ! de>
Date:       2010-09-29 14:18:51
Message-ID: 201009291618.52170.kde-devel () arnorehn ! de
[Download RAW message or body]

On Wednesday 29 September 2010 16:01:25 Robin Atwood wrote:
> Qt Designer now generates a QDialogButtonBox object when you create a
> dialog. The clicked() signal drives a slot with a QAbstractButton as the
> parameter. Now, unless I have missed something, the only property you have
> to tell which button was clicked is the text. I have been coding
> 
> 	if ( btn->text() == "&OK" ) ...
> 
> but now it occurs to me: what about translation? Does that happen later
> when the widget is rendered or must I code i18n("&OK") or what?
You can get the ButtonRole with the QDialogButtonBox::buttonRole() method. It 
takes a QAbstractButton* as a parameter, which you receive with the signal.
If you added a custom button, just store the pointer somewhere and compare it 
to the one you get with the signal.

-- 
Arno Rehn
arno@arnorehn.de
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic