| 147 | } |
| 148 | |
| 149 | int HexWidget::getPosition(QPoint posa, bool allow) { |
| 150 | int xOffset = posa.x() + horizontalScrollBar()->value(); |
| 151 | int result = -1; |
| 152 | |
| 153 | if (xOffset >= m_asciiLoc && xOffset < (m_asciiLoc + m_bytesPerLine * m_charWidth)) { |
| 154 | if (allow) { |
| 155 | m_asciiEdit = true; |
| 156 | } |
| 157 | if (m_asciiEdit) { |
| 158 | int y = ((posa.y() - m_gap) / m_charHeight) * m_bytesPerLine * 2; |
| 159 | int x = (xOffset - m_asciiLoc) / m_charWidth; |
| 160 | result = m_lineStart * 2 + x * 2 + y; |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | if (xOffset >= m_dataLoc && xOffset < m_asciiLine) { |
| 165 | if (allow) { |
| 166 | m_asciiEdit = false; |
| 167 | } |
| 168 | if (!m_asciiEdit) { |
| 169 | int y = ((posa.y() - m_gap) / m_charHeight) * m_bytesPerLine * 2; |
| 170 | int x = (xOffset - m_dataLoc) / m_charWidth; |
| 171 | x = (x / 3) * 2 + x % 3; |
| 172 | result = m_lineStart * 2 + x + y; |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | return result; |
| 177 | } |
| 178 | |
| 179 | void HexWidget::showCursor() { |
| 180 | disconnect(verticalScrollBar(), &QScrollBar::valueChanged, this, &HexWidget::scroll); |
nothing calls this directly
no outgoing calls
no test coverage detected