Commit de048313 authored by Dirk Wilden's avatar Dirk Wilden

added materialProperties to contextMenu

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5769 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b5a6a8a8
......@@ -51,7 +51,7 @@
#include <queue>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
//******************************************************************************
......@@ -87,6 +87,11 @@ void DataControlPlugin::pluginsInitialized() {
emit addContextMenuItem(contextMenu->menuAction() , DATA_ALL , CONTEXTOBJECTMENU);
QIcon icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
QAction* material = new QAction(icon, "Material Properties", 0);
connect (material, SIGNAL( triggered() ), this, SLOT ( slotMaterialProperties() ));
emit addContextMenuItem(material , DATA_ALL , CONTEXTOBJECTMENU);
}
......
......@@ -426,13 +426,33 @@ void DataControlPlugin::slotRename(){
*
*/
void DataControlPlugin::slotMaterialProperties(){
QItemSelectionModel* selection = view_->selectionModel();
// Get all selected rows
QModelIndexList indexList = selection->selectedRows ( 0 );
int selectedRows = indexList.size();
if (selectedRows == 1){
BaseObject* item = model_->getItem( indexList[0]);
BaseObject* item = 0;
//check if it was called from object contextMenu or from the toolBox
QAction* action = dynamic_cast< QAction* > ( sender() );
if ( action ){
bool ok = false;
int id = action->data().toInt(&ok);
if ( ok && id > 0 )
PluginFunctions::getObject(id,item);
}
if ( item == 0 ){
// the slot was called from toolbox
QItemSelectionModel* selection = view_->selectionModel();
// Get all selected rows
QModelIndexList indexList = selection->selectedRows ( 0 );
int selectedRows = indexList.size();
if (selectedRows == 1)
item = model_->getItem( indexList[0] );
}
if ( item != 0 ){
BaseObjectData* itemData = dynamic_cast< BaseObjectData* > (item);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment