From: vsr Date: Mon, 9 Apr 2018 10:30:52 +0000 (+0300) Subject: Merge branch 'oscar/imps_2017' X-Git-Tag: V8_5_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=533affbecb3e001b103b2e7c41af58e33e4cce9c;p=modules%2Fgui.git Merge branch 'oscar/imps_2017' --- 533affbecb3e001b103b2e7c41af58e33e4cce9c diff --cc src/GraphicsView/GraphicsView_ViewFrame.h index 537c81052,8068f9e9f..c5d2b3aff --- a/src/GraphicsView/GraphicsView_ViewFrame.h +++ b/src/GraphicsView/GraphicsView_ViewFrame.h @@@ -48,9 -48,8 +48,8 @@@ public public: GraphicsView_ViewFrame( SUIT_Desktop*, GraphicsView_Viewer*, QWidget* w = NULL ); - virtual ~GraphicsView_ViewFrame(); + ~GraphicsView_ViewFrame(); - public: GraphicsView_Viewer* getViewer() const { return myViewer; } GraphicsView_ViewPort* getViewPort() const { return myViewPort; } diff --cc src/GraphicsView/GraphicsView_ViewPort.cxx index 40086a4f8,aa60c1f63..4b3dafd5f --- a/src/GraphicsView/GraphicsView_ViewPort.cxx +++ b/src/GraphicsView/GraphicsView_ViewPort.cxx @@@ -457,6 -474,34 +474,38 @@@ QImage GraphicsView_ViewPort::dumpView return anImage; } + bool GraphicsView_ViewPort::dumpViewToFormat(const QString& fileName, const QString& format) + { + if( format!="PS" && format!="EPS" ) + return false; + + QPrinter printer(QPrinter::ScreenResolution); ++#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + printer.setOutputFormat(QPrinter::PostScriptFormat); ++#else ++ printer.setOutputFormat(QPrinter::PdfFormat); ++#endif + printer.setOutputFileName(fileName); + QPainter painter; + if (!painter.begin(&printer)) + return false; + + QRect view( 0, 0, printer.pageRect().width(), printer.paperRect().height() ); + QRectF bounds = myScene->itemsBoundingRect(); + + if( !view.isEmpty() && !bounds.isEmpty() ) + { + float SCALE = 0.5;//qMin( view.width()/bounds.width(), view.height()/bounds.height() ); + painter.setViewport( view ); + painter.scale( SCALE, SCALE ); + } + myScene->render( &painter, QRectF( view ), bounds ); + + if (!painter.end()) + return false; + return true; + } + //================================================================ // Function : setSceneGap // Purpose : @@@ -850,14 -915,9 +919,14 @@@ void GraphicsView_ViewPort::zoom( doubl 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( qMax( aM11, aM22 ) < 100 ) + if( myZoomCoeff < 0 || qMax( aM11, aM22 ) < myZoomCoeff ) setTransform( aTransform ); myIsTransforming = false; @@@ -973,6 -1031,38 +1042,41 @@@ void GraphicsView_ViewPort::applyTransf anObject->setViewTransform( transform() ); } + //================================================================ + // Function : setZoomCoeff + // Purpose : + //================================================================ + void GraphicsView_ViewPort::setZoomCoeff( const int& theZoomCoeff ) + { + myZoomCoeff = theZoomCoeff; + } + + //================================================================ + // Function : setUnlimitedPanning + // Purpose : + //================================================================ + void GraphicsView_ViewPort::setUnlimitedPanning( const bool& theValue ) + { ++ if ( myUnlimitedPanning == theValue ) ++ return; ++ + myUnlimitedPanning = theValue; + + if( myUnlimitedPanning ) + { + myHBarPolicy = horizontalScrollBarPolicy(); + myVBarPolicy = verticalScrollBarPolicy(); + + setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); + setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn ); + } + else + { + setHorizontalScrollBarPolicy( myHBarPolicy ); + setVerticalScrollBarPolicy( myVBarPolicy ); + } + } + //================================================================ // Function : currentBlock // Purpose : diff --cc src/SUIT/resources/SUIT_msg_fr.ts index d3785c28d,d3785c28d..97f2cf33d --- a/src/SUIT/resources/SUIT_msg_fr.ts +++ b/src/SUIT/resources/SUIT_msg_fr.ts @@@ -160,4 -160,4 +160,15 @@@ Voulez-vous l'écraser ?Tous les fichiers (*) ++ ++ SUIT_ViewWindow ++ ++ TLT_DUMP_VIEW ++ Enregistrer la vue dans le fichier ++ ++ ++ TLT_IMAGE_FILES ++ Fichiers images (*.bmp *.png *.jpg *.jpeg) ++ ++ diff --cc src/SUIT/resources/SUIT_msg_ja.ts index f641779cf,f641779cf..8da7266db --- a/src/SUIT/resources/SUIT_msg_ja.ts +++ b/src/SUIT/resources/SUIT_msg_ja.ts @@@ -154,4 -154,4 +154,15 @@@ すべてのファイル (*) ++ ++ SUIT_ViewWindow ++ ++ TLT_DUMP_VIEW ++ ビューでファイルを保存します。 ++ ++ ++ TLT_IMAGE_FILES ++ イメージ (*.bmp *.png *.jpg *.jpeg) ファイル ++ ++