! * \brief Shows the mqtt will settings widget, which allows the user to modify the will settings */
| 2962 | * \brief Shows the mqtt will settings widget, which allows the user to modify the will settings |
| 2963 | */ |
| 2964 | void ImportFileWidget::showWillSettings() { |
| 2965 | QMenu menu; |
| 2966 | |
| 2967 | QVector<QTreeWidgetItem*> children; |
| 2968 | for (int i = 0; i < m_subscriptionWidget->subscriptionCount(); ++i) |
| 2969 | MQTTSubscriptionWidget::findSubscriptionLeafChildren(children, m_subscriptionWidget->topLevelSubscription(i)); |
| 2970 | |
| 2971 | QVector<QString> topics; |
| 2972 | for (const auto& child : children) |
| 2973 | topics.append(child->text(0)); |
| 2974 | |
| 2975 | MQTTWillSettingsWidget willSettingsWidget(&menu, m_willSettings, topics); |
| 2976 | |
| 2977 | connect(&willSettingsWidget, &MQTTWillSettingsWidget::applyClicked, [this, &menu, &willSettingsWidget]() { |
| 2978 | m_willSettings = willSettingsWidget.will(); |
| 2979 | menu.close(); |
| 2980 | }); |
| 2981 | auto* widgetAction = new QWidgetAction(this); |
| 2982 | widgetAction->setDefaultWidget(&willSettingsWidget); |
| 2983 | menu.addAction(widgetAction); |
| 2984 | |
| 2985 | const QPoint pos(ui.bLWT->sizeHint().width(), ui.bLWT->sizeHint().height()); |
| 2986 | menu.exec(ui.bLWT->mapToGlobal(pos)); |
| 2987 | } |
| 2988 | |
| 2989 | void ImportFileWidget::enableWill(bool enable) { |
| 2990 | ui.bLWT->setEnabled(enable); |
nothing calls this directly
no test coverage detected