MCPcopy Create free account
hub / github.com/KLayout/klayout / current_changed

Method current_changed

src/lay/lay/layMainConfigPages.cc:687–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

685}
686
687void
688CustomizeMenuConfigPage::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

Callers

nothing calls this directly

Calls 10

to_qstringFunction · 0.85
is_menuMethod · 0.80
menuMethod · 0.80
get_default_shortcutMethod · 0.80
to_stringFunction · 0.50
isNullMethod · 0.45
dataMethod · 0.45
toStringMethod · 0.45
setTextMethod · 0.45
actionMethod · 0.45

Tested by

no test coverage detected