Fix some clicks and overrides
This commit is contained in:
parent
74d98fe8f3
commit
9952edb9f8
@ -142,6 +142,14 @@ void CropScene::setDrawingSelection(QString name, std::function<DrawItem *()> dr
|
|||||||
if (!drawingSelection->init(this)) setDrawingSelection("None", [] { return nullptr; });
|
if (!drawingSelection->init(this)) setDrawingSelection("None", [] { return nullptr; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QGraphicsItem *CropScene::whichItem(QPointF scenePos) {
|
||||||
|
for (auto item : items()) {
|
||||||
|
if (item->sceneBoundingRect().contains(scenePos))
|
||||||
|
if (item != polyItem && item != rect && item != cursorItem && item->zValue() != -1) return item;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void CropScene::hide() {
|
void CropScene::hide() {
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
@ -188,11 +196,8 @@ void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
|
|
||||||
auto buttons = e->buttons();
|
auto buttons = e->buttons();
|
||||||
if (e->modifiers() & Qt::ControlModifier && buttons == Qt::LeftButton) {
|
if (e->modifiers() & Qt::ControlModifier && buttons == Qt::LeftButton) {
|
||||||
QTransform stupidThing = views()[0]->transform();
|
auto item = whichItem(cursorPos);
|
||||||
auto item = itemAt(cursorPos, stupidThing);
|
if (item) item->moveBy(delta.x(), delta.y());
|
||||||
if (item && item != polyItem && item != rect && item->zValue() != -1) {
|
|
||||||
item->moveBy(delta.x(), delta.y());
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (buttons == Qt::LeftButton || (prevButtons == Qt::NoButton && prevButtons != buttons)) {
|
if (buttons == Qt::LeftButton || (prevButtons == Qt::NoButton && prevButtons != buttons)) {
|
||||||
@ -253,11 +258,8 @@ void CropScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
|||||||
|
|
||||||
void CropScene::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
void CropScene::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||||
if (e->modifiers() & Qt::AltModifier) {
|
if (e->modifiers() & Qt::AltModifier) {
|
||||||
QTransform stupidThing = views()[0]->transform();
|
auto item = whichItem(cursorItem->scenePos());
|
||||||
auto item = itemAt(cursorPos, stupidThing);
|
if (item) removeItem(item);
|
||||||
if (item && item != polyItem && item != rect && item->zValue() != -1) {
|
|
||||||
removeItem(item);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ public:
|
|||||||
QGraphicsRectItem *selRect() {
|
QGraphicsRectItem *selRect() {
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
QGraphicsItem *whichItem(QPointF scenePos);
|
||||||
void hide();
|
void hide();
|
||||||
void show();
|
void show();
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
Loading…
Reference in New Issue
Block a user