Commit 856e3f2d authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Disable crashing context menu in title widget

Related to #912
parent 714e90d0
Pipeline #46621 passed with stage
in 10 minutes and 29 seconds
......@@ -506,6 +506,11 @@ GraphicsSceneRectMove::GraphicsSceneRectMove(QObject *parent)
m_fontSize = 0;
}
void GraphicsSceneRectMove::contextMenuEvent(QGraphicsSceneContextMenuEvent *)
{
// Disable QGraphicsScene standard context menu that was crashing
}
void GraphicsSceneRectMove::setSelectedItem(QGraphicsItem *item)
{
clearSelection();
......@@ -758,18 +763,22 @@ void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent *e)
m_selectedItem = nullptr;
e->ignore();
} else if (m_tool == TITLE_TEXT) {
clearTextSelection();
MyTextItem *textItem = new MyTextItem(i18n("Text"), nullptr);
yPos = (((int)e->scenePos().y() - (int)(m_fontSize / 2)) / m_gridSize) * m_gridSize;
textItem->setPos(xPos, yPos);
addItem(textItem);
textItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setFocus(Qt::MouseFocusReason);
emit newText(textItem);
m_selectedItem = textItem;
m_selectedItem->setSelected(true);
m_createdText = true;
if (e->button() == Qt::LeftButton) {
clearTextSelection();
MyTextItem *textItem = new MyTextItem(i18n("Text"), nullptr);
yPos = (((int)e->scenePos().y() - (int)(m_fontSize / 2)) / m_gridSize) * m_gridSize;
textItem->setPos(xPos, yPos);
addItem(textItem);
textItem->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
textItem->setTextInteractionFlags(Qt::TextEditorInteraction);
textItem->setFocus(Qt::MouseFocusReason);
emit newText(textItem);
m_selectedItem = textItem;
m_selectedItem->setSelected(true);
m_createdText = true;
} else {
QGraphicsScene::mousePressEvent(e);
}
}
// qCDebug(KDENLIVE_LOG) << "////// MOUSE CLICK, RESIZE MODE: " << m_resizeMode;
}
......
......@@ -142,6 +142,7 @@ protected:
void mouseMoveEvent(QGraphicsSceneMouseEvent *) override;
void wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) override;
void drawForeground(QPainter *painter, const QRectF &rect) override;
void contextMenuEvent(QGraphicsSceneContextMenuEvent *contextMenuEvent) override;
private:
void setCursor(const QCursor &);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment