| 344 | } |
| 345 | |
| 346 | bool DisassembleWidget::displayCurrent() |
| 347 | { |
| 348 | if (!isMemoryRegionDisplayed() || !m_currentAddress.isValid()) { |
| 349 | return false; |
| 350 | } |
| 351 | if (m_currentAddress < m_regionFirst || m_currentAddress > m_regionLast) { |
| 352 | return false; // cannot highlight the current address because it is outside of the displayed memory region |
| 353 | } |
| 354 | |
| 355 | bool bFound=false; |
| 356 | for (int line=0; line < m_disassembleWindow->topLevelItemCount(); line++) |
| 357 | { |
| 358 | QTreeWidgetItem* item = m_disassembleWindow->topLevelItem(line); |
| 359 | const auto address = knownValidAddressFromString(item->text(Address)); |
| 360 | if (address == m_currentAddress.integer()) { |
| 361 | // put cursor at start of line and highlight the line |
| 362 | m_disassembleWindow->setCurrentItem(item); |
| 363 | item->setIcon(Icon, QIcon::fromTheme(QStringLiteral("go-next"))); |
| 364 | bFound = true; // need to process all items to clear icons |
| 365 | } |
| 366 | else if(!item->icon(Icon).isNull()) item->setIcon(Icon, QIcon()); |
| 367 | } |
| 368 | |
| 369 | return bFound; |
| 370 | } |
| 371 | |
| 372 | /***************************************************************************/ |
| 373 | |