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()); 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) void VWidgetDetails::InLayoutStateChanged(int row, int column)
{ {

View File

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

View File

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

View File

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

View File

@ -292,6 +292,7 @@ signals:
void SetEnabledGUI(bool enabled); void SetEnabledGUI(bool enabled);
void CheckLayout(); void CheckLayout();
void UpdateInLayoutList(); void UpdateInLayoutList();
void ShowDetail(quint32 id);
void SetCurrentPP(const QString &patterPiece); void SetCurrentPP(const QString &patterPiece);
public slots: public slots:
@ -300,6 +301,7 @@ public slots:
void NeedFullParsing(); void NeedFullParsing();
void ClearScene(); void ClearScene();
void CheckInLayoutList(); void CheckInLayoutList();
void SelectedDetail(quint32 id);
protected: protected:
/** @brief nameActivDraw name current pattern peace. */ /** @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) if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
{ {
doc->SelectedDetail(id);
emit ChoosedTool(id, SceneObject::Detail); emit ChoosedTool(id, SceneObject::Detail);
} }