| 54 | } |
| 55 | |
| 56 | bool ActionButton::addButtons(const QStringList &list) |
| 57 | { |
| 58 | if (list.isEmpty()) |
| 59 | return false; |
| 60 | |
| 61 | QString id; |
| 62 | for (int i = 0; i != list.size(); ++i) { |
| 63 | if (i % 2 == 0) { |
| 64 | id = list[i]; |
| 65 | } else { |
| 66 | QAbstractButton *button { nullptr }; |
| 67 | if (id.endsWith(DefaultButtonField)) |
| 68 | button = new DSuggestButton(this); |
| 69 | else |
| 70 | button = new QPushButton(this); |
| 71 | |
| 72 | button->setText(list[i]); |
| 73 | layout()->addWidget(button); |
| 74 | |
| 75 | connect(button, &QPushButton::clicked, this, std::bind(&ActionButton::buttonClicked, this, id)); |
| 76 | d->buttons << button; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | return true; |
| 81 | } |
| 82 | |
| 83 | QList<QAbstractButton *> ActionButton::buttonList() |
| 84 | { |