Commit 9b1a3f18 authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Data can now be selected by a SHIFT + Right click in the 3D view.

parent 649a8f2d
......@@ -1672,7 +1672,7 @@ void GLViewer::mousePressEvent( QMouseEvent *evt )
}
}
m_PrevMousePos = evt->pos();
m_ClickMousePos = m_PrevMousePos = evt->pos();
update();
}
......@@ -1686,6 +1686,10 @@ void GLViewer::mouseReleaseEvent( QMouseEvent *evt )
m_SelectionCurrentTool->mouseReleaseEvent( evt );
updateSelectionMode( evt->modifiers() );
}
else if( evt->button() == Qt::RightButton && evt->pos() == m_ClickMousePos && m_BelowCursor )
{
emit dataSelected( m_BelowCursor->displayable->getSource(), evt->modifiers() );
}
update();
}
......
......@@ -120,6 +120,7 @@ protected:
float m_ShiftSpeedFactor;
QPoint m_PrevMousePos;
QPoint m_ClickMousePos;
FactoryMap m_Factories;
DisplayableMap m_Displayables;
......@@ -338,6 +339,7 @@ signals:
void lightingToggled( const bool lightingEnabled );
void lightTrackingToggled( const bool trackingEnabled );
void keyPressed( QKeyEvent *evt );
void dataSelected( GenericUIData *d, Qt::KeyboardModifiers modifiers );
/************\
| QT slot(s) |
......
......@@ -84,6 +84,35 @@ void UIDataWidget::updateVisibility( QTreeWidgetItem* clickedItem )
}
void UIDataWidget::updateSelection( GenericUIData *d, Qt::KeyboardModifiers modifiers )
{
QList< GenericUIData* > currentSelection = selectedData();
UIDataWidgetItem *dItem = NULL;
if( modifiers & Qt::CTRL )
{
forAllTreeItems( [&]( UIDataWidgetItem *item ){
if( item->getUIData() == d )
{
dItem = item;
item->setSelected( !item->isSelected() );
}
} );
}
else
{
forAllTreeItems( [&]( UIDataWidgetItem *item ){
item->setSelected( item->getUIData() == d );
if( item->getUIData() == d )
dItem = item;
} );
}
scrollToItem( dItem );
}
void UIDataWidget::mouseReleaseEvent( QMouseEvent *evt )
{
if( QApplication::keyboardModifiers() & Qt::AltModifier )
......
......@@ -74,6 +74,7 @@ signals:
public slots:
void updateContentBegin();
void updateContentEnd();
void updateSelection( GenericUIData *d, Qt::KeyboardModifiers modifiers );
private slots:
void updateDataCollapseState( QTreeWidgetItem* clickedItem );
......
......@@ -245,6 +245,7 @@ void UIMainWindow::init()
connect( ui->tableCurrentProjContent, SIGNAL(visibilityChanged(QList<QTreeWidgetItem*>)), this, SLOT(modifyVisibility(QList<QTreeWidgetItem*>)) );
connect( ui->tableCurrentProjContent, SIGNAL(removalAsked()), this, SLOT(removeFromCurrentProject()) );
connect( ui->tableCurrentProjContent, SIGNAL(itemDoubleClicked(GenericUIData*)), this, SLOT(onItemDoubleClicked(GenericUIData*)) );
connect( m_CurrentViewer, SIGNAL(dataSelected(GenericUIData*,Qt::KeyboardModifiers)), ui->tableCurrentProjContent, SLOT(updateSelection(GenericUIData*,Qt::KeyboardModifiers)) );
connect( ui->comboProject, SIGNAL(currentIndexChanged(int)), this, SLOT(currentProjectChanged()) );
......
Supports Markdown
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