mirror of
https://github.com/leozide/leocad
synced 2024-12-25 21:58:23 +01:00
Show piece properties that are the same when multiple pieces are selected.
This commit is contained in:
parent
c1cdbc8d4a
commit
565a012b6c
2 changed files with 42 additions and 6 deletions
|
@ -426,7 +426,7 @@ void lcQPropertiesTree::Update(const lcArray<lcObject*>& Selection, lcObject* Fo
|
|||
break;
|
||||
|
||||
case LC_PROPERTY_WIDGET_PIECE:
|
||||
SetPiece(Focus);
|
||||
SetPiece(Selection, Focus);
|
||||
break;
|
||||
|
||||
case LC_PROPERTY_WIDGET_CAMERA:
|
||||
|
@ -839,7 +839,7 @@ void lcQPropertiesTree::SetEmpty()
|
|||
mFocus = NULL;
|
||||
}
|
||||
|
||||
void lcQPropertiesTree::SetPiece(lcObject* Focus)
|
||||
void lcQPropertiesTree::SetPiece(const lcArray<lcObject*>& Selection, lcObject* Focus)
|
||||
{
|
||||
if (mWidgetMode != LC_PROPERTY_WIDGET_PIECE)
|
||||
{
|
||||
|
@ -893,7 +893,6 @@ void lcQPropertiesTree::SetPiece(lcObject* Focus)
|
|||
lcStep Show = 0;
|
||||
lcStep Hide = 0;
|
||||
int ColorIndex = gDefaultColor;
|
||||
const char* Description = "";
|
||||
PieceInfo* Info = NULL;
|
||||
|
||||
if (Piece)
|
||||
|
@ -901,9 +900,46 @@ void lcQPropertiesTree::SetPiece(lcObject* Focus)
|
|||
Show = Piece->GetStepShow();
|
||||
Hide = Piece->GetStepHide();
|
||||
ColorIndex = Piece->mColorIndex;
|
||||
Description = Piece->mPieceInfo->m_strDescription;
|
||||
Info = Piece->mPieceInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
bool FirstPiece = true;
|
||||
|
||||
for (int ObjectIdx = 0; ObjectIdx < Selection.GetSize(); ObjectIdx++)
|
||||
{
|
||||
lcObject* Object = Selection[ObjectIdx];
|
||||
|
||||
if (Object->GetType() != LC_OBJECT_PIECE)
|
||||
continue;
|
||||
|
||||
lcPiece* SelectedPiece = (lcPiece*)Object;
|
||||
|
||||
if (FirstPiece)
|
||||
{
|
||||
Show = SelectedPiece->GetStepShow();
|
||||
Hide = SelectedPiece->GetStepHide();
|
||||
ColorIndex = SelectedPiece->mColorIndex;
|
||||
Info = SelectedPiece->mPieceInfo;
|
||||
|
||||
FirstPiece = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SelectedPiece->GetStepShow() != Show)
|
||||
Show = 0;
|
||||
|
||||
if (SelectedPiece->GetStepHide() != Hide)
|
||||
Hide = 0;
|
||||
|
||||
if (SelectedPiece->mColorIndex != ColorIndex)
|
||||
ColorIndex = gDefaultColor;
|
||||
|
||||
if (SelectedPiece->mPieceInfo != Info)
|
||||
Info = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
partShow->setText(1, QString::number(Show));
|
||||
partShow->setData(0, PropertyValueRole, Show);
|
||||
|
@ -925,7 +961,7 @@ void lcQPropertiesTree::SetPiece(lcObject* Focus)
|
|||
partColor->setText(1, color->Name);
|
||||
partColor->setData(0, PropertyValueRole, ColorIndex);
|
||||
|
||||
partID->setText(1, Description);
|
||||
partID->setText(1, Info ? Info->m_strDescription : QString());
|
||||
partID->setData(0, PropertyValueRole, qVariantFromValue((void*)Info));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ protected:
|
|||
QTreeWidgetItem *addProperty(QTreeWidgetItem *parent, const QString& label, PropertyType propertyType);
|
||||
|
||||
void SetEmpty();
|
||||
void SetPiece(lcObject* Focus);
|
||||
void SetPiece(const lcArray<lcObject*>& Selection, lcObject* Focus);
|
||||
void SetCamera(lcObject* Focus);
|
||||
void SetLight(lcObject* Focus);
|
||||
void SetMultiple();
|
||||
|
|
Loading…
Reference in a new issue