[bt-devel] Icons and buttons

Gary Holmlund gary.holmlund at gmail.com
Wed Apr 8 07:11:42 MST 2009


Eeli Kaikkonen wrote:
> Quoting Gary Holmlund <gary.holmlund at gmail.com>:
>> -------
>>
>>     There are a couple ways of using QDialogButtonBox. One ways is to
>>     create the buttons (or button texts) yourself and add them to the
>>     button box, specifying their role.
>>
>>     findButton = new QPushButton(tr("&Find"));
>>
>>     findButton->setDefault(true);
>>
>>     moreButton = new QPushButton(tr("&More"));
>>
>>     moreButton->setCheckable(true);
>>
>>     moreButton->setAutoDefault(false);
>>
>>     buttonBox = new QDialogButtonBox(Qt::Vertical);
>>
>>     buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
>>
>>     buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
>>
>> -----
>> This seems like the best way to do it.
>>
>
> I don't remember the different ways I have used QDialogButtonBox, but
> I suppose it's easier to do:
>
> b = QDialogButtonBox(QDialogButtonBox::Cancel, QDialogButtonBox::Ok);
> util::prepareButtonBox(b);
>
> than to create to buttons manually with tr() and icons. If this kind
> of OK/Cancel dialog is used in 5 places, we have to add 10 tr() and 10
> icon names. This can be automated by using a helper function which
> just finds some standard buttons from the buttonbox and sets new
> string and ic
>>
>> --Eeli Kaikkonen
>>
>>
>> _______________________________________________
>> bt-devel mailing list
>> bt-devel at crosswire.org
>> http://www.crosswire.org/mailman/listinfo/bt-devel
> on. This saves also work of translators 'cause there's only 1
> tr("Cancel") instead of 5. (I would also add a comment to tr()).
>
> Nonstandard or rare button names/icons must be still added manually.
I agree that the helper makes sense. I was not trying to say otherwise.
I just wanted to point out that we could use QDialogButtonBox and still
use our own text.

I will look into changing these.

Gary



More information about the bt-devel mailing list