Clicking Nodes\Links brings them up in viewer (#1344)

* Clicking Nodes\Links brings them up in viewer

* Removed duplicated feature, kept spin box and single click node event. Removed unrelated border option crashing.

---------

Co-authored-by: Chuck Ellison <charles.c.ellison@erdc.dren.mil>
Co-authored-by: matlabbe <matlabbe@gmail.com>
This commit is contained in:
Charles Ellison
2024-09-21 20:36:06 -05:00
committed by GitHub
parent 379e11bd66
commit 21abdddbff
5 changed files with 56 additions and 28 deletions

View File

@@ -351,6 +351,11 @@ DatabaseViewer::DatabaseViewer(const QString & ini, QWidget * parent) :
connect(ui_->horizontalSlider_B, SIGNAL(valueChanged(int)), this, SLOT(sliderBValueChanged(int)));
connect(ui_->horizontalSlider_A, SIGNAL(sliderMoved(int)), this, SLOT(sliderAMoved(int)));
connect(ui_->horizontalSlider_B, SIGNAL(sliderMoved(int)), this, SLOT(sliderBMoved(int)));
ui_->spinBox_indexA->setEnabled(false);
ui_->spinBox_indexB->setEnabled(false);
connect(ui_->spinBox_indexA, SIGNAL(valueChanged(int)), this, SLOT(sliderAValueChanged(int)));
connect(ui_->spinBox_indexB, SIGNAL(valueChanged(int)), this, SLOT(sliderBValueChanged(int)));
connect(ui_->toolButton_edit_priorA, SIGNAL(clicked(bool)), this, SLOT(editConstraint()));
connect(ui_->toolButton_edit_priorB, SIGNAL(clicked(bool)), this, SLOT(editConstraint()));
connect(ui_->toolButton_remove_priorA, SIGNAL(clicked(bool)), this, SLOT(rejectConstraint()));
@@ -1156,6 +1161,11 @@ bool DatabaseViewer::closeDatabase()
sliderAValueChanged(0);
sliderBValueChanged(0);
ui_->spinBox_indexA->setEnabled(false);
ui_->spinBox_indexA->setMaximum(0);
ui_->spinBox_indexB->setEnabled(false);
ui_->spinBox_indexB->setMaximum(0);
constraintsViewer_->clear();
constraintsViewer_->refreshView();
@@ -2120,6 +2130,13 @@ void DatabaseViewer::updateIds()
if(ids_.size())
{
ui_->spinBox_indexA->setMinimum(0);
ui_->spinBox_indexB->setMinimum(0);
ui_->spinBox_indexA->setMaximum(ids_.size()-1);
ui_->spinBox_indexB->setMaximum(ids_.size()-1);
ui_->spinBox_indexA->setEnabled(true);
ui_->spinBox_indexB->setEnabled(true);
ui_->horizontalSlider_A->setMinimum(0);
ui_->horizontalSlider_B->setMinimum(0);
ui_->horizontalSlider_A->setMaximum(ids_.size()-1);
@@ -2135,6 +2152,10 @@ void DatabaseViewer::updateIds()
{
ui_->horizontalSlider_A->setEnabled(false);
ui_->horizontalSlider_B->setEnabled(false);
ui_->spinBox_indexA->setEnabled(false);
ui_->spinBox_indexB->setEnabled(false);
ui_->label_idA->setText("NaN");
ui_->label_idB->setText("NaN");
}
@@ -4583,7 +4604,7 @@ void DatabaseViewer::graphLinkSelected(int from, int to)
void DatabaseViewer::sliderAValueChanged(int value)
{
this->update(value,
ui_->label_indexA,
ui_->spinBox_indexA,
ui_->label_parentsA,
ui_->label_childrenA,
ui_->label_weightA,
@@ -4610,7 +4631,7 @@ void DatabaseViewer::sliderAValueChanged(int value)
void DatabaseViewer::sliderBValueChanged(int value)
{
this->update(value,
ui_->label_indexB,
ui_->spinBox_indexB,
ui_->label_parentsB,
ui_->label_childrenB,
ui_->label_weightB,
@@ -4635,7 +4656,7 @@ void DatabaseViewer::sliderBValueChanged(int value)
}
void DatabaseViewer::update(int value,
QLabel * labelIndex,
QSpinBox * spinBoxIndex,
QLabel * labelParents,
QLabel * labelChildren,
QLabel * weight,
@@ -4661,7 +4682,9 @@ void DatabaseViewer::update(int value,
lastSliderIndexBrowsed_ = value;
UTimer timer;
labelIndex->setText(QString::number(value));
spinBoxIndex->blockSignals(true);
spinBoxIndex->setValue(value);
spinBoxIndex->blockSignals(false);
labelParents->clear();
labelChildren->clear();
weight->clear();
@@ -5982,7 +6005,9 @@ void DatabaseViewer::updateWordsMatching(const std::vector<int> & inliers)
void DatabaseViewer::sliderAMoved(int value)
{
ui_->label_indexA->setText(QString::number(value));
ui_->spinBox_indexA->blockSignals(true);
ui_->spinBox_indexA->setValue(value);
ui_->spinBox_indexA->blockSignals(false);
if(value>=0 && value < ids_.size())
{
ui_->label_idA->setText(QString::number(ids_.at(value)));
@@ -5995,7 +6020,9 @@ void DatabaseViewer::sliderAMoved(int value)
void DatabaseViewer::sliderBMoved(int value)
{
ui_->label_indexB->setText(QString::number(value));
ui_->spinBox_indexB->blockSignals(true);
ui_->spinBox_indexB->setValue(value);
ui_->spinBox_indexB->blockSignals(false);
if(value>=0 && value < ids_.size())
{
ui_->label_idB->setText(QString::number(ids_.at(value)));
@@ -6308,7 +6335,7 @@ void DatabaseViewer::updateConstraintView(
ui_->horizontalSlider_B->blockSignals(false);
if(link.from()>0)
this->update(idToIndex_.value(link.from()),
ui_->label_indexA,
ui_->spinBox_indexA,
ui_->label_parentsA,
ui_->label_childrenA,
ui_->label_weightA,
@@ -6333,7 +6360,7 @@ void DatabaseViewer::updateConstraintView(
if(link.to()>0)
{
this->update(idToIndex_.value(link.to()),
ui_->label_indexB,
ui_->spinBox_indexB,
ui_->label_parentsB,
ui_->label_childrenB,
ui_->label_weightB,

View File

@@ -1809,7 +1809,7 @@ void GraphViewer::mouseMoveEvent(QMouseEvent * event)
QGraphicsView::mouseMoveEvent(event);
}
void GraphViewer::mouseDoubleClickEvent(QMouseEvent * event)
void GraphViewer::mousePressEvent(QMouseEvent * event)
{
QGraphicsItem *item = this->scene()->itemAt(mapToScene(event->pos()), QTransform());
if(item)
@@ -1826,12 +1826,12 @@ void GraphViewer::mouseDoubleClickEvent(QMouseEvent * event)
}
else
{
QGraphicsView::mouseDoubleClickEvent(event);
QGraphicsView::mousePressEvent(event);
}
}
else
{
QGraphicsView::mouseDoubleClickEvent(event);
QGraphicsView::mousePressEvent(event);
}
}

View File

@@ -61,7 +61,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>417</width>
<width>419</width>
<height>389</height>
</rect>
</property>
@@ -392,7 +392,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>416</width>
<width>418</width>
<height>389</height>
</rect>
</property>
@@ -745,9 +745,9 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="label_indexA">
<property name="text">
<string>indexA</string>
<widget class="QSpinBox" name="spinBox_indexA">
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
@@ -810,9 +810,9 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_indexB">
<property name="text">
<string>indexB</string>
<widget class="QSpinBox" name="spinBox_indexB">
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
@@ -1641,7 +1641,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>318</width>
<width>314</width>
<height>188</height>
</rect>
</property>
@@ -1797,8 +1797,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>518</width>
<height>1007</height>
<width>276</width>
<height>1201</height>
</rect>
</property>
<attribute name="label">
@@ -2458,8 +2458,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-42</y>
<width>298</width>
<y>0</y>
<width>294</width>
<height>272</height>
</rect>
</property>
@@ -2633,8 +2633,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>196</height>
<width>181</width>
<height>485</height>
</rect>
</property>
<attribute name="label">