Refactoring for VPoster class.
Pass QSize instead QRect. To calculate tiles we need width and size only.
This commit is contained in:
parent
77be615877
commit
47b3eab0ad
|
@ -124,7 +124,7 @@ VPoster::VPoster(const QPrinter *printer)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<PosterData> VPoster::Calc(const QRect &imageRect, int page, PageOrientation orientation) const
|
||||
QVector<PosterData> VPoster::Calc(const QSize &imageRect, int page, PageOrientation orientation) const
|
||||
{
|
||||
QVector<PosterData> poster;
|
||||
|
||||
|
@ -390,7 +390,7 @@ int VPoster::CountColumns(int width, PageOrientation orientation) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
PosterData VPoster::Cut(int i, int j, const QRect &imageRect, PageOrientation orientation) const
|
||||
PosterData VPoster::Cut(int i, int j, const QSize &imageRect, PageOrientation orientation) const
|
||||
{
|
||||
Q_UNUSED(imageRect)
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class VPoster
|
|||
public:
|
||||
explicit VPoster(const QPrinter *printer);
|
||||
|
||||
QVector<PosterData> Calc(const QRect &imageRect, int page, PageOrientation orientation) const;
|
||||
QVector<PosterData> Calc(const QSize &imageRect, int page, PageOrientation orientation) const;
|
||||
|
||||
QVector<QGraphicsItem *> Tile(QGraphicsItem *parent, const PosterData &img, int sheets,
|
||||
const VWatermarkData &watermarkData, const QString &watermarkPath) const;
|
||||
|
@ -84,7 +84,7 @@ private:
|
|||
int CountRows(int height, PageOrientation orientation) const;
|
||||
int CountColumns(int width, PageOrientation orientation) const;
|
||||
|
||||
PosterData Cut(int i, int j, const QRect &imageRect, PageOrientation orientation) const;
|
||||
PosterData Cut(int i, int j, const QSize &imageRect, PageOrientation orientation) const;
|
||||
|
||||
QRect PageRect() const;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ void TST_VPoster::BigPoster()
|
|||
printer.setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Millimeter);
|
||||
|
||||
|
||||
const QRect image(0, 0, 2622, 3178); // Little bit bigger than A1
|
||||
const QSize image(2622, 3178); // Little bit bigger than A1
|
||||
VPoster posterazor(&printer);
|
||||
const QVector<PosterData> poster = posterazor.Calc(image, 0, PageOrientation::Portrait);
|
||||
|
||||
|
@ -75,7 +75,7 @@ void TST_VPoster::SmallPoster()
|
|||
printer.setResolution(96);// By default
|
||||
printer.setPageSize(QPageSize(QPageSize::A4));
|
||||
|
||||
const QRect image(0, 0, 700, 1000); // Little bit less than A4
|
||||
const QSize image(700, 1000); // Little bit less than A4
|
||||
VPoster posterazor(&printer);
|
||||
const QVector<PosterData> poster = posterazor.Calc(image, 0, PageOrientation::Portrait);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user