mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +01:00
Qet graphics item : disable context menu from view when right button is holded
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3593 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -90,11 +90,20 @@ void QetGraphicsItem::applyRotation(const qreal &angle) {
|
||||
*handle the mouse click
|
||||
* @param e
|
||||
*/
|
||||
void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e) {
|
||||
first_move_ = true;
|
||||
if (e -> modifiers() & Qt::ControlModifier) {
|
||||
setSelected(!isSelected());
|
||||
void QetGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *e)
|
||||
{
|
||||
if (e -> button() == Qt::LeftButton)
|
||||
{
|
||||
//Disable views context menu
|
||||
if (scene())
|
||||
foreach (QGraphicsView *view, scene()->views())
|
||||
view->setContextMenuPolicy(Qt::NoContextMenu);
|
||||
|
||||
first_move_ = true;
|
||||
if (e -> modifiers() & Qt::ControlModifier)
|
||||
setSelected(!isSelected());
|
||||
}
|
||||
|
||||
QGraphicsItem::mousePressEvent(e);
|
||||
}
|
||||
|
||||
@@ -148,5 +157,13 @@ void QetGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
|
||||
*/
|
||||
void QetGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
|
||||
if (diagram()) diagram() -> endMoveElements();
|
||||
if (!(e -> modifiers() & Qt::ControlModifier)) QGraphicsItem::mouseReleaseEvent(e);
|
||||
|
||||
if (!(e -> modifiers() & Qt::ControlModifier))
|
||||
QGraphicsItem::mouseReleaseEvent(e);
|
||||
|
||||
//Enable views context menu
|
||||
if (e -> button() == Qt::LeftButton)
|
||||
if (scene())
|
||||
foreach (QGraphicsView *view, scene()->views())
|
||||
view -> setContextMenuPolicy(Qt::DefaultContextMenu);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user