Fields editing dialog box: enable component renaming

This commit is contained in:
vsr 2013-11-06 09:49:34 +00:00
parent 99f560d637
commit 299eb5dd4e
3 changed files with 31 additions and 2 deletions

View File

@ -55,6 +55,7 @@
#include <QGridLayout> #include <QGridLayout>
#include <QGroupBox> #include <QGroupBox>
#include <QHeaderView> #include <QHeaderView>
#include <QInputDialog>
#include <QLabel> #include <QLabel>
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
@ -373,6 +374,8 @@ EntityGUI_FieldDlg::StepTable::StepTable (int stepID, int dataType,
// set edit triggers by default // set edit triggers by default
setReadOnly( false ); setReadOnly( false );
connect( horizontalHeader(), SIGNAL( sectionDoubleClicked( int ) ), this, SLOT( headerDblClicked( int ) ) );
if ( stepVar->_is_nil() ) if ( stepVar->_is_nil() )
return; return;
@ -758,6 +761,23 @@ void EntityGUI_FieldDlg::StepTable::setValues(GEOM::GEOM_FieldStep_var& step)
return; return;
} }
//=======================================================================
//function : headerDblClicked
//purpose : rename column, called when used double-clicks on the header
//=======================================================================
void EntityGUI_FieldDlg::StepTable::headerDblClicked( int section )
{
if ( section > 0 ) {
bool bOk;
QString label = QInputDialog::getText( this, EntityGUI_FieldDlg::tr( "RENAME_COMPONENT" ),
EntityGUI_FieldDlg::tr ( "COMPONENT_NAME" ), QLineEdit::Normal,
horizontalHeaderItem( section )->text(), &bOk );
if ( bOk && !label.isEmpty() )
horizontalHeaderItem( section )->setText( label );
}
}
//======================================================================= //=======================================================================
//function : EntityGUI_FieldDlg //function : EntityGUI_FieldDlg
//purpose : //purpose :

View File

@ -59,7 +59,6 @@ class EntityGUI_FieldDlg : public GEOMBase_Skeleton
class Delegate; class Delegate;
public: public:
EntityGUI_FieldDlg (GeometryGUI* theGeometryGUI, EntityGUI_FieldDlg (GeometryGUI* theGeometryGUI,
GEOM::GEOM_Field_ptr theField, int stepID=0, GEOM::GEOM_Field_ptr theField, int stepID=0,
QWidget* parent=0, QWidget* parent=0,
@ -105,7 +104,6 @@ private:
int getSelectedSubshapes (TColStd_IndexedMapOfInteger& map); int getSelectedSubshapes (TColStd_IndexedMapOfInteger& map);
private: private:
bool myIsCreation; bool myIsCreation;
GEOM::GEOM_Field_var myField; GEOM::GEOM_Field_var myField;
GEOM::GEOM_Object_var myShape; GEOM::GEOM_Object_var myShape;
@ -153,6 +151,7 @@ class EntityGUI_FieldDlg::StepTable : public QTableWidget
bool myIsChanged; bool myIsChanged;
QTableWidgetItem * newDefaultItem(); QTableWidgetItem * newDefaultItem();
public: public:
StepTable( int stepID, int dataType, int nbRows, int nbColumns, StepTable( int stepID, int dataType, int nbRows, int nbColumns,
QString shapeName, QStringList headers, QString shapeName, QStringList headers,
@ -183,8 +182,10 @@ public:
void setHeaders(const QStringList& headers); void setHeaders(const QStringList& headers);
GEOM::GEOM_FieldStep_var getStep() { return myStep; } GEOM::GEOM_FieldStep_var getStep() { return myStep; }
void setValues(GEOM::GEOM_FieldStep_var& step); void setValues(GEOM::GEOM_FieldStep_var& step);
public slots: public slots:
void setIsChanged() { myIsChanged = true; } void setIsChanged() { myIsChanged = true; }
void headerDblClicked( int );
}; };
#endif #endif

View File

@ -6010,6 +6010,14 @@ Number of sketch points too small</translation>
<source>WHOLE_SHAPE_VHEADER</source> <source>WHOLE_SHAPE_VHEADER</source>
<translation>Shape</translation> <translation>Shape</translation>
</message> </message>
<message>
<source>RENAME_COMPONENT</source>
<translation>Change component name</translation>
</message>
<message>
<source>COMPONENT_NAME</source>
<translation>Name:</translation>
</message>
</context> </context>
<context> <context>
<name>MeasureGUI_1Sel1TextView1Check_QTD</name> <name>MeasureGUI_1Sel1TextView1Check_QTD</name>