New feature. Valentina will highlight a detail selected in the Group list.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-10-12 14:43:08 +03:00
parent 585618e3fc
commit 0817264a84
7 changed files with 24 additions and 2 deletions

View File

@ -68,13 +68,15 @@ void VWidgetDetails::UpdateList()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetDetails::InLayoutStateChanged(int row, int column)
{
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
const quint32 id = item->data(Qt::UserRole).toUInt();
emit Highlight(id);
if (column != 0)
{
return;
}
QTableWidgetItem *item = ui->tableWidget->item(row, column);
const quint32 id = item->data(Qt::UserRole).toUInt();
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
const bool inLayout = not allDetails->value(id).IsInLayout();

View File

@ -48,6 +48,9 @@ public:
explicit VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget *parent = nullptr);
virtual ~VWidgetDetails();
signals:
void Highlight(quint32 id);
public slots:
void UpdateList();

View File

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

View File

@ -348,6 +348,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem);
connect(scene, &VMainGraphicsScene::EnableDetailItemHover, detail, &VToolDetail::AllowHover);
connect(scene, &VMainGraphicsScene::EnableDetailItemSelection, detail, &VToolDetail::AllowSelecting);
connect(scene, &VMainGraphicsScene::HighlightDetail, detail, &VToolDetail::Highlight);
doc->AddTool(id, detail);
}
}
@ -1150,3 +1151,9 @@ void VToolDetail::retranslateUi()
UpdateLabel();
UpdatePatternInfo();
}
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::Highlight(quint32 id)
{
setSelected(this->id == id);
}

View File

@ -101,6 +101,7 @@ public slots:
virtual void ResetChildren(QGraphicsItem* pItem);
virtual void UpdateAll();
virtual void retranslateUi();
void Highlight(quint32 id);
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) Q_DECL_OVERRIDE;

View File

@ -303,6 +303,12 @@ void VMainGraphicsScene::ItemsSelection(const SelectionType &type)
emit ItemSelection(type);
}
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::HighlightItem(quint32 id)
{
emit HighlightDetail(id);
}
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsScene::ToggleLabelSelection(bool enabled)
{

View File

@ -75,6 +75,7 @@ public slots:
void EnableItemMove(bool move);
void EnableDetailsMode(bool mode);
void ItemsSelection(const SelectionType &type);
void HighlightItem(quint32 id);
void ToggleLabelSelection(bool enabled);
void TogglePointSelection(bool enabled);
@ -126,6 +127,7 @@ signals:
void EnableToolMove(bool move);
void CurveDetailsMode(bool mode);
void ItemSelection(const SelectionType &type);
void HighlightDetail(quint32 id);
void EnableLabelItemSelection(bool enable);
void EnablePointItemSelection(bool enable);