Show a piece position status in Property tab.

This commit is contained in:
Roman Telezhynskyi 2024-04-22 12:26:12 +03:00
parent 537efbeaa8
commit ed4f2945da
3 changed files with 76 additions and 7 deletions

View File

@ -883,6 +883,17 @@ void VPMainWindow::InitPropertyTabCurrentPiece()
connect(ui->checkBoxCurrentPieceHorizontallyFlipped, &QCheckBox::toggled, this,
&VPMainWindow::CurrentPieceHorizontallyFlippedToggled);
const QIcon warningIcon = QIcon::fromTheme(QStringLiteral("dialog-warning"));
auto WarningIcon = [warningIcon](QLabel *label)
{
const int size = qRound(16 * label->devicePixelRatio());
label->setPixmap(warningIcon.pixmap(size, size));
};
WarningIcon(ui->labelWarningOutOfBound);
WarningIcon(ui->labelWarningSuperpositionOfPieces);
WarningIcon(ui->labelWarningPieceGape);
// Translate
ui->comboBoxTranslateUnit->addItem(tr("Millimiters"), QVariant(UnitsToStr(Unit::Mm)));
ui->comboBoxTranslateUnit->addItem(tr("Centimeters"), QVariant(UnitsToStr(Unit::Cm)));
@ -1356,12 +1367,14 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
ui->labelCurrentPieceNoPieceSelected->setVisible(true);
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxCurrentPieceStatus->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(false);
ui->groupBoxCurrentPieceGeometry->setVisible(false);
}
else if (selectedPieces.count() == 1)
{
ui->groupBoxCurrentPieceInfo->setVisible(true);
ui->groupBoxCurrentPieceStatus->setVisible(true);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceGeometry->setVisible(true);
@ -1373,6 +1386,10 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId());
SetLineEditValue(ui->lineEditCopyNumber, QString::number(selectedPiece->CopyNumber()));
ui->labelWarningOutOfBound->setEnabled(selectedPiece->OutOfBound());
ui->labelWarningSuperpositionOfPieces->setEnabled(selectedPiece->HasSuperpositionWithPieces());
ui->labelWarningPieceGape->setEnabled(selectedPiece->HasInvalidPieceGapPosition());
SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, not selectedPiece->IsHideMainPath());
SetCheckBoxValue(ui->checkBoxCurrentPieceVerticallyFlipped, selectedPiece->IsVerticallyFlipped());
SetCheckBoxValue(ui->checkBoxCurrentPieceHorizontallyFlipped, selectedPiece->IsHorizontallyFlipped());
@ -1401,6 +1418,7 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
{
// show the content "multiple pieces selected"
ui->groupBoxCurrentPieceInfo->setVisible(false);
ui->groupBoxCurrentPieceStatus->setVisible(false);
ui->groupBoxPieceTransformation->setVisible(true);
ui->groupBoxCurrentPieceGeometry->setVisible(false);

View File

@ -279,8 +279,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<height>752</height>
<width>385</width>
<height>865</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_23">
@ -395,6 +395,57 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxCurrentPieceStatus">
<property name="title">
<string>Status</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelWarningOutOfBound">
<property name="text">
<string notr="true">Warning!</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Out of bound</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelWarningSuperpositionOfPieces">
<property name="text">
<string notr="true">Warning!</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Superposition of pieces</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelWarningPieceGape">
<property name="text">
<string notr="true">Warning!</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Piece gape</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBoxPieceTransformation">
<property name="sizePolicy">
@ -752,7 +803,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<width>385</width>
<height>829</height>
</rect>
</property>
@ -1276,7 +1327,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>392</width>
<width>399</width>
<height>700</height>
</rect>
</property>
@ -1659,7 +1710,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>378</width>
<width>385</width>
<height>710</height>
</rect>
</property>
@ -2455,8 +2506,8 @@
</resources>
<connections/>
<buttongroups>
<buttongroup name="buttonGroupRotationDirection"/>
<buttongroup name="buttonGroupTileOrientation"/>
<buttongroup name="buttonGroupSheetOrientation"/>
<buttongroup name="buttonGroupRotationDirection"/>
</buttongroups>
</ui>

View File

@ -615,7 +615,7 @@ auto DialogWarningIcon() -> QString
QByteArray byteArray;
QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG");
return QStringLiteral("<img src=\"data:image/png;base64,") + byteArray.toBase64() + QStringLiteral("\"/> ");
return QStringLiteral("<img src=\"data:image/png;base64,") + byteArray.toBase64() + "\"/> "_L1;
}
//---------------------------------------------------------------------------------------------------------------------