From: gdd Date: Mon, 26 Apr 2010 12:00:32 +0000 (+0000) Subject: Remove unnecessary widget X-Git-Tag: V5_1_4rc1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=66a968300f9abb0a1ba0e059e2fda4f7e24be246;p=modules%2Fgeom.git Remove unnecessary widget Picture aspect ratio is preserved --- diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index 846a34a28..ba3daed37 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -65,10 +65,11 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI myMainLayout->setMargin(0); myMainLayout->setSpacing(6); - PictureView = new DlgRef_PipeTShape_ScrollArea(); - PictureView->PipeTShape->setBackgroundRole(QPalette::Base); - PictureView->PipeTShape->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); - PictureView->PipeTShape->setScaledContents(true); + tshapeScreenShotLabel = new QLabel(); + tshapeScreenShotLabel->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Expanding); + tshapeScreenShotLabel->setAlignment(Qt::AlignCenter); + tshapeScreenShotLabel->setMinimumSize(240, 304); MainTubeGroupParams = new DlgRef_3Spin(); MainTubeGroupParams->GroupBox1->setTitle(tr("GEOM_PIPE_TSHAPE_MPIPE")); @@ -147,7 +148,7 @@ AdvancedGUI_PipeTShapeDlg::AdvancedGUI_PipeTShapeDlg(GeometryGUI* theGeometryGUI // 2nd row, height = 4, col 3 int rowNewPosVal = rowspanPict, colNewPosVal = 2, rowspanNewPosVal = 4, colspanNewPosVal = 1; - myMainLayout->addWidget(PictureView, rowPict, colPict, rowspanPict, colspanPict); + myMainLayout->addWidget(tshapeScreenShotLabel, rowPict, colPict, rowspanPict, colspanPict); myMainLayout->addWidget(MainTubeGroupParams, rowMain, colMain, rowspanMain, colspanMain); myMainLayout->addWidget(FilletGroupParams, rowFill, colFill, rowspanFill, colspanFill); @@ -180,9 +181,6 @@ void AdvancedGUI_PipeTShapeDlg::Init() { SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100); - PictureView->PipeTShape->setPixmap(imagePipeTShape); - PictureView->PipeTShape->adjustSize(); - myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil(); myOkPoint1 = myOkPoint2 = myOkPoint3 = false; @@ -250,6 +248,7 @@ void AdvancedGUI_PipeTShapeDlg::Init() { //@@ put additional signal/slot connections here @@// initName(tr("GEOM_PIPE_TSHAPE")); + updateTshapeScreenshotLabel(); DisplayPreview(); } @@ -350,8 +349,7 @@ void AdvancedGUI_PipeTShapeDlg::UpdatePicture(QWidget* old, QWidget* now) { else imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); - PictureView->PipeTShape->setPixmap(imagePipeTShape); - PictureView->PipeTShape->adjustSize(); + updateTshapeScreenshotLabel(); } //================================================================================= @@ -612,6 +610,28 @@ void AdvancedGUI_PipeTShapeDlg::enterEvent(QEvent*) { ActivateThisDialog(); } +//================================================================================= +// function : resizeEvent [REDEFINED] +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::resizeEvent(QResizeEvent */*event*/) { + QSize scaledSize = imagePipeTShape.size(); + scaledSize.scale(tshapeScreenShotLabel->size(), Qt::KeepAspectRatio); + if (!tshapeScreenShotLabel->pixmap() + || scaledSize != tshapeScreenShotLabel->pixmap()->size()) + updateTshapeScreenshotLabel(); +} + +//================================================================================= +// function : updateTshapeScreenshotLabel +// purpose : +//================================================================================= +void AdvancedGUI_PipeTShapeDlg::updateTshapeScreenshotLabel() { + tshapeScreenShotLabel->setPixmap(imagePipeTShape.scaled(tshapeScreenShotLabel->size(), + Qt::KeepAspectRatio, + Qt::SmoothTransformation)); +} + //================================================================================= // function : ChamferOrFillet() // purpose : @@ -628,7 +648,7 @@ void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) { } else imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); - PictureView->PipeTShape->setPixmap(imagePipeTShape); + updateTshapeScreenshotLabel(); if (myOkPoint1 && myOkPoint2 && myOkPoint3) CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); DisplayPreview(); @@ -641,7 +661,7 @@ void AdvancedGUI_PipeTShapeDlg::ChamferOrFillet(bool) { } else imagePipeTShape = SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("DLG_PIPETSHAPE")); - PictureView->PipeTShape->setPixmap(imagePipeTShape); + updateTshapeScreenshotLabel(); if (myOkPoint1 && myOkPoint2 && myOkPoint3) CheckCompatiblePosition(myPoint1, myPoint2, myPoint3, 0.01); DisplayPreview(); diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h index 5f8b93620..e4fece9b9 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.h @@ -27,9 +27,9 @@ class DlgRef_2Spin; class DlgRef_3Spin; class DlgRef_3Sel; class DlgRef_6Sel; -class DlgRef_PipeTShape_ScrollArea; class QCheckBox; class QLineEdit; +class QLabel; //================================================================================= // class : AdvancedGUI_PipeTShapeDlg @@ -52,13 +52,15 @@ protected: private: void Init(); void enterEvent(QEvent*); + void resizeEvent(QResizeEvent *event); + void updateTshapeScreenshotLabel(); bool CheckCompatiblePosition(GEOM::GEOM_Object_var theP1, GEOM::GEOM_Object_var theP2, GEOM::GEOM_Object_var theP3, double theTolerance); private: QPixmap imagePipeTShape; - DlgRef_PipeTShape_ScrollArea* PictureView; + QLabel* tshapeScreenShotLabel; DlgRef_3Spin* MainTubeGroupParams; DlgRef_3Spin* IncidentTubeGroupParams; DlgRef_2Spin* ChamferGroupParams; @@ -66,10 +68,6 @@ private: DlgRef_6Sel* JunctionPointsSel; QPixmap imageImp; QString CssNormal, CssAcceptable, CssRefused; -// QLineEdit* NewPosValL1; -// QLineEdit* NewPosValL2; -// QPushButton* ApplyNewL1; -// QPushButton* ApplyNewL2; QCheckBox* HexMeshCheckBox; GEOM::GEOM_Object_var myPoint1, myPoint2, myPoint3; bool myOkPoint1, myOkPoint2, myOkPoint3;