Resolved issue #290. Add paper type 'Roll - 36" & 'Roll - 44" to 'Create Layout'
paper size. --HG-- branch : develop
This commit is contained in:
parent
350cc90ced
commit
5766523733
|
@ -32,6 +32,7 @@
|
||||||
#include "../../libs/ifc/xml/vdomdocument.h"
|
#include "../../libs/ifc/xml/vdomdocument.h"
|
||||||
#include "../../core/vsettings.h"
|
#include "../../core/vsettings.h"
|
||||||
#include "../../xml/vabstractmeasurements.h"
|
#include "../../xml/vabstractmeasurements.h"
|
||||||
|
#include "../../libs/vlayout/vlayoutgenerator.h"
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 1, 0)
|
||||||
# include "../../../utils/vmath.h"
|
# include "../../../utils/vmath.h"
|
||||||
|
@ -40,11 +41,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum class PaperSizeTemplate : char { A0, A1, A2, A3, A4, Letter, Legal };
|
enum class PaperSizeTemplate : char { A0, A1, A2, A3, A4, Letter, Legal, Roll24in, Roll30in, Roll36in, Roll42in,
|
||||||
|
Roll44in};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
|
DialogLayoutSettings::DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent)
|
||||||
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm)
|
: QDialog(parent), ui(new Ui::DialogLayoutSettings), oldPaperUnit(Unit::Mm), oldLayoutUnit(Unit::Mm),
|
||||||
|
generator(generator)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
@ -68,6 +71,9 @@ DialogLayoutSettings::DialogLayoutSettings(QWidget *parent)
|
||||||
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
connect(ui->toolButtonLandscape, &QToolButton::toggled, this, &DialogLayoutSettings::Swap);
|
||||||
connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxLayoutUnit, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogLayoutSettings::ConvertLayoutSize);
|
this, &DialogLayoutSettings::ConvertLayoutSize);
|
||||||
|
|
||||||
|
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||||
|
connect(bOk, &QPushButton::clicked, this, &DialogLayoutSettings::DialogAccepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -196,6 +202,18 @@ void DialogLayoutSettings::SetIncrease(int increase)
|
||||||
ui->comboBoxIncrease->setCurrentIndex(index);
|
ui->comboBoxIncrease->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool DialogLayoutSettings::GetAutoCrop() const
|
||||||
|
{
|
||||||
|
return ui->checkBoxAutoCrop->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::SetAutoCrop(bool autoCrop)
|
||||||
|
{
|
||||||
|
ui->checkBoxAutoCrop->setChecked(autoCrop);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::TemplateSelected()
|
void DialogLayoutSettings::TemplateSelected()
|
||||||
{
|
{
|
||||||
|
@ -272,6 +290,22 @@ void DialogLayoutSettings::Swap(bool checked)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogLayoutSettings::DialogAccepted()
|
||||||
|
{
|
||||||
|
SCASSERT(generator != nullptr)
|
||||||
|
generator->SetLayoutWidth(GetLayoutWidth());
|
||||||
|
generator->SetCaseType(GetGroup());
|
||||||
|
generator->SetPaperHeight(GetPaperHeight());
|
||||||
|
generator->SetPaperWidth(GetPaperWidth());
|
||||||
|
generator->SetShift(GetShift());
|
||||||
|
generator->SetRotate(GetRotate());
|
||||||
|
generator->SetRotationIncrease(GetIncrease());
|
||||||
|
generator->SetAutoCrop(GetAutoCrop());
|
||||||
|
|
||||||
|
accepted();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::InitPaperUnits()
|
void DialogLayoutSettings::InitPaperUnits()
|
||||||
{
|
{
|
||||||
|
@ -311,16 +345,27 @@ void DialogLayoutSettings::InitLayoutUnits()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogLayoutSettings::InitTemplates()
|
void DialogLayoutSettings::InitTemplates()
|
||||||
{
|
{
|
||||||
const QIcon ico("://icon/16x16/template.png");
|
const QIcon icoPaper("://icon/16x16/template.png");
|
||||||
|
const QIcon icoRoll("://icon/16x16/roll.png");
|
||||||
const QString pdi = QString("(%1ppi)").arg(VApplication::PrintDPI);
|
const QString pdi = QString("(%1ppi)").arg(VApplication::PrintDPI);
|
||||||
|
|
||||||
ui->comboBoxTemplates->addItem(ico, "A0 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A0)));
|
ui->comboBoxTemplates->addItem(icoPaper, "A0 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A0)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "A1 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A1)));
|
ui->comboBoxTemplates->addItem(icoPaper, "A1 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A1)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "A2 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A2)));
|
ui->comboBoxTemplates->addItem(icoPaper, "A2 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A2)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "A3 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A3)));
|
ui->comboBoxTemplates->addItem(icoPaper, "A3 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A3)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "A4 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A4)));
|
ui->comboBoxTemplates->addItem(icoPaper, "A4 "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::A4)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "Letter "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Letter)));
|
ui->comboBoxTemplates->addItem(icoPaper, tr("Letter ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Letter)));
|
||||||
ui->comboBoxTemplates->addItem(ico, "Legal "+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Legal)));
|
ui->comboBoxTemplates->addItem(icoPaper, tr("Legal ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Legal)));
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll,
|
||||||
|
tr("Roll 24in ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Roll24in)));
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll,
|
||||||
|
tr("Roll 30in ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Roll30in)));
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll,
|
||||||
|
tr("Roll 36in ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Roll36in)));
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll,
|
||||||
|
tr("Roll 42in ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Roll42in)));
|
||||||
|
ui->comboBoxTemplates->addItem(icoRoll,
|
||||||
|
tr("Roll 44in ")+pdi, QVariant(static_cast<char>(PaperSizeTemplate::Roll44in)));
|
||||||
|
|
||||||
TemplateSelected();
|
TemplateSelected();
|
||||||
}
|
}
|
||||||
|
@ -343,33 +388,65 @@ QSizeF DialogLayoutSettings::Template()
|
||||||
switch (temp)
|
switch (temp)
|
||||||
{
|
{
|
||||||
case PaperSizeTemplate::A0:
|
case PaperSizeTemplate::A0:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(1189, Unit::Mm, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(1189, Unit::Mm, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::A1:
|
case PaperSizeTemplate::A1:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(841, Unit::Mm, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::A2:
|
case PaperSizeTemplate::A2:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(594, Unit::Mm, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::A3:
|
case PaperSizeTemplate::A3:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(420, Unit::Mm, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::A4:
|
case PaperSizeTemplate::A4:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(210, Unit::Mm, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(210, Unit::Mm, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(297, Unit::Mm, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::Letter:
|
case PaperSizeTemplate::Letter:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(8.5, Unit::Inch, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(8.5, Unit::Inch, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
case PaperSizeTemplate::Legal:
|
case PaperSizeTemplate::Legal:
|
||||||
|
SetAutoCrop(false);
|
||||||
width = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
|
width = VAbstractMeasurements::UnitConvertor(11, Unit::Inch, paperUnit);
|
||||||
height = VAbstractMeasurements::UnitConvertor(17, Unit::Inch, paperUnit);
|
height = VAbstractMeasurements::UnitConvertor(17, Unit::Inch, paperUnit);
|
||||||
return QSizeF(width, height);
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::Roll24in:
|
||||||
|
SetAutoCrop(true);
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(24, Unit::Inch, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(120, Unit::Inch, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::Roll30in:
|
||||||
|
SetAutoCrop(true);
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(30, Unit::Inch, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(120, Unit::Inch, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::Roll36in:
|
||||||
|
SetAutoCrop(true);
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(36, Unit::Inch, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(120, Unit::Inch, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::Roll42in:
|
||||||
|
SetAutoCrop(true);
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(42, Unit::Inch, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(120, Unit::Inch, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
|
case PaperSizeTemplate::Roll44in:
|
||||||
|
SetAutoCrop(true);
|
||||||
|
width = VAbstractMeasurements::UnitConvertor(44, Unit::Inch, paperUnit);
|
||||||
|
height = VAbstractMeasurements::UnitConvertor(120, Unit::Inch, paperUnit);
|
||||||
|
return QSizeF(width, height);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,13 @@ namespace Ui
|
||||||
class DialogLayoutSettings;
|
class DialogLayoutSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VLayoutGenerator;
|
||||||
|
|
||||||
class DialogLayoutSettings : public QDialog
|
class DialogLayoutSettings : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DialogLayoutSettings(QWidget *parent = 0);
|
DialogLayoutSettings(VLayoutGenerator *generator, QWidget *parent = 0);
|
||||||
~DialogLayoutSettings();
|
~DialogLayoutSettings();
|
||||||
|
|
||||||
int GetPaperHeight() const;
|
int GetPaperHeight() const;
|
||||||
|
@ -67,6 +69,9 @@ public:
|
||||||
int GetIncrease() const;
|
int GetIncrease() const;
|
||||||
void SetIncrease(int increase);
|
void SetIncrease(int increase);
|
||||||
|
|
||||||
|
bool GetAutoCrop() const;
|
||||||
|
void SetAutoCrop(bool crop);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ConvertPaperSize();
|
void ConvertPaperSize();
|
||||||
void ConvertLayoutSize();
|
void ConvertLayoutSize();
|
||||||
|
@ -75,11 +80,14 @@ public slots:
|
||||||
void PaperSizeChanged();
|
void PaperSizeChanged();
|
||||||
void Swap(bool checked);
|
void Swap(bool checked);
|
||||||
|
|
||||||
|
void DialogAccepted();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogLayoutSettings)
|
Q_DISABLE_COPY(DialogLayoutSettings)
|
||||||
Ui::DialogLayoutSettings *ui;
|
Ui::DialogLayoutSettings *ui;
|
||||||
Unit oldPaperUnit;
|
Unit oldPaperUnit;
|
||||||
Unit oldLayoutUnit;
|
Unit oldLayoutUnit;
|
||||||
|
VLayoutGenerator *generator;
|
||||||
|
|
||||||
void InitPaperUnits();
|
void InitPaperUnits();
|
||||||
void InitLayoutUnits();
|
void InitLayoutUnits();
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>661</width>
|
<width>661</width>
|
||||||
<height>289</height>
|
<height>317</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -195,6 +195,13 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBoxAutoCrop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto crop unused length</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -522,7 +529,7 @@
|
||||||
</connection>
|
</connection>
|
||||||
</connections>
|
</connections>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
<buttongroup name="buttonGroupPrinciple"/>
|
|
||||||
<buttongroup name="buttonGroup"/>
|
<buttongroup name="buttonGroup"/>
|
||||||
|
<buttongroup name="buttonGroupPrinciple"/>
|
||||||
</buttongroups>
|
</buttongroups>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -58,5 +58,6 @@
|
||||||
<file>icon/32x32/pdf.png</file>
|
<file>icon/32x32/pdf.png</file>
|
||||||
<file>icon/24x24/fx.png</file>
|
<file>icon/24x24/fx.png</file>
|
||||||
<file>icon/16x16/fx.png</file>
|
<file>icon/16x16/fx.png</file>
|
||||||
|
<file>icon/16x16/roll.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/app/share/resources/icon/16x16/roll.png
Normal file
BIN
src/app/share/resources/icon/16x16/roll.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 303 B |
|
@ -413,22 +413,15 @@ void TableWindow::PrintToPdf()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TableWindow::Layout()
|
void TableWindow::Layout()
|
||||||
{
|
{
|
||||||
DialogLayoutSettings layout(this);
|
VLayoutGenerator lGenerator(this);
|
||||||
|
lGenerator.SetDetails(listDetails);
|
||||||
|
|
||||||
|
DialogLayoutSettings layout(&lGenerator, this);
|
||||||
if (layout.exec() == QDialog::Rejected)
|
if (layout.exec() == QDialog::Rejected)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VLayoutGenerator lGenerator(this);
|
|
||||||
lGenerator.SetDetails(listDetails);
|
|
||||||
lGenerator.SetLayoutWidth(layout.GetLayoutWidth());
|
|
||||||
lGenerator.SetCaseType(layout.GetGroup());
|
|
||||||
lGenerator.SetPaperHeight(layout.GetPaperHeight());
|
|
||||||
lGenerator.SetPaperWidth(layout.GetPaperWidth());
|
|
||||||
lGenerator.SetShift(layout.GetShift());
|
|
||||||
lGenerator.SetRotate(layout.GetRotate());
|
|
||||||
lGenerator.SetRotationIncrease(layout.GetIncrease());
|
|
||||||
|
|
||||||
DialogLayoutProgress progress(listDetails.count(), this);
|
DialogLayoutProgress progress(listDetails.count(), this);
|
||||||
|
|
||||||
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
|
connect(&lGenerator, &VLayoutGenerator::Start, &progress, &DialogLayoutProgress::Start);
|
||||||
|
@ -732,7 +725,7 @@ void TableWindow::PrepareSceneList()
|
||||||
ui->listWidget->addItem(item);
|
ui->listWidget->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scenes.isEmpty() == false)
|
if (not scenes.isEmpty())
|
||||||
{
|
{
|
||||||
ui->listWidget->setCurrentRow(0);
|
ui->listWidget->setCurrentRow(0);
|
||||||
EnableActions(true);
|
EnableActions(true);
|
||||||
|
@ -757,7 +750,7 @@ QIcon TableWindow::ScenePreview(int i) const
|
||||||
Qt::RoundJoin));
|
Qt::RoundJoin));
|
||||||
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
painter.setBrush ( QBrush ( Qt::NoBrush ) );
|
||||||
scenes.at(i)->render(&painter);
|
scenes.at(i)->render(&painter);
|
||||||
image.scaled(101, 146, Qt::KeepAspectRatio);
|
painter.end();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,8 +117,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="iconSize">
|
<property name="iconSize">
|
||||||
<size>
|
<size>
|
||||||
<width>200</width>
|
<width>180</width>
|
||||||
<height>200</height>
|
<height>180</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="movement">
|
<property name="movement">
|
||||||
|
@ -130,6 +130,12 @@
|
||||||
<property name="isWrapping" stdset="0">
|
<property name="isWrapping" stdset="0">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>QListView::Adjust</enum>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
<property name="viewMode">
|
<property name="viewMode">
|
||||||
<enum>QListView::IconMode</enum>
|
<enum>QListView::IconMode</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -38,7 +38,8 @@
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutGenerator::VLayoutGenerator(QObject *parent)
|
VLayoutGenerator::VLayoutGenerator(QObject *parent)
|
||||||
:QObject(parent), papers(QVector<VLayoutPaper>()), bank(new VBank()), paperHeight(0), paperWidth(0),
|
:QObject(parent), papers(QVector<VLayoutPaper>()), bank(new VBank()), paperHeight(0), paperWidth(0),
|
||||||
stopGeneration(false), state(LayoutErrors::NoError), shift(0), rotate(true), rotationIncrease(180)
|
stopGeneration(false), state(LayoutErrors::NoError), shift(0), rotate(true), rotationIncrease(180),
|
||||||
|
autoCrop(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -161,7 +162,7 @@ QList<QGraphicsItem *> VLayoutGenerator::GetPapersItems() const
|
||||||
QList<QGraphicsItem *> list;
|
QList<QGraphicsItem *> list;
|
||||||
for (int i=0; i < papers.count(); ++i)
|
for (int i=0; i < papers.count(); ++i)
|
||||||
{
|
{
|
||||||
list.append(papers.at(i).GetPaperItem());
|
list.append(papers.at(i).GetPaperItem(autoCrop));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -184,6 +185,18 @@ void VLayoutGenerator::Abort()
|
||||||
state = LayoutErrors::ProcessStoped;
|
state = LayoutErrors::ProcessStoped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VLayoutGenerator::GetAutoCrop() const
|
||||||
|
{
|
||||||
|
return autoCrop;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VLayoutGenerator::SetAutoCrop(bool value)
|
||||||
|
{
|
||||||
|
autoCrop = value;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
int VLayoutGenerator::GetRotationIncrease() const
|
int VLayoutGenerator::GetRotationIncrease() const
|
||||||
|
|
|
@ -73,6 +73,9 @@ public:
|
||||||
int GetRotationIncrease() const;
|
int GetRotationIncrease() const;
|
||||||
void SetRotationIncrease(int value);
|
void SetRotationIncrease(int value);
|
||||||
|
|
||||||
|
bool GetAutoCrop() const;
|
||||||
|
void SetAutoCrop(bool value);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Start();
|
void Start();
|
||||||
void Arranged(int count);
|
void Arranged(int count);
|
||||||
|
@ -93,6 +96,7 @@ private:
|
||||||
unsigned int shift;
|
unsigned int shift;
|
||||||
bool rotate;
|
bool rotate;
|
||||||
int rotationIncrease;
|
int rotationIncrease;
|
||||||
|
bool autoCrop;
|
||||||
|
|
||||||
void CheckDetailsSize();
|
void CheckDetailsSize();
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VLayoutPaper::VLayoutPaper()
|
VLayoutPaper::VLayoutPaper()
|
||||||
|
@ -259,10 +260,32 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutDetail
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QGraphicsRectItem *VLayoutPaper::GetPaperItem() const
|
QGraphicsRectItem *VLayoutPaper::GetPaperItem(bool autoCrop) const
|
||||||
{
|
{
|
||||||
QGraphicsRectItem *paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(),
|
QGraphicsRectItem *paper;
|
||||||
d->globalContour.GetHeight()));
|
if (autoCrop)
|
||||||
|
{
|
||||||
|
QGraphicsScene *scene = new QGraphicsScene();
|
||||||
|
QList<QGraphicsItem *> list = GetDetails();
|
||||||
|
for (int i=0; i < list.size(); ++i)
|
||||||
|
{
|
||||||
|
scene->addItem(list.at(i));
|
||||||
|
}
|
||||||
|
const int height = scene->itemsBoundingRect().toRect().height() + static_cast<int>(d->layoutWidth)*2;
|
||||||
|
delete scene;
|
||||||
|
if (d->globalContour.GetHeight() > height)
|
||||||
|
{
|
||||||
|
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), height));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), d->globalContour.GetHeight()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
paper = new QGraphicsRectItem(QRectF(0, 0, d->globalContour.GetWidth(), d->globalContour.GetHeight()));
|
||||||
|
}
|
||||||
paper->setPen(QPen(Qt::black, 1));
|
paper->setPen(QPen(Qt::black, 1));
|
||||||
paper->setBrush(QBrush(Qt::white));
|
paper->setBrush(QBrush(Qt::white));
|
||||||
return paper;
|
return paper;
|
||||||
|
|
|
@ -69,7 +69,7 @@ public:
|
||||||
|
|
||||||
bool ArrangeDetail(const VLayoutDetail &detail, bool &stop);
|
bool ArrangeDetail(const VLayoutDetail &detail, bool &stop);
|
||||||
int Count() const;
|
int Count() const;
|
||||||
QGraphicsRectItem *GetPaperItem() const;
|
QGraphicsRectItem *GetPaperItem(bool autoCrop) const;
|
||||||
QList<QGraphicsItem *> GetDetails() const;
|
QList<QGraphicsItem *> GetDetails() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user