| 176 | } |
| 177 | |
| 178 | void CFrmViewer::mousePressEvent(QMouseEvent *event) |
| 179 | { |
| 180 | QPointF pos = |
| 181 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) |
| 182 | event->position(); |
| 183 | #else |
| 184 | event->pos(); |
| 185 | #endif |
| 186 | |
| 187 | if(TranslationMousePoint(pos, pos)) return; |
| 188 | // event->buttons() 产生事件时,按键的状态 |
| 189 | // event->button() 触发当前事件的按键 |
| 190 | qDebug(logMouse) << "CFrmViewer::mousePressEvent" |
| 191 | << event << event->button() << event->buttons() << pos; |
| 192 | emit sigMousePressEvent(event, QPoint(pos.x(), pos.y())); |
| 193 | event->accept(); |
| 194 | |
| 195 | if(testAttribute(Qt::WA_InputMethodEnabled) |
| 196 | && event->button() == Qt::LeftButton) { |
| 197 | qDebug(logInputMethod) << Q_FUNC_INFO << "Update micro focus"; |
| 198 | updateMicroFocus(); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void CFrmViewer::mouseReleaseEvent(QMouseEvent *event) |
| 203 | { |