[TD]fix scene and tree selection sync

This commit is contained in:
wandererfan
2024-06-17 09:00:01 -04:00
committed by WandererFan
parent 27c61ef137
commit 2ca9b6ef80
5 changed files with 68 additions and 8 deletions

View File

@@ -62,6 +62,7 @@
#include "ViewProviderDrawingView.h"
#include "ViewProviderPage.h"
#include "ZVALUE.h"
#include "DrawGuiUtil.h"
using namespace TechDrawGui;
@@ -194,10 +195,8 @@ QVariant QGIView::itemChange(GraphicsItemChange change, const QVariant &value)
if (change == ItemSelectedHasChanged && scene()) {
if(isSelected()) {
m_colCurrent = getSelectColor();
// m_selectState = 2;
} else {
m_colCurrent = PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor());
// m_selectState = 0;
}
drawBorder();
}
@@ -290,7 +289,6 @@ void QGIView::snapPosition(QPointF& mPos)
void QGIView::mousePressEvent(QGraphicsSceneMouseEvent * event)
{
// Base::Console().Message("QGIV::mousePressEvent() - %s\n", getViewName());
Qt::KeyboardModifiers originalModifiers = event->modifiers();
if (event->button()&Qt::LeftButton) {
m_multiselectActivated = false;
@@ -298,10 +296,8 @@ void QGIView::mousePressEvent(QGraphicsSceneMouseEvent * event)
if (event->button() == Qt::LeftButton && PreferencesGui::multiSelection()) {
std::vector<Gui::SelectionObject> selection = Gui::Selection().getSelectionEx();
if (selection.size() == 1
&& selection.front().getObject() == getViewObject()
&& selection.front().hasSubNames()) {
if (!DrawGuiUtil::getSubsForSelectedObject(selection, getViewObject()).empty()) {
// we have already selected geometry for this view
m_multiselectActivated = true;
event->setModifiers(originalModifiers | Qt::ControlModifier);
}
@@ -319,7 +315,6 @@ void QGIView::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
void QGIView::mouseReleaseEvent(QGraphicsSceneMouseEvent * event)
{
// Base::Console().Message("QGIV::mouseReleaseEvent() - %s\n", getViewName());
Qt::KeyboardModifiers originalModifiers = event->modifiers();
if ((event->button()&Qt::LeftButton) && m_multiselectActivated) {
if (PreferencesGui::multiSelection()) {