Commit 83eb9950 authored by Dirk Wilden's avatar Dirk Wilden

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7825 383ad7c9-94d9-4d36-a494-682f7c89f535
parent a0a70377
......@@ -89,6 +89,16 @@ void DataControlPlugin::slotContextMenuSource( ) {
object->source( sourceAction_->isChecked() );
}
void DataControlPlugin::slotContextMenuRemove( ) {
QVariant contextObject = sourceAction_->data();
int objectId = contextObject.toInt();
if ( objectId == -1)
return;
emit deleteObject( objectId );
}
void DataControlPlugin::slotUpdateContextMenu( int _objectId) {
if ( _objectId == -1)
return;
......
......@@ -80,31 +80,44 @@ void DataControlPlugin::pluginsInitialized() {
//set the slot descriptions
setDescriptions();
QMenu* contextMenu = new QMenu("Object selection");
QMenu* contextMenu = new QMenu("Object");
//Target Objects
QAction* hideAction = new QAction(tr("&Hide"), this);
QIcon icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-hide-object.png");
QAction* hideAction = new QAction(icon, tr("&Hide"), this);
hideAction->setStatusTip(tr("Hide object"));
connect(hideAction, SIGNAL(triggered()), this, SLOT(slotContextMenuHide()) );
contextMenu->addAction(hideAction);
//Target Objects
targetAction_ = new QAction(tr("&target"), this);
icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-target-object.png");
targetAction_ = new QAction(icon, tr("&Target"), this);
targetAction_->setCheckable(true);
targetAction_->setStatusTip(tr("Set object as target"));
connect(targetAction_, SIGNAL(triggered()), this, SLOT(slotContextMenuTarget()) );
contextMenu->addAction(targetAction_);
//Source Objects
sourceAction_ = new QAction(tr("&source"), this);
icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-source-object.png");
sourceAction_ = new QAction(icon, tr("&Source"), this);
sourceAction_->setCheckable(true);
sourceAction_->setStatusTip(tr("Set object as source"));
connect(sourceAction_, SIGNAL(triggered()), this, SLOT(slotContextMenuSource()) );
contextMenu->addAction(sourceAction_);
contextMenu->addSeparator();
//Remove Objects
icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-delete-item.png");
removeAction_ = new QAction(icon, tr("&Remove"), this);
removeAction_->setCheckable(false);
removeAction_->setStatusTip(tr("Remove object"));
connect(removeAction_, SIGNAL(triggered()), this, SLOT(slotContextMenuRemove()) );
contextMenu->addAction(removeAction_);
emit addContextMenuItem(contextMenu->menuAction() , DATA_ALL , CONTEXTOBJECTMENU);
QIcon icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
icon = QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"datacontrol-material.png");
QAction* material = new QAction(icon, tr("Material Properties"), 0);
connect (material, SIGNAL( triggered() ), this, SLOT ( slotMaterialProperties() ));
......
......@@ -244,6 +244,9 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
/// Source Selection
void slotContextMenuSource( );
/// Remove Selected Item
void slotContextMenuRemove( );
/// Update the context Menus for the given id
void slotUpdateContextMenu( int _objectId);
......@@ -251,6 +254,7 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
private :
QAction* targetAction_;
QAction* sourceAction_;
QAction* removeAction_;
/** @} */
......
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