Fix for bugs IPAL11916, IPAL11917.

This commit is contained in:
mzn 2006-03-29 11:38:10 +00:00
parent ef1f1f4c8e
commit d4b9879cc4
2 changed files with 25 additions and 28 deletions

View File

@ -76,6 +76,8 @@
#include <qmemarray.h> #include <qmemarray.h>
#include <qwidgetstack.h> #include <qwidgetstack.h>
#include <QtxIntSpinBox.h>
// STL includes // STL includes
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
@ -303,24 +305,19 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) ); myWGStack->addWidget( wg2, myGrpTypeGroup->id(rb2) );
/***************************************************************/ /***************************************************************/
QGroupBox* aColorBox = new QGroupBox(this, "color box"); QGroupBox* aColorBox = new QGroupBox(2, Qt::Horizontal, this, "color box");
aColorBox->setTitle(tr("SMESH_SET_COLOR")); aColorBox->setTitle(tr("SMESH_SET_COLOR"));
mySelectColorGroup = new QCheckBox(aColorBox, "color checkbox"); mySelectColorGroup = new QCheckBox(aColorBox, "color checkbox");
mySelectColorGroup->setText(tr("SMESH_CHECK_COLOR")); mySelectColorGroup->setText(tr("SMESH_CHECK_COLOR"));
mySelectColorGroup->setMinimumSize(50, 0);
myColorGroupLine = new QLineEdit(aColorBox, "color line"); myColorSpinBox = new QtxIntSpinBox( aColorBox );
myColorGroupLine->setReadOnly(false); myColorSpinBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
myColorSpinBox->setMinValue( 0 );
myColorSpinBox->setMaxValue( 9999 );
onSelectColorGroup(false); onSelectColorGroup(false);
/***************************************************************/
QHBoxLayout* aColorLayout = new QHBoxLayout(aColorBox, 15, 20);
aColorLayout->setAutoAdd(false);
aColorLayout->addWidget(mySelectColorGroup);
aColorLayout->addWidget(myColorGroupLine);
/***************************************************************/ /***************************************************************/
QFrame* aButtons = new QFrame(this, "button box"); QFrame* aButtons = new QFrame(this, "button box");
@ -382,7 +379,7 @@ void SMESHGUI_GroupDlg::initDialog(bool create)
connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); connect(myGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection())); connect(myGeomGroupBtn, SIGNAL(clicked()), this, SLOT(setCurrentSelection()));
connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool))); connect(mySelectColorGroup, SIGNAL(toggled(bool)), this, SLOT(onSelectColorGroup(bool)));
connect(myColorGroupLine, SIGNAL(textChanged(const QString&)), this, SLOT(onNbColorsChanged(const QString&))); connect(myColorSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(onNbColorsChanged(const QString&)));
connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK())); connect(aOKBtn, SIGNAL(clicked()), this, SLOT(onOK()));
connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply())); connect(aApplyBtn, SIGNAL(clicked()), this, SLOT(onApply()));
@ -467,9 +464,8 @@ void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
myName->setText(theGroup->GetName()); myName->setText(theGroup->GetName());
myName->home(false); myName->home(false);
myColorGroupLine->setText(QString::number(theGroup->GetColorNumber())); myColorSpinBox->setValue( theGroup->GetColorNumber() );
myColorGroupLine->home(false);
myMeshGroupLine->setText(theGroup->GetName()); myMeshGroupLine->setText(theGroup->GetName());
int aType = 0; int aType = 0;
@ -685,25 +681,25 @@ bool SMESHGUI_GroupDlg::onApply()
myGroup = SMESH::AddGroup(myMesh, aType, myName->text()); myGroup = SMESH::AddGroup(myMesh, aType, myName->text());
myGroup->Add(anIdList.inout()); myGroup->Add(anIdList.inout());
int aColorNumber = myColorGroupLine->text().toInt(); int aColorNumber = myColorSpinBox->value();
myGroup->SetColorNumber(aColorNumber); myGroup->SetColorNumber(aColorNumber);
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup); _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup);
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text()); SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP"); SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
/* init for next operation */ /* init for next operation */
myName->setText(""); myName->setText("");
myColorGroupLine->setText(""); myColorSpinBox->setValue(0);
myElements->clear(); myElements->clear();
myGroup = SMESH::SMESH_Group::_nil(); myGroup = SMESH::SMESH_Group::_nil();
} else { } else {
myGroup->SetName(myName->text()); myGroup->SetName(myName->text());
int aColorNumber = myColorGroupLine->text().toInt(); int aColorNumber = myColorSpinBox->value();
myGroup->SetColorNumber(aColorNumber); myGroup->SetColorNumber(aColorNumber);
QValueList<int> aAddList; QValueList<int> aAddList;
@ -762,25 +758,25 @@ bool SMESHGUI_GroupDlg::onApply()
myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup); myGroupOnGeom = myMesh->CreateGroupFromGEOM(aType, myName->text(),myGeomGroup);
int aColorNumber = myColorGroupLine->text().toInt(); int aColorNumber = myColorSpinBox->value();
myGroupOnGeom->SetColorNumber(aColorNumber); myGroupOnGeom->SetColorNumber(aColorNumber);
_PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom); _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom);
SMESH::setFileName (aMeshGroupSO, myColorGroupLine->text()); SMESH::setFileName ( aMeshGroupSO, QString::number(myColorSpinBox->value()) );
SMESH::setFileType (aMeshGroupSO,"COULEURGROUP"); SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
/* init for next operation */ /* init for next operation */
myName->setText(""); myName->setText("");
myColorGroupLine->setText(""); myColorSpinBox->setValue(0);
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
} }
else else
{ {
myGroupOnGeom->SetName(myName->text()); myGroupOnGeom->SetName(myName->text());
int aColorNumber = myColorGroupLine->text().toInt(); int aColorNumber = myColorSpinBox->value();
myGroupOnGeom->SetColorNumber(aColorNumber); myGroupOnGeom->SetColorNumber(aColorNumber);
} }
@ -1123,12 +1119,12 @@ void SMESHGUI_GroupDlg::onSelectColorGroup(bool on)
setSelectionMode(7); setSelectionMode(7);
} }
else { else {
myColorGroupLine->setText(""); myColorSpinBox->setValue(0);
myCurrentLineEdit = 0; myCurrentLineEdit = 0;
if (myTypeId != -1) if (myTypeId != -1)
setSelectionMode(myTypeId); setSelectionMode(myTypeId);
} }
myColorGroupLine->setEnabled(on); myColorSpinBox->setEnabled(on);
} }
//================================================================================= //=================================================================================

View File

@ -48,6 +48,7 @@ class QListBox;
class QPushButton; class QPushButton;
class QCheckBox; class QCheckBox;
class QWidgetStack; class QWidgetStack;
class QtxIntSpinBox;
class SMESHGUI; class SMESHGUI;
class SMESH_Actor; class SMESH_Actor;
class SMESHGUI_FilterDlg; class SMESHGUI_FilterDlg;
@ -145,7 +146,7 @@ private:
QLineEdit* myGroupLine; QLineEdit* myGroupLine;
QCheckBox* mySelectColorGroup; QCheckBox* mySelectColorGroup;
QLineEdit* myColorGroupLine; QtxIntSpinBox* myColorSpinBox;
QCheckBox* mySelectGeomGroup; QCheckBox* mySelectGeomGroup;
QPushButton* myGeomGroupBtn; QPushButton* myGeomGroupBtn;