X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_TwoImagesDlg.cxx;h=145db26b49c28aff3a077a5aa9e9597692d58cdf;hb=0006900f9b7798b199a295169d0d798ecaad6340;hp=bca023a37ef3ee71ff29f1eeb4d08fcbb805c992;hpb=2c0190ec7d043f0a9835d9e67e89859033ec953f;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx index bca023a3..145db26b 100644 --- a/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_TwoImagesDlg.cxx @@ -22,9 +22,11 @@ #include "HYDROGUI_TwoImagesDlg.h" -#include "HYDROGUI_ObjSelector.h" #include "HYDROGUI_ColorWidget.h" +#include "HYDROGUI_ObjSelector.h" +#include +#include #include #include #include @@ -32,36 +34,108 @@ HYDROGUI_TwoImagesDlg::HYDROGUI_TwoImagesDlg( HYDROGUI_Module* theModule, const QString& theTitle ) : HYDROGUI_InputPanel( theModule, theTitle ) { - myName = new QLineEdit(); - myImage1 = new HYDROGUI_ObjSelector( module(), 0 ); - myImage2 = new HYDROGUI_ObjSelector( module(), 0 ); - myTransparent = new QRadioButton( tr( "TRANSPARENT" ) ); + // Image name + QGroupBox* anImageNameGroup = new QGroupBox( tr( "IMAGE_NAME" ) ); + + QLabel* anImageNameLabel = new QLabel( tr( "NAME" ), anImageNameGroup ); + myImageName = new QLineEdit( anImageNameGroup ); + + QBoxLayout* anImageNameLayout = new QHBoxLayout( anImageNameGroup ); + anImageNameLayout->setMargin( 5 ); + anImageNameLayout->setSpacing( 5 ); + anImageNameLayout->addWidget( anImageNameLabel ); + anImageNameLayout->addWidget( myImageName ); + + // Image name + QGroupBox* aParamGroup = new QGroupBox( tr( "PARAMETERS" ) ); + + QLabel* anImage1Label = new QLabel( tr( "IMAGE_1" ), aParamGroup ); + myImage1 = new HYDROGUI_ObjSelector( theModule, aParamGroup ); + + QLabel* anImage2Label = new QLabel( tr( "IMAGE_2" ), aParamGroup ); + myImage2 = new HYDROGUI_ObjSelector( theModule, aParamGroup ); + + QFrame* aBackgroundFrame = new QFrame( aParamGroup ); + QLabel* aBackgroundLabel = new QLabel( tr( "BACKGROUND" ), aBackgroundFrame ); + myTransparent = new QRadioButton( tr( "TRANSPARENT" ), aBackgroundFrame ); myTransparent->setChecked( true ); - myColor = new QRadioButton( tr( "COLOR" ) ); - myColorBox = new HYDROGUI_ColorWidget( 0 ); - - addWidget( tr( "NAME" ), myName ); - addSeparator(); - addWidget( tr( "IMAGE_1" ), myImage1 ); - addWidget( tr( "IMAGE_2" ), myImage2 ); - - QFrame* aBackground = new QFrame(); - QGridLayout* aLayout = new QGridLayout( aBackground ); - aLayout->addWidget( myTransparent, 0, 0 ); - aLayout->addWidget( myColor, 1, 0 ); - aLayout->addWidget( myColorBox, 1, 1 ); - - addWidget( tr( "BACKGROUND" ), aBackground ); - addSeparator(); - setRowStretch(); + myColor = new QRadioButton( tr( "COLOR" ), aBackgroundFrame ); + myColorBox = new HYDROGUI_ColorWidget( aBackgroundFrame ); + + QGridLayout* aBackgroundLayout = new QGridLayout( aBackgroundFrame ); + aBackgroundLayout->setMargin( 0 ); + aBackgroundLayout->setSpacing( 5 ); + aBackgroundLayout->addWidget( aBackgroundLabel, 0, 0, 2, 1 ); + aBackgroundLayout->addWidget( myTransparent, 0, 1 ); + aBackgroundLayout->addWidget( myColor, 1, 1 ); + aBackgroundLayout->addWidget( myColorBox, 1, 2 ); + + QGridLayout* aParamLayout = new QGridLayout( aParamGroup ); + aParamLayout->setMargin( 5 ); + aParamLayout->setSpacing( 5 ); + aParamLayout->addWidget( anImage1Label, 0, 0 ); + aParamLayout->addWidget( myImage1, 0, 1 ); + aParamLayout->addWidget( anImage2Label, 1, 0 ); + aParamLayout->addWidget( myImage2, 1, 1 ); + aParamLayout->addWidget( aBackgroundFrame, 2, 0, 1, 2 ); + + // Common + addWidget( anImageNameGroup ); + addWidget( aParamGroup ); + addStretch(); } HYDROGUI_TwoImagesDlg::~HYDROGUI_TwoImagesDlg() { } -void HYDROGUI_TwoImagesDlg::GetSelectedImages( QString& theName1, QString& theName2 ) const +void HYDROGUI_TwoImagesDlg::reset() +{ + myImageName->clear(); + myImage1->Clear(); + myImage2->Clear(); + myTransparent->setChecked( true ); + myColorBox->resetColor(); +} + +void HYDROGUI_TwoImagesDlg::setImageName( const QString& theName ) +{ + myImageName->setText( theName ); +} + +QString HYDROGUI_TwoImagesDlg::getImageName() const +{ + return myImageName->text(); +} + +void HYDROGUI_TwoImagesDlg::setSelectedImages( const QString& theName1, + const QString& theName2 ) +{ + myImage1->SetName( theName1 ); + myImage2->SetName( theName2 ); +} + +bool HYDROGUI_TwoImagesDlg::getSelectedImages( QString& theName1, + QString& theName2 ) const { theName1 = myImage1->GetName(); theName2 = myImage2->GetName(); + return !theName1.isEmpty() && !theName2.isEmpty(); +} + +void HYDROGUI_TwoImagesDlg::setColor( const QColor& theColor ) +{ + if( theColor.alpha() == 0 ) // transparent + myTransparent->setChecked( true ); + else + myColor->setChecked( true ); + myColorBox->setColor( theColor ); +} + +QColor HYDROGUI_TwoImagesDlg::getColor() const +{ + QColor aColor( 255, 255, 255, 0 ); // transparent + if( myColor->isChecked() ) + aColor = myColorBox->color(); + return aColor; }