mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Correct color of inks
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "pdfcms.h"
|
||||
#include "pdfrenderer.h"
|
||||
#include "pdfwidgetutils.h"
|
||||
#include "pdfdrawspacecontroller.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
@@ -31,8 +32,8 @@ namespace pdfplugin
|
||||
OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::PDFWidget* widget, QWidget* parent) :
|
||||
QDialog(parent, Qt::Dialog | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint),
|
||||
ui(new Ui::OutputPreviewDialog),
|
||||
m_inkMapper(document),
|
||||
m_inkMapperForRendering(document),
|
||||
m_inkMapper(widget->getCMSManager(), document),
|
||||
m_inkMapperForRendering(widget->getCMSManager(), document),
|
||||
m_document(document),
|
||||
m_widget(widget),
|
||||
m_needUpdateImage(false),
|
||||
@@ -51,6 +52,7 @@ OutputPreviewDialog::OutputPreviewDialog(const pdf::PDFDocument* document, pdf::
|
||||
ui->displayModeComboBox->setCurrentIndex(0);
|
||||
|
||||
ui->imageWidget->setInkMapper(&m_inkMapper);
|
||||
ui->inksTreeWidget->setMinimumHeight(pdf::PDFWidgetUtils::scaleDPI_y(ui->inksTreeWidget, 150));
|
||||
|
||||
m_inkMapper.createSpotColors(ui->simulateSeparationsCheckBox->isChecked());
|
||||
connect(ui->simulateSeparationsCheckBox, &QCheckBox::clicked, this, &OutputPreviewDialog::onSimulateSeparationsChecked);
|
||||
@@ -111,6 +113,10 @@ void OutputPreviewDialog::updateInks()
|
||||
spotColorsRoot->setFlags(spotColorsRoot->flags() | Qt::ItemIsUserCheckable);
|
||||
spotColorsRoot->setCheckState(0, Qt::Checked);
|
||||
|
||||
QSize iconSize = pdf::PDFWidgetUtils::scaleDPI(ui->inksTreeWidget, QSize(16, 16));
|
||||
ui->inksTreeWidget->setIconSize(iconSize);
|
||||
ui->inksTreeWidget->setRootIsDecorated(true);
|
||||
|
||||
int colorIndex = 0;
|
||||
std::vector<pdf::PDFInkMapper::ColorInfo> separations = m_inkMapper.getSeparations(4);
|
||||
for (const auto& colorInfo : separations)
|
||||
@@ -127,6 +133,13 @@ void OutputPreviewDialog::updateInks()
|
||||
item = new QTreeWidgetItem(spotColorsRoot, QStringList(colorInfo.textName));
|
||||
}
|
||||
|
||||
if (colorInfo.color.isValid())
|
||||
{
|
||||
QPixmap icon(iconSize);
|
||||
icon.fill(colorInfo.color);
|
||||
item->setIcon(0, QIcon(icon));
|
||||
}
|
||||
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
item->setData(0, Qt::UserRole, colorIndex++);
|
||||
|
@@ -35,12 +35,12 @@ OutputPreviewWidget::OutputPreviewWidget(QWidget* parent) :
|
||||
|
||||
QSize OutputPreviewWidget::sizeHint() const
|
||||
{
|
||||
return pdf::PDFWidgetUtils::scaleDPI(this, QSize(400, 300));
|
||||
return pdf::PDFWidgetUtils::scaleDPI(this, QSize(500, 300));
|
||||
}
|
||||
|
||||
QSize OutputPreviewWidget::minimumSizeHint() const
|
||||
{
|
||||
return pdf::PDFWidgetUtils::scaleDPI(this, QSize(200, 200));
|
||||
return pdf::PDFWidgetUtils::scaleDPI(this, QSize(400, 300));
|
||||
}
|
||||
|
||||
void OutputPreviewWidget::clear()
|
||||
@@ -244,7 +244,7 @@ void OutputPreviewWidget::buildInfoBoxItems()
|
||||
continue;
|
||||
}
|
||||
|
||||
addInfoBoxColoredItem(Qt::green, colorInfo.textName, QString("100 %"));
|
||||
addInfoBoxColoredItem(colorInfo.color, colorInfo.textName, QString("100 %"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ void OutputPreviewWidget::buildInfoBoxItems()
|
||||
continue;
|
||||
}
|
||||
|
||||
addInfoBoxColoredItem(Qt::blue, colorInfo.textName, QString("100 %"));
|
||||
addInfoBoxColoredItem(colorInfo.color, colorInfo.textName, QString("100 %"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user