From 299eb5dd4e42aa43c9e06dc1705cb8aa946d20d4 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 6 Nov 2013 09:49:34 +0000 Subject: [PATCH] Fields editing dialog box: enable component renaming --- src/EntityGUI/EntityGUI_FieldDlg.cxx | 20 ++++++++++++++++++++ src/EntityGUI/EntityGUI_FieldDlg.h | 5 +++-- src/GEOMGUI/GEOM_msg_en.ts | 8 ++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/EntityGUI/EntityGUI_FieldDlg.cxx b/src/EntityGUI/EntityGUI_FieldDlg.cxx index d6465df75..9b546f543 100644 --- a/src/EntityGUI/EntityGUI_FieldDlg.cxx +++ b/src/EntityGUI/EntityGUI_FieldDlg.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -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 : diff --git a/src/EntityGUI/EntityGUI_FieldDlg.h b/src/EntityGUI/EntityGUI_FieldDlg.h index 01dd762ff..bd66cbb71 100644 --- a/src/EntityGUI/EntityGUI_FieldDlg.h +++ b/src/EntityGUI/EntityGUI_FieldDlg.h @@ -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 diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index d8efb145b..6161eb27f 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -6010,6 +6010,14 @@ Number of sketch points too small WHOLE_SHAPE_VHEADER Shape + + RENAME_COMPONENT + Change component name + + + COMPONENT_NAME + Name: + MeasureGUI_1Sel1TextView1Check_QTD