| 267 | } |
| 268 | |
| 269 | void QuickOpenWidget::updateProviders() |
| 270 | { |
| 271 | if (QAction* action = (sender() ? qobject_cast<QAction*>(sender()) : nullptr)) { |
| 272 | auto* const menu = qobject_cast<QMenu*>(action->parent()); |
| 273 | if (menu) { |
| 274 | menu->show(); |
| 275 | menu->setActiveAction(action); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | QStringList checkedItems; |
| 280 | |
| 281 | if (ui.itemsButton->menu()) { |
| 282 | for (QObject* obj : ui.itemsButton->menu()->children()) { |
| 283 | auto* box = qobject_cast<QAction*>(obj); |
| 284 | if (box) { |
| 285 | if (box->isChecked()) { |
| 286 | checkedItems << box->text().remove(QLatin1Char('&')); |
| 287 | } |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | ui.itemsButton->setText(checkedItems.join(QLatin1String(", "))); |
| 292 | } |
| 293 | |
| 294 | QStringList checkedScopes; |
| 295 | |
| 296 | if (ui.scopesButton->menu()) { |
| 297 | for (QObject* obj : ui.scopesButton->menu()->children()) { |
| 298 | auto* box = qobject_cast<QAction*>(obj); |
| 299 | if (box) { |
| 300 | if (box->isChecked()) { |
| 301 | checkedScopes << box->text().remove(QLatin1Char('&')); |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | ui.scopesButton->setText(checkedScopes.join(QLatin1String(", "))); |
| 307 | } |
| 308 | |
| 309 | emit itemsChanged(checkedItems); |
| 310 | emit scopesChanged(checkedScopes); |
| 311 | m_model->enableProviders(checkedItems, checkedScopes); |
| 312 | } |
| 313 | |
| 314 | void QuickOpenWidget::textChanged(const QString& str) |
| 315 | { |