0021179: EDF 1654 SMESH GEOM: better look'n'feel

Additional fix of bug: impossible to remove user's materials
This commit is contained in:
vsr 2012-02-21 16:21:15 +00:00
parent ce8009fe71
commit dbca9b56bb
2 changed files with 18 additions and 15 deletions

View File

@ -427,6 +427,7 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
setButtonPosition( Right, Close );
setDialogFlags( AlignOnce );
myMaterialList->setEditTriggers( QAbstractItemView::EditKeyPressed );
myMaterialList->installEventFilter( this );
// ! RESOURCES
QStringList globalMaterials = resourceMgr()->materials( Material_ResourceMgr::Global );
@ -574,9 +575,11 @@ void GEOMToolsGUI_MaterialPropertiesDlg::accept()
\brief Process key press event
\param e key event
*/
void GEOMToolsGUI_MaterialPropertiesDlg::keyPressEvent( QKeyEvent* e )
bool GEOMToolsGUI_MaterialPropertiesDlg::eventFilter( QObject* o, QEvent* e )
{
if ( e->key() == Qt::Key_Delete ) {
if ( o == myMaterialList && e->type() == QEvent::KeyPress ) {
QKeyEvent* ke = (QKeyEvent*)e;
if ( ke->key() == Qt::Key_Delete ) {
QListWidgetItem* item = myMaterialList->currentItem();
if ( item && item->data( TypeRole ).toInt() == User ) {
if ( QMessageBox::question( this,
@ -590,7 +593,8 @@ void GEOMToolsGUI_MaterialPropertiesDlg::keyPressEvent( QKeyEvent* e )
}
}
}
QtxDialog::keyPressEvent( e );
}
return QtxDialog::eventFilter( o, e );
}
/*!

View File

@ -63,8 +63,7 @@ public:
void accept();
protected:
void keyPressEvent( QKeyEvent* );
bool eventFilter( QObject*, QEvent* );
private:
Material_ResourceMgr* resourceMgr();