From: vsr Date: Sat, 1 Nov 2008 11:07:41 +0000 (+0000) Subject: Improve SALOME style handling X-Git-Tag: V5_1_0rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2a175c2484efd9c644dad702038ec10d24ffedd4;p=modules%2Fgui.git Improve SALOME style handling --- diff --git a/src/Style/Style_PrefDlg.cxx b/src/Style/Style_PrefDlg.cxx index 32713dd75..3dd264117 100644 --- a/src/Style/Style_PrefDlg.cxx +++ b/src/Style/Style_PrefDlg.cxx @@ -37,9 +37,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -483,7 +485,7 @@ void Style_PrefDlg::PaletteEditor::onAuto() \param parent parent widget */ Style_PrefDlg::Style_PrefDlg( QWidget* parent ) - : QtxDialog( parent, true, true, OK | Close | Apply | Help ), + : QtxDialog( parent, true, true, OK | Close | Apply ), myResMgr( 0 ) { // set title @@ -712,6 +714,29 @@ void Style_PrefDlg::accept() QtxDialog::accept(); } +/*! + \brief Process key press event + \param e key event +*/ +void Style_PrefDlg::keyPressEvent( QKeyEvent* e ) +{ + if ( e->key() == Qt::Key_Delete ) { + QListWidgetItem* item = myStylesList->currentItem(); + if ( item && item->data( TypeRole ).toInt() == User ) { + if ( QMessageBox::question( this, + tr( "Delete user theme" ), + tr( "Remove theme %1?" ).arg( item->text() ), + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes ) == QMessageBox::Yes ) { + resourceMgr()->remove( item->data( NameRole ).toString() ); + resourceMgr()->save(); + delete item; + } + } + } + QtxDialog::keyPressEvent( e ); +} + /*! \brief Get SALOME themes resource manager \return themes resource manager diff --git a/src/Style/Style_PrefDlg.h b/src/Style/Style_PrefDlg.h index 73972665d..4b6f6dbde 100644 --- a/src/Style/Style_PrefDlg.h +++ b/src/Style/Style_PrefDlg.h @@ -59,6 +59,9 @@ public: void accept(); +protected: + void keyPressEvent( QKeyEvent* ); + private: Style_ResourceMgr* resourceMgr(); void fromModel( Style_Model* );