| 685 | } |
| 686 | |
| 687 | void |
| 688 | CustomizeMenuConfigPage::current_changed (QTreeWidgetItem *current, QTreeWidgetItem *previous) |
| 689 | { |
| 690 | if (! m_enable_event) { |
| 691 | return; |
| 692 | } |
| 693 | |
| 694 | m_enable_event = false; |
| 695 | |
| 696 | update_list_item (previous); |
| 697 | |
| 698 | if (current && !current->data (0, Qt::UserRole).isNull ()) { |
| 699 | |
| 700 | std::string path = tl::to_string (current->data (0, Qt::UserRole).toString ()); |
| 701 | if (mp_dispatcher->menu ()->is_menu (path)) { |
| 702 | |
| 703 | mp_ui->binding_le->setText (QString ()); |
| 704 | #if QT_VERSION >= 0x40700 |
| 705 | mp_ui->binding_le->setPlaceholderText (QString ()); |
| 706 | #endif |
| 707 | mp_ui->binding_le->setEnabled (false); |
| 708 | |
| 709 | } else { |
| 710 | |
| 711 | std::string shortcut = m_current_bindings[path]; |
| 712 | |
| 713 | lay::Action *a = mp_dispatcher->menu ()->action (path); |
| 714 | |
| 715 | std::string def_shortcut = a->get_default_shortcut (); |
| 716 | |
| 717 | mp_ui->binding_le->setText (tl::to_qstring (shortcut)); |
| 718 | #if QT_VERSION >= 0x40700 |
| 719 | mp_ui->binding_le->setPlaceholderText (tl::to_qstring (def_shortcut)); |
| 720 | #endif |
| 721 | mp_ui->binding_le->setEnabled (true); |
| 722 | |
| 723 | } |
| 724 | |
| 725 | } else { |
| 726 | |
| 727 | mp_ui->binding_le->setText (QString ()); |
| 728 | #if QT_VERSION >= 0x40700 |
| 729 | mp_ui->binding_le->setPlaceholderText (QString ()); |
| 730 | #endif |
| 731 | mp_ui->binding_le->setEnabled (false); |
| 732 | |
| 733 | } |
| 734 | |
| 735 | m_enable_event = true; |
| 736 | } |
| 737 | |
| 738 | } |
| 739 |
nothing calls this directly
no test coverage detected