mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-22 12:00:33 +05:00
0021179: EDF 1654 SMESH GEOM: better look'n'feel
Additional fix of bug: impossible to remove user's materials
This commit is contained in:
parent
ce8009fe71
commit
dbca9b56bb
@ -427,6 +427,7 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
setButtonPosition( Right, Close );
|
setButtonPosition( Right, Close );
|
||||||
setDialogFlags( AlignOnce );
|
setDialogFlags( AlignOnce );
|
||||||
myMaterialList->setEditTriggers( QAbstractItemView::EditKeyPressed );
|
myMaterialList->setEditTriggers( QAbstractItemView::EditKeyPressed );
|
||||||
|
myMaterialList->installEventFilter( this );
|
||||||
|
|
||||||
// ! RESOURCES
|
// ! RESOURCES
|
||||||
QStringList globalMaterials = resourceMgr()->materials( Material_ResourceMgr::Global );
|
QStringList globalMaterials = resourceMgr()->materials( Material_ResourceMgr::Global );
|
||||||
@ -574,23 +575,26 @@ void GEOMToolsGUI_MaterialPropertiesDlg::accept()
|
|||||||
\brief Process key press event
|
\brief Process key press event
|
||||||
\param e key 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 ) {
|
||||||
QListWidgetItem* item = myMaterialList->currentItem();
|
QKeyEvent* ke = (QKeyEvent*)e;
|
||||||
if ( item && item->data( TypeRole ).toInt() == User ) {
|
if ( ke->key() == Qt::Key_Delete ) {
|
||||||
if ( QMessageBox::question( this,
|
QListWidgetItem* item = myMaterialList->currentItem();
|
||||||
tr( "Delete user material" ),
|
if ( item && item->data( TypeRole ).toInt() == User ) {
|
||||||
tr( "Remove material %1?" ).arg( item->text() ),
|
if ( QMessageBox::question( this,
|
||||||
QMessageBox::Yes | QMessageBox::No,
|
tr( "Delete user material" ),
|
||||||
QMessageBox::Yes ) == QMessageBox::Yes ) {
|
tr( "Remove material %1?" ).arg( item->text() ),
|
||||||
resourceMgr()->remove( item->data( NameRole ).toString() );
|
QMessageBox::Yes | QMessageBox::No,
|
||||||
resourceMgr()->save();
|
QMessageBox::Yes ) == QMessageBox::Yes ) {
|
||||||
delete item;
|
resourceMgr()->remove( item->data( NameRole ).toString() );
|
||||||
|
resourceMgr()->save();
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtxDialog::keyPressEvent( e );
|
return QtxDialog::eventFilter( o, e );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -63,8 +63,7 @@ public:
|
|||||||
|
|
||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
protected:
|
bool eventFilter( QObject*, QEvent* );
|
||||||
void keyPressEvent( QKeyEvent* );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Material_ResourceMgr* resourceMgr();
|
Material_ResourceMgr* resourceMgr();
|
||||||
|
Loading…
Reference in New Issue
Block a user