mirror of
https://gitlab.com/smart-pattern/valentina.git
synced 2024-09-19 15:24:03 +02:00
Calculate image size according to screen scale factor.
This commit is contained in:
parent
5b80eb38db
commit
f3329fb130
|
@ -7890,7 +7890,7 @@ void MainWindow::PrintPatternMessage(QEvent *event)
|
|||
ui->plainTextEditPatternMessages->appendPlainText(message);
|
||||
if (not m_unreadPatternMessage.isNull())
|
||||
{
|
||||
m_unreadPatternMessage->setText(DialogWarningIcon() + tr("Pattern messages"));
|
||||
m_unreadPatternMessage->setText(DialogWarningIcon(m_unreadPatternMessage) + tr("Pattern messages"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -608,11 +608,20 @@ auto EachPointLabelIsUnique(QListWidget *listWidget) -> bool
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto DialogWarningIcon() -> QString
|
||||
auto DialogWarningIcon(QWidget *w) -> QString
|
||||
{
|
||||
const QIcon icon = FromTheme(VThemeIcon::DialogWarning);
|
||||
|
||||
const QPixmap pixmap = icon.pixmap(QSize(16, 16));
|
||||
qreal scaleFactor = 1;
|
||||
if (w != nullptr)
|
||||
{
|
||||
if (QScreen *wScreen = w->screen())
|
||||
{
|
||||
scaleFactor = wScreen->devicePixelRatio();
|
||||
}
|
||||
}
|
||||
|
||||
const QPixmap pixmap = icon.pixmap(QSize(qRound(16 / scaleFactor), qRound(16 / scaleFactor)));
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
pixmap.save(&buffer, "PNG");
|
||||
|
|
|
@ -92,7 +92,7 @@ auto DoublePoints(QListWidget *listWidget, const VContainer *data, QString &erro
|
|||
auto DoubleCurves(QListWidget *listWidget, const VContainer *data, QString &error) -> bool;
|
||||
auto EachPointLabelIsUnique(QListWidget *listWidget) -> bool;
|
||||
auto InvalidSegment(QListWidget *listWidget, const VContainer *data, QString &error) -> bool;
|
||||
auto DialogWarningIcon() -> QString;
|
||||
auto DialogWarningIcon(QWidget* w) -> QString;
|
||||
auto NodeFont(QFont font, bool nodeExcluded = false) -> QFont;
|
||||
void CurrentCurveLength(vidtype curveId, VContainer *data);
|
||||
void SetTabStopDistance(QPlainTextEdit *edit, int tabWidthChar = 4);
|
||||
|
|
|
@ -1842,7 +1842,7 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
|||
{
|
||||
if (CreatePath().PathPoints(data).count() < 2)
|
||||
{
|
||||
ui->helpLabel->setText(DialogWarningIcon() + tr("You need more points!"));
|
||||
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("You need more points!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1850,8 +1850,8 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
|||
if (GetType() == PiecePathType::CustomSeamAllowance && FirstPointEqualLast(ui->listWidget, data, error))
|
||||
{
|
||||
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||
DialogWarningIcon(), tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"),
|
||||
error));
|
||||
DialogWarningIcon(ui->helpLabel),
|
||||
tr("First point of <b>custom seam allowance</b> cannot be equal to the last point!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1859,41 +1859,42 @@ auto DialogPiecePath::PathIsValid() const -> bool
|
|||
if (DoublePoints(ui->listWidget, data, error))
|
||||
{
|
||||
ui->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel), tr("You have double points!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (DoubleCurves(ui->listWidget, data, error))
|
||||
{
|
||||
ui->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel),
|
||||
tr("The same curve repeats twice!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GetType() == PiecePathType::CustomSeamAllowance && not EachPointLabelIsUnique(ui->listWidget))
|
||||
{
|
||||
ui->helpLabel->setText(DialogWarningIcon() +
|
||||
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) +
|
||||
tr("Each point in the <b>custom seam allowance</b> path must be unique!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not m_showMode && ui->comboBoxPiece->count() <= 0)
|
||||
{
|
||||
ui->helpLabel->setText(DialogWarningIcon() + tr("List of details is empty!"));
|
||||
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("List of details is empty!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not m_showMode && ui->comboBoxPiece->currentIndex() == -1)
|
||||
{
|
||||
ui->helpLabel->setText(DialogWarningIcon() + tr("Please, select a detail to insert into!"));
|
||||
ui->helpLabel->setText(DialogWarningIcon(ui->helpLabel) + tr("Please, select a detail to insert into!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (InvalidSegment(ui->listWidget, data, error))
|
||||
{
|
||||
ui->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||
ui->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(ui->helpLabel), tr("Invalid segment!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -3388,13 +3388,14 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
|||
{
|
||||
if (CreatePiece().MainPathPoints(data).count() < 3)
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("You need more points!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("You need more points!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not MainPathIsClockwise())
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("You have to choose points in a clockwise direction!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("You have to choose points in a clockwise direction!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3402,29 +3403,30 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
|||
if (FirstPointEqualLast(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(
|
||||
DialogWarningIcon(), tr("First point cannot be equal to the last point!"), error));
|
||||
DialogWarningIcon(uiTabPaths->helpLabel), tr("First point cannot be equal to the last point!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (DoublePoints(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("You have double points!"), error));
|
||||
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel),
|
||||
tr("You have double points!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
error.clear();
|
||||
if (DoubleCurves(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("The same curve repeats twice!"), error));
|
||||
uiTabPaths->helpLabel->setText(QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel),
|
||||
tr("The same curve repeats twice!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (not EachPointLabelIsUnique(uiTabPaths->listWidgetMainPath))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Each point in the path must be unique!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("Each point in the path must be unique!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3432,7 +3434,7 @@ auto DialogSeamAllowance::MainPathIsValid() const -> bool
|
|||
if (InvalidSegment(uiTabPaths->listWidgetMainPath, data, error))
|
||||
{
|
||||
uiTabPaths->helpLabel->setText(
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(), tr("Invalid segment!"), error));
|
||||
QStringLiteral("%1%2 %3").arg(DialogWarningIcon(uiTabPaths->helpLabel), tr("Invalid segment!"), error));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3456,14 +3458,15 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
|
|||
if (startPoint == NULL_ID && endPoint != NULL_ID)
|
||||
{
|
||||
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line start point!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("Invalid mirror line start point!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (startPoint != NULL_ID && endPoint == NULL_ID)
|
||||
{
|
||||
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line end point!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("Invalid mirror line end point!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3471,7 +3474,8 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
|
|||
{
|
||||
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
|
||||
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Start and end mirror line points must be unique!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("Start and end mirror line points must be unique!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3490,14 +3494,15 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
|
|||
if (!uniquePoints.contains(startPoint))
|
||||
{
|
||||
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line start point!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("Invalid mirror line start point!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!uniquePoints.contains(endPoint))
|
||||
{
|
||||
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Invalid mirror line end point!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) + tr("Invalid mirror line end point!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3505,7 +3510,8 @@ auto DialogSeamAllowance::MirrorLineIsValid() const -> bool
|
|||
{
|
||||
ChangeColor(uiTabPaths->labelMLStartPoint, errorColor);
|
||||
ChangeColor(uiTabPaths->labelMLEndPoint, errorColor);
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon() + tr("Mirror points must be neighbors!"));
|
||||
uiTabPaths->helpLabel->setText(DialogWarningIcon(uiTabPaths->helpLabel) +
|
||||
tr("Mirror points must be neighbors!"));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue