-// Copyright (C) 2013-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2023 CEA, EDF, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//================================================================
bool GraphicsView_ViewPort::isItemAdded( QGraphicsItem* theItem )
{
- if( GraphicsView_Object* anObject = dynamic_cast<GraphicsView_Object*>( theItem ) )
+ if( dynamic_cast<GraphicsView_Object*>( theItem ) )
{
for( GraphicsView_ObjectList::iterator anIter = myObjects.begin(); anIter != myObjects.end(); anIter++ )
if( theItem == *anIter )
return false;
QPrinter printer(QPrinter::ScreenResolution);
- printer.setOutputFormat(QPrinter::PostScriptFormat);
+ printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOutputFileName(fileName);
QPainter painter;
if (!painter.begin(&printer))
aTransform.scale( aZoom, aZoom );
double aM11 = aTransform.m11();
double aM22 = aTransform.m22();
+
+
+ QGraphicsView::ViewportAnchor old_anchor = transformationAnchor();
+ setTransformationAnchor( QGraphicsView::AnchorUnderMouse );
+
// increasing of diagonal coefficients (>300) leads to a crash sometimes
// at the values of 100 some primitives are drawn incorrectly
if( myZoomCoeff < 0 || qMax( aM11, aM22 ) < myZoomCoeff )
myIsTransforming = false;
applyTransform();
+
+ setTransformationAnchor( old_anchor );
}
//================================================================
//================================================================
void GraphicsView_ViewPort::setUnlimitedPanning( const bool& theValue )
{
+ if ( myUnlimitedPanning == theValue )
+ return;
+
myUnlimitedPanning = theValue;
if( myUnlimitedPanning )
bool anIsHighlighted = false;
bool anIsOnObject = false;
- GraphicsView_Object* aPreviousHighlightedObject = myHighlightedObject;
GraphicsView_Object* aHighlightedObject = 0;
QCursor aCursor;
{
aStatus = GVSS_NoChanged;
- bool updateAll = false;
if( !theIsAppend )
{
if( !mySelectedObjects.isEmpty() )
else
anObjectsToMove.append( anObject );
}
- else if( ( hasInteractionFlag( DraggingByMiddleButton ) && ( e->buttons() & Qt::MidButton ) ||
- isDraggingSelectedByLeftButton() && ( e->buttons() & Qt::LeftButton ) ) &&
+ else if( ( ( hasInteractionFlag( DraggingByMiddleButton ) && ( e->buttons() & Qt::MidButton ) ) ||
+ ( isDraggingSelectedByLeftButton() && ( e->buttons() & Qt::LeftButton ) ) ) &&
nbSelected() )
{
for( initSelected(); moreSelected(); nextSelected() )
if( ( getHighlightedObject() &&
getHighlightedObject()->isMovable() &&
!( anAccel || e->button() != Qt::LeftButton ) ) ||
- ( ( hasInteractionFlag( DraggingByMiddleButton ) && e->button() == Qt::MidButton ||
- isDraggingSelectedByLeftButton() && e->button() == Qt::LeftButton ) &&
+ ( ( ( hasInteractionFlag( DraggingByMiddleButton ) && e->button() == Qt::MidButton ) ||
+ ( isDraggingSelectedByLeftButton() && e->button() == Qt::LeftButton ) ) &&
nbSelected() && !anAccel ) )
{
myIsDragging = true;