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 <QGroupBox>
#include <QHeaderView>
#include <QInputDialog>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
@ -373,6 +374,8 @@ EntityGUI_FieldDlg::StepTable::StepTable (int stepID, int dataType,
// set edit triggers by default
setReadOnly( false );
connect( horizontalHeader(), SIGNAL( sectionDoubleClicked( int ) ), this, SLOT( headerDblClicked( int ) ) );
if ( stepVar->_is_nil() )
return;
@ -758,6 +761,23 @@ void EntityGUI_FieldDlg::StepTable::setValues(GEOM::GEOM_FieldStep_var& step)
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
//purpose :

View File

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

View File

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