Example #1
0
bool RemoveButtonsFromGroupCommand::init(const ButtonList &bl)
{
    if (bl.empty())
        return false;
    QButtonGroup *group = bl.front()->group();
    if (!group)
        return false;
    if (bl.size() >= group->buttons().size())
        return false;
    initialize(bl, group);
    //: Command description for removing buttons from a QButtonGroup
    setText(QApplication::translate("Command", "Remove '%1' from '%2'").arg(nameList(bl), group->objectName()));
    return true;
}
Example #2
0
QString ButtonGroupCommand::nameList(const ButtonList& bl)
{
    QString rc;
    const QChar quote = QLatin1Char('\'');
    const QString separator =  QLatin1String(", ");
    const int size = bl.size();
    for (int i = 0; i < size; i++) {
        if (i)
            rc += separator;
        rc += quote;
        rc += bl[i]->objectName();
        rc += quote;
    }
    return rc;

}