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

Method startElement

src/laybasic/laybasic/gtf.cc:1784–1871  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1782}
1783
1784bool
1785GtfXmlHandler::startElement (const QString & /*namespaceURI*/, const QString &localName, const QString & /*qName*/, const QXmlAttributes &atts)
1786{
1787 if (localName == QString::fromUtf8 ("mouse_button_release") ||
1788 localName == QString::fromUtf8 ("mouse_button_press") ||
1789 localName == QString::fromUtf8 ("mouse_button_dbl_click")) {
1790
1791 int xpos = atts.value (QString::fromUtf8 ("xpos")).toInt ();
1792 int ypos = atts.value (QString::fromUtf8 ("ypos")).toInt ();
1793 int button = atts.value (QString::fromUtf8 ("button")).toInt (0, 16);
1794 int modifiers = atts.value (QString::fromUtf8 ("modifiers")).toInt (0, 16);
1795
1796 QEvent::Type type;
1797 if (localName == QString::fromUtf8 ("mouse_button_release")) {
1798 type = QEvent::MouseButtonRelease;
1799 } else if (localName == QString::fromUtf8 ("mouse_button_press")) {
1800 type = QEvent::MouseButtonPress;
1801 } else {
1802 type = QEvent::MouseButtonDblClick;
1803 }
1804
1805 QMouseEvent mouse_event (type, QPoint (xpos, ypos), Qt::MouseButton (button), Qt::MouseButtons (button), Qt::KeyboardModifiers (modifiers));
1806 enter_event (new LogMouseEvent (tl::to_string (atts.value (QString::fromUtf8 ("target"))), mouse_event, mp_locator->lineNumber ()));
1807
1808 } else if (localName == QString::fromUtf8 ("mouse_move")) {
1809
1810 int xpos = atts.value (QString::fromUtf8 ("xpos")).toInt ();
1811 int ypos = atts.value (QString::fromUtf8 ("ypos")).toInt ();
1812 int buttons = atts.value (QString::fromUtf8 ("buttons")).toInt (0, 16);
1813 int modifiers = atts.value (QString::fromUtf8 ("modifiers")).toInt (0, 16);
1814
1815 QMouseEvent mouse_event (QEvent::MouseMove, QPoint (xpos, ypos), Qt::MouseButton (Qt::NoButton), Qt::MouseButtons (buttons), Qt::KeyboardModifiers (modifiers));
1816 enter_event (new LogMouseEvent (tl::to_string (atts.value (QString::fromUtf8 ("target"))), mouse_event, mp_locator->lineNumber ()));
1817
1818 } else if (localName == QString::fromUtf8 ("key_press") ||
1819 localName == QString::fromUtf8 ("key_release")) {
1820
1821 int key = atts.value (QString::fromUtf8 ("key")).toInt (0, 16);
1822 QChar text_char = QChar (atts.value (QString::fromUtf8 ("code")).toInt (0, 16));
1823 QString text = text_char;
1824 int modifiers = atts.value (QString::fromUtf8 ("modifiers")).toInt (0, 16);
1825
1826 QEvent::Type type;
1827 if (localName == QString::fromUtf8 ("key_press")) {
1828 type = QEvent::KeyPress;
1829 } else {
1830 type = QEvent::KeyRelease;
1831 }
1832
1833 QKeyEvent key_event (type, Qt::Key (key), Qt::KeyboardModifiers (modifiers), text);
1834 enter_event (new LogKeyEvent (tl::to_string (atts.value (QString::fromUtf8 ("target"))), key_event, mp_locator->lineNumber ()));
1835
1836 } else if (localName == QString::fromUtf8 ("action")) {
1837
1838 enter_event (new LogActionEvent (tl::to_string (atts.value (QString::fromUtf8 ("target"))), tl::to_string (atts.value (QString::fromUtf8 ("action"))), mp_locator->lineNumber ()));
1839
1840 } else if (localName == QString::fromUtf8 ("resize")) {
1841

Callers

nothing calls this directly

Calls 8

enter_eventFunction · 0.70
QPointClass · 0.50
to_stringFunction · 0.50
QCharClass · 0.50
QSizeClass · 0.50
valueMethod · 0.45
lineNumberMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected