22 : QObject(parent), m_canShowContextMenu(contextAllowed) {}
38 if (event->buttons() & Qt::MiddleButton) {
39 emit
initZoom(event->x(), event->y());
44 }
else if ((event->buttons() & Qt::RightButton) || ((event->buttons() & Qt::LeftButton) &&
m_isRotationFrozen)) {
56 emit
rotate(event->x(), event->y());
57 }
else if ((event->buttons() & Qt::RightButton) || ((event->buttons() & Qt::LeftButton) &&
m_isRotationFrozen)) {
59 }
else if (event->buttons() & Qt::MiddleButton) {
60 emit
zoom(event->x(), event->y());
79 emit
wheelZoom(
static_cast<int>(event->position().x()),
static_cast<int>(event->position().y()),
80 event->angleDelta().y());
97 if (event->button() == Qt::LeftButton) {
99 m_rect.setRect(event->x(), event->y(), 1, 1);
109 m_rect.setBottomRight(QPoint(event->x(), event->y()));
130 :
InputController(parent), m_creating(false), m_x(0), m_y(0), m_shapeType(), m_isButtonPressed(false) {}
136 if (event->button() == Qt::LeftButton) {
140 }
else if (event->modifiers() & Qt::ControlModifier) {
143 emit
selectAt(event->x(), event->y());
147 m_rect.setRect(event->x(), event->y(), 1, 1);
161 m_rect.setBottomRight(QPoint(event->x(), event->y()));
185 switch (event->key()) {
187 case Qt::Key_Backspace:
191 if (event->modifiers() == Qt::CTRL) {
196 if (event->modifiers() == Qt::CTRL) {
212 const QColor &fillColor) {
238 if (event->button() == Qt::LeftButton || event->button() == Qt::RightButton) {
240 m_rect.setTopLeft(QPoint(event->x(), event->y()));
249 m_rect.setBottomRight(QPoint(event->x(), event->y()));
278 :
InputController(parent), m_max_size(32),
m_size(30), m_isLeftButtonPressed(false), m_isRightButtonPressed(false),
279 m_isActive(false), m_cursor(nullptr) {}
289 if (event->button() == Qt::LeftButton) {
292 }
else if (event->button() == Qt::RightButton) {
315 if (event->button() == Qt::LeftButton) {
317 }
else if (event->button() == Qt::RightButton) {
323 int d =
m_size + (
event->angleDelta().y() > 0 ? 4 : -4);
328 QApplication::restoreOverrideCursor();
329 QApplication::setOverrideCursor(QCursor(*
m_cursor, 0, 0));
335 QApplication::setOverrideCursor(QCursor(*
m_cursor, 0, 0));
340 QApplication::restoreOverrideCursor();
369 cursor->fill(QColor(255, 255, 255, 0));
370 QPainter painter(cursor);
373 auto pen = QPen(Qt::DashLine);
374 QVector<qreal> dashPattern;
375 dashPattern << 4 << 4;
376 pen.setDashPattern(dashPattern);
377 pen.setColor(QColor(0, 0, 0));
379 painter.drawRect(QRect(0, 0, size, size));
381 pen.setColor(QColor(255, 255, 255));
382 pen.setDashOffset(4);
384 painter.drawRect(QRect(0, 0, size, size));
391 m_rect.setSize(QSize(size, size));
405 double a = 2.0 * M_PI / double(
m_rect.size());
406 for (
int i = 0; i <
m_rect.size(); ++i) {
407 double ia = double(i) * a;
408 auto x = r +
static_cast<int>(r * cos(ia));
409 auto y = r +
static_cast<int>(r * sin(ia));
430 cursor->fill(QColor(255, 255, 255, 0));
431 QPainter painter(cursor);
433 auto bRect =
m_rect.boundingRect();
434 auto poly =
m_rect.translated(-bRect.topLeft());
436 auto pen = QPen(Qt::DashLine);
437 QVector<qreal> dashPattern;
439 dashPattern << dashLength << dashLength;
440 pen.setDashPattern(dashPattern);
441 pen.setColor(QColor(0, 0, 0));
443 painter.drawPolygon(poly);
445 pen.setColor(QColor(255, 255, 255));
446 pen.setDashOffset(dashLength);
448 painter.drawPolygon(poly);
size_t m_size
Maximum size of the store.
void(ComponentInfo::* setPosition)(const size_t, const Mantid::Kernel::V3D &)