| 521 | } |
| 522 | |
| 523 | void IdealButtonBarWidget::applyOrderToLayout() |
| 524 | { |
| 525 | // If widget already have some buttons in the layout then calling loadOrderSettings() may leads |
| 526 | // to situations when loaded order does not contains all existing buttons. Therefore we should |
| 527 | // fix this with using addToOrder() method. |
| 528 | for (int i = 0; i < m_buttonsLayout->count(); ++i) { |
| 529 | if (auto button = qobject_cast<IdealToolButton*>(m_buttonsLayout->itemAt(i)->widget())) { |
| 530 | addButtonToOrder(button); |
| 531 | m_buttonsLayout->removeWidget(button); |
| 532 | --i; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | for (const QString& id : std::as_const(m_buttonsOrder)) { |
| 537 | if (auto b = button(id)) { |
| 538 | m_buttonsLayout->addWidget(b); |
| 539 | } |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | void IdealButtonBarWidget::takeOrderFromLayout() |
| 544 | { |