Commit e054be93 authored by Marcel Campen's avatar Marcel Campen
Browse files

New Draw Mode Context Menu



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13558 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 285fb426
...@@ -81,6 +81,10 @@ void CoreWidget::slotCustomContextMenu( const QPoint& _point ) { ...@@ -81,6 +81,10 @@ void CoreWidget::slotCustomContextMenu( const QPoint& _point ) {
} }
void CoreWidget::slotHideContextMenu() {
contextMenu_->hide();
}
/** \brief Update context Menu when an arbitrary node has been clicked on. /** \brief Update context Menu when an arbitrary node has been clicked on.
* *
* This function is called when a node has been clicked on not belonging to an object. * This function is called when a node has been clicked on not belonging to an object.
...@@ -868,9 +872,12 @@ void CoreWidget::slotUpdateViewerDrawMenu() { ...@@ -868,9 +872,12 @@ void CoreWidget::slotUpdateViewerDrawMenu() {
ACG::SceneGraph::DrawModes::DrawMode id = availDrawModeIds[i]; ACG::SceneGraph::DrawModes::DrawMode id = availDrawModeIds[i];
std::string descr = id.description(); std::string descr = id.description();
QAction * action = new QAction( descr.c_str(), drawGroupViewer_ ); QCheckBox *checkBox = new QCheckBox(QString(descr.c_str()), viewerDrawMenu_);
action->setCheckable( true ); checkBox->setChecked(activeDrawModes.containsAtomicDrawMode(id));
action->setChecked( activeDrawModes.containsAtomicDrawMode(id) ); QWidgetAction *checkableAction = new QWidgetAction(drawGroupViewer_);
checkableAction->setText(descr.c_str());
checkableAction->setDefaultWidget(checkBox);
connect(checkBox, SIGNAL(toggled(bool) ), checkableAction, SLOT(trigger() ) );
} }
viewerDrawMenu_->addActions( drawGroupViewer_->actions() ); viewerDrawMenu_->addActions( drawGroupViewer_->actions() );
...@@ -898,7 +905,10 @@ void CoreWidget::slotViewerDrawMenu(QAction * _action) { ...@@ -898,7 +905,10 @@ void CoreWidget::slotViewerDrawMenu(QAction * _action) {
if ( qApp->keyboardModifiers() & Qt::ShiftModifier ) if ( qApp->keyboardModifiers() & Qt::ShiftModifier )
PluginFunctions::viewerProperties().drawMode( PluginFunctions::viewerProperties().drawMode() ^ mode ); PluginFunctions::viewerProperties().drawMode( PluginFunctions::viewerProperties().drawMode() ^ mode );
else else
{
contextMenu_->hide();
PluginFunctions::viewerProperties().drawMode(mode ); PluginFunctions::viewerProperties().drawMode(mode );
}
} }
......
...@@ -109,6 +109,11 @@ ...@@ -109,6 +109,11 @@
* This struct contains a ViewMode and its status information such as used widgets,toolbars or context menus * This struct contains a ViewMode and its status information such as used widgets,toolbars or context menus
* *
*/ */
struct ViewMode{ struct ViewMode{
/// Name of the View Mode /// Name of the View Mode
...@@ -569,6 +574,9 @@ public: ...@@ -569,6 +574,9 @@ public:
/// Hide or show the View Mode controls /// Hide or show the View Mode controls
void showViewModeControls(bool _show); void showViewModeControls(bool _show);
/// Hide the context menu
void slotHideContextMenu();
private slots: private slots:
/// Remove viewMode /// Remove viewMode
void slotRemoveViewMode(QString _name); void slotRemoveViewMode(QString _name);
......
...@@ -158,7 +158,6 @@ void CoreWidget::keyReleaseEvent(QKeyEvent* _e) { ...@@ -158,7 +158,6 @@ void CoreWidget::keyReleaseEvent(QKeyEvent* _e) {
if (_e->isAutoRepeat()) return; //consider only "real" release events if (_e->isAutoRepeat()) return; //consider only "real" release events
std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() ); std::pair< int,Qt::KeyboardModifiers > key = std::make_pair(_e->key(), _e->modifiers() );
//iterate over all assigned keys //iterate over all assigned keys
......
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