Selected detail is also selected in the list.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-10-14 21:33:12 +03:00
parent d38e81cecb
commit 972c70e608
6 changed files with 27 additions and 0 deletions

View File

@ -65,6 +65,22 @@ void VWidgetDetails::UpdateList()
FillTable(m_data->DataDetails());
}
//---------------------------------------------------------------------------------------------------------------------
void VWidgetDetails::SelectDetail(quint32 id)
{
const int rowCount = ui->tableWidget->rowCount();
for (int row = 0; row < rowCount; ++row)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
if (item->data(Qt::UserRole).toUInt() == id)
{
ui->tableWidget->setCurrentItem(item);
return;
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VWidgetDetails::InLayoutStateChanged(int row, int column)
{

View File

@ -53,6 +53,7 @@ signals:
public slots:
void UpdateList();
void SelectDetail(quint32 id);
private slots:
void InLayoutStateChanged(int row, int column);

View File

@ -3511,6 +3511,7 @@ void MainWindow::InitDocksContain()
detailsWidget = new VWidgetDetails(pattern, doc, this);
connect(doc, &VPattern::FullUpdateFromFile, detailsWidget, &VWidgetDetails::UpdateList);
connect(doc, &VPattern::UpdateInLayoutList, detailsWidget, &VWidgetDetails::UpdateList);
connect(doc, &VPattern::ShowDetail, detailsWidget, &VWidgetDetails::SelectDetail);
connect(detailsWidget, &VWidgetDetails::Highlight, sceneDetails, &VMainGraphicsScene::HighlightItem);
detailsWidget->setVisible(false);
}

View File

@ -1208,6 +1208,12 @@ void VAbstractPattern::CheckInLayoutList()
emit UpdateInLayoutList();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::SelectedDetail(quint32 id)
{
emit ShowDetail(id);
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::ToolExists(const quint32 &id) const
{

View File

@ -292,6 +292,7 @@ signals:
void SetEnabledGUI(bool enabled);
void CheckLayout();
void UpdateInLayoutList();
void ShowDetail(quint32 id);
void SetCurrentPP(const QString &patterPiece);
public slots:
@ -300,6 +301,7 @@ public slots:
void NeedFullParsing();
void ClearScene();
void CheckInLayoutList();
void SelectedDetail(quint32 id);
protected:
/** @brief nameActivDraw name current pattern peace. */

View File

@ -671,6 +671,7 @@ void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{
doc->SelectedDetail(id);
emit ChoosedTool(id, SceneObject::Detail);
}